2022-11-17 07:24:24

by ye.xingchen

[permalink] [raw]
Subject: [PATCH linux-next] drm/imx: Use device_match_of_node()

From: ye xingchen <[email protected]>

Replace the open-code with device_match_of_node().

Signed-off-by: ye xingchen <[email protected]>
---
drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index e060fa6cbcb9..2e4f5af894b0 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -182,7 +182,7 @@ static int compare_of(struct device *dev, void *data)
if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
struct ipu_client_platformdata *pdata = dev->platform_data;

- return pdata->of_node == np;
+ return device_match_of_node(pdata, np);
}

/* Special case for LDB, one device for two channels */
@@ -191,7 +191,7 @@ static int compare_of(struct device *dev, void *data)
of_node_put(np);
}

- return dev->of_node == np;
+ return device_match_of_node(dev, np);
}

static int imx_drm_bind(struct device *dev)
--
2.25.1


2022-11-20 11:20:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH linux-next] drm/imx: Use device_match_of_node()

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20221116]

url: https://github.com/intel-lab-lkp/linux/commits/ye-xingchen-zte-com-cn/drm-imx-Use-device_match_of_node/20221117-151254
patch link: https://lore.kernel.org/r/202211171511333735699%40zte.com.cn
patch subject: [PATCH linux-next] drm/imx: Use device_match_of_node()
config: microblaze-allmodconfig
compiler: microblaze-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/94ad00c926678ebff17e91e24878777fb900936a
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review ye-xingchen-zte-com-cn/drm-imx-Use-device_match_of_node/20221117-151254
git checkout 94ad00c926678ebff17e91e24878777fb900936a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/gpu/drm/imx/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/gpu/drm/imx/imx-drm-core.c: In function 'compare_of':
>> drivers/gpu/drm/imx/imx-drm-core.c:185:45: error: passing argument 1 of 'device_match_of_node' from incompatible pointer type [-Werror=incompatible-pointer-types]
185 | return device_match_of_node(pdata, np);
| ^~~~~
| |
| struct ipu_client_platformdata *
In file included from include/linux/device.h:30,
from drivers/gpu/drm/imx/imx-drm-core.c:9:
include/linux/device/bus.h:145:41: note: expected 'struct device *' but argument is of type 'struct ipu_client_platformdata *'
145 | int device_match_of_node(struct device *dev, const void *np);
| ~~~~~~~~~~~~~~~^~~
cc1: some warnings being treated as errors


vim +/device_match_of_node +185 drivers/gpu/drm/imx/imx-drm-core.c

176
177 static int compare_of(struct device *dev, void *data)
178 {
179 struct device_node *np = data;
180
181 /* Special case for DI, dev->of_node may not be set yet */
182 if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
183 struct ipu_client_platformdata *pdata = dev->platform_data;
184
> 185 return device_match_of_node(pdata, np);
186 }
187
188 /* Special case for LDB, one device for two channels */
189 if (of_node_name_eq(np, "lvds-channel")) {
190 np = of_get_parent(np);
191 of_node_put(np);
192 }
193
194 return device_match_of_node(dev, np);
195 }
196

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (3.04 kB)
config (315.41 kB)
Download all attachments

2022-11-28 09:25:25

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH linux-next] drm/imx: Use device_match_of_node()

Hello,

On 17.11.22 08:11, [email protected] wrote:
> From: ye xingchen <[email protected]>
>
> Replace the open-code with device_match_of_node().

device_match_of_node() exists so a pointer to the function can be passed
to class/driver_find_device. I see no reason to call it directly.

I don't think you should pursue any patches, where you do this
transformation even if they pass a compile test unlike the patch here.

Thanks,
Ahmad

>
> Signed-off-by: ye xingchen <[email protected]>
> ---
> drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index e060fa6cbcb9..2e4f5af894b0 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -182,7 +182,7 @@ static int compare_of(struct device *dev, void *data)
> if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) {
> struct ipu_client_platformdata *pdata = dev->platform_data;
>
> - return pdata->of_node == np;
> + return device_match_of_node(pdata, np);
> }
>
> /* Special case for LDB, one device for two channels */
> @@ -191,7 +191,7 @@ static int compare_of(struct device *dev, void *data)
> of_node_put(np);
> }
>
> - return dev->of_node == np;
> + return device_match_of_node(dev, np);
> }
>
> static int imx_drm_bind(struct device *dev)

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |