Re: [PATCH v2 2/2] drm/imx/dcss: have all init functions use devres

2024-01-09 Thread kernel test robot
Hi Philipp,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.7]
[also build test ERROR on linus/master]
[cannot apply to drm-misc/drm-misc-next next-20240109]
[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/Philipp-Stanner/drm-dcss-request-memory-region/20240109-182239
base:   v6.7
patch link:
https://lore.kernel.org/r/20240109102032.16165-3-pstanner%40redhat.com
patch subject: [PATCH v2 2/2] drm/imx/dcss: have all init functions use devres
config: arm64-defconfig 
(https://download.01.org/0day-ci/archive/20240110/202401101401.bi7u74fr-...@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240110/202401101401.bi7u74fr-...@intel.com/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 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202401101401.bi7u74fr-...@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:17,
from include/linux/platform_device.h:13,
from drivers/gpu/drm/imx/dcss/dcss-dev.c:9:
   drivers/gpu/drm/imx/dcss/dcss-dev.c: In function 'dcss_dev_create':
   drivers/gpu/drm/imx/dcss/dcss-dev.c:186:42: error: incompatible type for 
argument 1 of '__devm_request_region'
 186 | if (!devm_request_mem_region(pdev->dev, res->start, res_len, 
"dcss")) {
 |  ^
 |  |
 |  struct device
   include/linux/ioport.h:306:31: note: in definition of macro 
'devm_request_mem_region'
 306 | __devm_request_region(dev, _resource, (start), (n), 
(name))
 |   ^~~
   include/linux/ioport.h:308:63: note: expected 'struct device *' but argument 
is of type 'struct device'
 308 | extern struct resource * __devm_request_region(struct device *dev,
 |~~~^~~
>> drivers/gpu/drm/imx/dcss/dcss-dev.c:202:24: warning: returning 'int' from a 
>> function with return type 'struct dcss_dev *' makes pointer from integer 
>> without a cast [-Wint-conversion]
 202 | return ret;
 |^~~
--
   drivers/gpu/drm/imx/dcss/dcss-scaler.c: In function 
'dcss_scaler_ch_init_all':
>> drivers/gpu/drm/imx/dcss/dcss-scaler.c:305:45: error: 'dev' undeclared 
>> (first use in this function); did you mean 'cdev'?
 305 | ch->base_reg = devm_ioremap(dev, ch->base_ofs, 
SZ_4K);
 | ^~~
 | cdev
   drivers/gpu/drm/imx/dcss/dcss-scaler.c:305:45: note: each undeclared 
identifier is reported only once for each function it appears in
   drivers/gpu/drm/imx/dcss/dcss-scaler.c: In function 'dcss_scaler_init':
>> drivers/gpu/drm/imx/dcss/dcss-scaler.c:331:37: error: passing argument 1 of 
>> 'dcss_scaler_ch_init_all' from incompatible pointer type 
>> [-Werror=incompatible-pointer-types]
 331 | if (dcss_scaler_ch_init_all(dev, scaler, scaler_base))
 | ^~~
 | |
 | struct device *
   drivers/gpu/drm/imx/dcss/dcss-scaler.c:294:56: note: expected 'struct 
dcss_scaler *' but argument is of type 'struct device *'
 294 | static int dcss_scaler_ch_init_all(struct dcss_scaler *scl,
 |^~~
>> drivers/gpu/drm/imx/dcss/dcss-scaler.c:331:42: warning: passing argument 2 
>> of 'dcss_scaler_ch_init_all' makes integer from pointer without a cast 
>> [-Wint-conversion]
 331 | if (dcss_scaler_ch_init_all(dev, scaler, scaler_base))
 |  ^~
 |  |
 |  struct dcss_scaler *
   drivers/gpu/drm/imx/dcss/dcss-scaler.c:295:50: note: expected 'long unsigned 
int' but argument is of type 'struct dcss_scaler *'
 295 |unsigned long scaler_base)
 |~~^~~
>> drivers/gpu/drm/imx/dcss/dcss-scaler.c:331:13: error: too many arguments to 
>> function 'dcss_scaler_ch_init_all'
 331 | if (dcss_scaler_ch_init_all(dev, scaler, sca

[PATCH v2 2/2] drm/imx/dcss: have all init functions use devres

2024-01-09 Thread Philipp Stanner
dcss currently allocates and ioremaps quite a few resources in its probe
function's call graph. Devres now provides convenient functions which
perform the same task but do the cleanup automatically.

Port all memory allocations and ioremap() calls to the devres
counterparts.

Signed-off-by: Philipp Stanner 
---
 drivers/gpu/drm/imx/dcss/dcss-blkctl.c | 14 +++---
 drivers/gpu/drm/imx/dcss/dcss-ctxld.c  | 15 ---
 drivers/gpu/drm/imx/dcss/dcss-dev.c| 11 ++-
 drivers/gpu/drm/imx/dcss/dcss-dpr.c| 25 ++---
 drivers/gpu/drm/imx/dcss/dcss-drv.c| 12 +++-
 drivers/gpu/drm/imx/dcss/dcss-dtg.c| 23 ---
 drivers/gpu/drm/imx/dcss/dcss-scaler.c | 22 --
 drivers/gpu/drm/imx/dcss/dcss-ss.c | 11 +++
 8 files changed, 29 insertions(+), 104 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-blkctl.c 
b/drivers/gpu/drm/imx/dcss/dcss-blkctl.c
index c9b54bb2692d..58e12ec65f80 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-blkctl.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-blkctl.c
@@ -41,15 +41,15 @@ void dcss_blkctl_cfg(struct dcss_blkctl *blkctl)
 int dcss_blkctl_init(struct dcss_dev *dcss, unsigned long blkctl_base)
 {
struct dcss_blkctl *blkctl;
+   struct device *dev = dcss->dev;
 
-   blkctl = kzalloc(sizeof(*blkctl), GFP_KERNEL);
+   blkctl = devm_kzalloc(dev, sizeof(*blkctl), GFP_KERNEL);
if (!blkctl)
return -ENOMEM;
 
-   blkctl->base_reg = ioremap(blkctl_base, SZ_4K);
+   blkctl->base_reg = devm_ioremap(dev, blkctl_base, SZ_4K);
if (!blkctl->base_reg) {
dev_err(dcss->dev, "unable to remap BLK CTRL base\n");
-   kfree(blkctl);
return -ENOMEM;
}
 
@@ -60,11 +60,3 @@ int dcss_blkctl_init(struct dcss_dev *dcss, unsigned long 
blkctl_base)
 
return 0;
 }
-
-void dcss_blkctl_exit(struct dcss_blkctl *blkctl)
-{
-   if (blkctl->base_reg)
-   iounmap(blkctl->base_reg);
-
-   kfree(blkctl);
-}
diff --git a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c 
b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
index 3a84cb3209c4..444511d0f382 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
@@ -199,10 +199,11 @@ static int dcss_ctxld_alloc_ctx(struct dcss_ctxld *ctxld)
 
 int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long ctxld_base)
 {
+   struct device *dev = dcss->dev;
struct dcss_ctxld *ctxld;
int ret;
 
-   ctxld = kzalloc(sizeof(*ctxld), GFP_KERNEL);
+   ctxld = devm_kzalloc(dev, sizeof(*ctxld), GFP_KERNEL);
if (!ctxld)
return -ENOMEM;
 
@@ -217,7 +218,7 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long 
ctxld_base)
goto err;
}
 
-   ctxld->ctxld_reg = ioremap(ctxld_base, SZ_4K);
+   ctxld->ctxld_reg = devm_ioremap(dev, ctxld_base, SZ_4K);
if (!ctxld->ctxld_reg) {
dev_err(dcss->dev, "ctxld: unable to remap ctxld base\n");
ret = -ENOMEM;
@@ -226,18 +227,14 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long 
ctxld_base)
 
ret = dcss_ctxld_irq_config(ctxld, to_platform_device(dcss->dev));
if (ret)
-   goto err_irq;
+   goto err;
 
dcss_ctxld_hw_cfg(ctxld);
 
return 0;
 
-err_irq:
-   iounmap(ctxld->ctxld_reg);
-
 err:
dcss_ctxld_free_ctx(ctxld);
-   kfree(ctxld);
 
return ret;
 }
@@ -246,11 +243,7 @@ void dcss_ctxld_exit(struct dcss_ctxld *ctxld)
 {
free_irq(ctxld->irq, ctxld);
 
-   if (ctxld->ctxld_reg)
-   iounmap(ctxld->ctxld_reg);
-
dcss_ctxld_free_ctx(ctxld);
-   kfree(ctxld);
 }
 
 static int dcss_ctxld_enable_locked(struct dcss_ctxld *ctxld)
diff --git a/drivers/gpu/drm/imx/dcss/dcss-dev.c 
b/drivers/gpu/drm/imx/dcss/dcss-dev.c
index 1f93313c89b7..206452cf98d6 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-dev.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-dev.c
@@ -109,8 +109,6 @@ static int dcss_submodules_init(struct dcss_dev *dcss)
dcss_ctxld_exit(dcss->ctxld);
 
 ctxld_err:
-   dcss_blkctl_exit(dcss->blkctl);
-
dcss_clocks_disable(dcss);
 
return ret;
@@ -190,7 +188,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool 
hdmi_output)
return ERR_PTR(-EBUSY);
}
 
-   dcss = kzalloc(sizeof(*dcss), GFP_KERNEL);
+   dcss = devm_kzalloc(dev, sizeof(*dcss), GFP_KERNEL);
if (!dcss)
return ERR_PTR(-ENOMEM);
 
@@ -201,7 +199,7 @@ struct dcss_dev *dcss_dev_create(struct device *dev, bool 
hdmi_output)
ret = dcss_clks_init(dcss);
if (ret) {
dev_err(dev, "clocks initialization failed\n");
-   goto err;
+   return ret;
}
 
dcss->of_port = of_graph_get_port_by_id(dev->of_node, 0);
@@ -233,9 +231,6 @@ struct dcss_dev *dcss_dev_create(struct device