drm/mediatek: Convert legacy DRM logging to drm_* helpers in mtk_crtc.c
Subsystems (3)
PATCH 1/1 drm/mediatek: Convert legacy DRM logging to drm_* helpers in mtk_crtc.c
Replace DRM_ERROR() and DRM_DEBUG_DRIVER() calls in drivers/gpu/drm/mediatek/mtk_crtc.c with the corresponding drm__err() and drm_dbg_driver() helpers.
The drm_*() logging helpers take a struct drm_device * argument, allowing the DRM core to prefix log messages with the correct device name and instance. This is required to correctly distinguish log messages on systems with multiple GPUs.
This change aligns the Mediatek DRM driver with the DRM TODO item:
"Convert logging to drm_* functions with drm_device parameter".
drivers/gpu/drm/mediatek/mtk_crtc.c +14 -8
@@ -227,11 +227,12 @@ static int mtk_crtc_ddp_clk_enable(struct mtk_crtc *mtk_crtc) {int ret;int i; +struct drm_device *dev = mtk_crtc->base.dev;for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) { ret =mtk_ddp_comp_clk_enable (mtk_crtc->ddp_comp[i]);if (ret) { -DRM_ERROR ("Failed to enable clock %d: %d\n" , i, ret); +drm_err (dev,"Failed to enable clock %d: %d\n" , i, ret); goto err; } }
@@ -343,6 +344,7 @@ static int mtk_crtc_ddp_hw_init(struct mtk_crtc *mtk_crtc)struct drm_connector *connector;struct drm_encoder *encoder;struct drm_connector_list_iter conn_iter; +struct drm_device *dev = mtk_crtc->base.dev;unsigned int width, height, vrefresh, bpc =MTK_MAX_BPC ;int ret;int i;
@@ -371,19 +373,19 @@ static int mtk_crtc_ddp_hw_init(struct mtk_crtc *mtk_crtc) ret =pm_runtime_resume_and_get (crtc->dev->dev);if (ret <0 ) { -DRM_ERROR ("Failed to enable power domain: %d\n" , ret); +drm_err (dev,"Failed to enable power domain: %d\n" , ret);return ret; } ret =mtk_mutex_prepare (mtk_crtc->mutex);if (ret <0 ) { -DRM_ERROR ("Failed to enable mutex clock: %d\n" , ret); +drm_err (dev,"Failed to enable mutex clock: %d\n" , ret); goto err_pm_runtime_put; } ret =mtk_crtc_ddp_clk_enable (mtk_crtc);if (ret <0 ) { -DRM_ERROR ("Failed to enable component clocks: %d\n" , ret); +drm_err (dev,"Failed to enable component clocks: %d\n" , ret); goto err_mutex_unprepare; }
@@ -646,12 +648,13 @@ static void mtk_crtc_ddp_irq(void *data)struct drm_crtc *crtc = data;struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc);struct mtk_drm_private *priv = crtc->dev->dev_private; +struct drm_device *dev = mtk_crtc->base.dev;#if IS_REACHABLE (CONFIG_MTK_CMDQ )if (!priv->data->shadow_register && !mtk_crtc->cmdq_client.chan)mtk_crtc_ddp_config (crtc,NULL );else if (mtk_crtc->cmdq_vblank_cnt >0 && --mtk_crtc->cmdq_vblank_cnt ==0 ) -DRM_ERROR ("mtk_crtc %d CMDQ execute command timeout!\n" , +drm_err (dev,"mtk_crtc %d CMDQ execute command timeout!\n" ,drm_crtc_index (&mtk_crtc->base));#else if (!priv->data->shadow_register)
@@ -776,9 +779,10 @@ static void mtk_crtc_atomic_enable(struct drm_crtc *crtc, {struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc);struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0 ]; +struct drm_device *dev = mtk_crtc->base.dev;int ret; -DRM_DEBUG_DRIVER ("%s %d\n" , __func__, crtc->base.id); +drm_dbg_driver (dev,"%s %d\n" , __func__, crtc->base.id); ret =mtk_ddp_comp_power_on (comp);if (ret <0 ) {
@@ -803,9 +807,10 @@ static void mtk_crtc_atomic_disable(struct drm_crtc *crtc, {struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc);struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0 ]; +struct drm_device *dev = mtk_crtc->base.dev;int i; -DRM_DEBUG_DRIVER ("%s %d\n" , __func__, crtc->base.id); +drm_dbg_driver (dev,"%s %d\n" , __func__, crtc->base.id);if (!mtk_crtc->enabled)return ;
@@ -845,10 +850,11 @@ static void mtk_crtc_atomic_begin(struct drm_crtc *crtc, crtc);struct mtk_crtc_state *mtk_crtc_state =to_mtk_crtc_state (crtc_state);struct mtk_crtc *mtk_crtc =to_mtk_crtc (crtc); +struct drm_device *dev = mtk_crtc->base.dev;unsigned long flags;if (mtk_crtc->event && mtk_crtc_state->base.event) -DRM_ERROR ("new event while there is still a pending event\n" ); +drm_err (dev,"new event while there is still a pending event\n" );if (mtk_crtc_state->base.event) { mtk_crtc_state->base.event->pipe =drm_crtc_index (crtc);
Signature · 1 line
2.43.0
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Abhishek,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on pza/reset/next linus/master v6.19-rc1 next-20251219] [cannot apply to pza/imx-drm/next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Abhishek-Rajput/drm-mediatek-Convert-legacy-DRM-logging-to-drm_-helpers-in-mtk_crtc-c/20251217-150453 base: https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next patch link: https://lore.kernel.org/r/20251217070303.689913-1-abhiraj21put%40gmail.com patch subject: [PATCH] drm/mediatek: Convert legacy DRM logging to drm_* helpers in mtk_crtc.c config: loongarch-randconfig-r062-20251218 (https://download.01.org/0day-ci/archive/20251222/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 12.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251222/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from include/linux/lockdep.h:15,
from include/linux/mutex.h:17,
from include/linux/notifier.h:14,
from include/linux/clk.h:14,
from drivers/gpu/drm/mediatek/mtk_crtc.c:6:
arch/loongarch/include/asm/percpu.h:20:4: error: #error compiler support for the model attribute is necessary when a recent assembler is used
20 | # error compiler support for the model attribute is necessary when a recent assembler is used
| ^~~~~
drivers/gpu/drm/mediatek/mtk_crtc.c: In function 'mtk_crtc_ddp_irq':
>> drivers/gpu/drm/mediatek/mtk_crtc.c:651:28: warning: unused variable 'dev' [-Wunused-variable]
651 | struct drm_device *dev = mtk_crtc->base.dev;
| ^~~vim +/dev +651 drivers/gpu/drm/mediatek/mtk_crtc.c
645
646 static void mtk_crtc_ddp_irq(void *data)
647 {
648 struct drm_crtc *crtc = data;
649 struct mtk_crtc *mtk_crtc = to_mtk_crtc(crtc);
650 struct mtk_drm_private *priv = crtc->dev->dev_private;
> 651 struct drm_device *dev = mtk_crtc->base.dev;
652
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki