[linux-next] drm/bridge: Use device_match_of_node()

Message ID 202211171431525183998@zte.com.cn
State New
Headers
Series [linux-next] drm/bridge: Use device_match_of_node() |

Commit Message

ye.xingchen@zte.com.cn Nov. 17, 2022, 6:31 a.m. UTC
  From: ye xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with device_match_of_node().

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/gpu/drm/drm_bridge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

kernel test robot Nov. 17, 2022, 10:30 p.m. UTC | #1
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-bridge-Use-device_match_of_node/20221117-143318
patch link:    https://lore.kernel.org/r/202211171431525183998%40zte.com.cn
patch subject: [PATCH linux-next] drm/bridge: Use device_match_of_node()
config: i386-randconfig-a002
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
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/ac41c97354fe9c549e20dc7e50a237a577cd71e9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ye-xingchen-zte-com-cn/drm-bridge-Use-device_match_of_node/20221117-143318
        git checkout ac41c97354fe9c549e20dc7e50a237a577cd71e9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_bridge.c:1310:28: error: incompatible pointer types passing 'struct drm_bridge *' to parameter of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
                   if (device_match_of_node(bridge, np)) {
                                            ^~~~~~
   include/linux/device/bus.h:145:41: note: passing argument to parameter 'dev' here
   int device_match_of_node(struct device *dev, const void *np);
                                           ^
   1 error generated.


vim +1310 drivers/gpu/drm/drm_bridge.c

  1292	
  1293	#ifdef CONFIG_OF
  1294	/**
  1295	 * of_drm_find_bridge - find the bridge corresponding to the device node in
  1296	 *			the global bridge list
  1297	 *
  1298	 * @np: device node
  1299	 *
  1300	 * RETURNS:
  1301	 * drm_bridge control struct on success, NULL on failure
  1302	 */
  1303	struct drm_bridge *of_drm_find_bridge(struct device_node *np)
  1304	{
  1305		struct drm_bridge *bridge;
  1306	
  1307		mutex_lock(&bridge_lock);
  1308	
  1309		list_for_each_entry(bridge, &bridge_list, list) {
> 1310			if (device_match_of_node(bridge, np)) {
  1311				mutex_unlock(&bridge_lock);
  1312				return bridge;
  1313			}
  1314		}
  1315	
  1316		mutex_unlock(&bridge_lock);
  1317		return NULL;
  1318	}
  1319	EXPORT_SYMBOL(of_drm_find_bridge);
  1320	#endif
  1321
  
kernel test robot Nov. 17, 2022, 10:31 p.m. UTC | #2
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-bridge-Use-device_match_of_node/20221117-143318
patch link:    https://lore.kernel.org/r/202211171431525183998%40zte.com.cn
patch subject: [PATCH linux-next] drm/bridge: Use device_match_of_node()
config: m68k-randconfig-r035-20221117
compiler: m68k-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/ac41c97354fe9c549e20dc7e50a237a577cd71e9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ye-xingchen-zte-com-cn/drm-bridge-Use-device_match_of_node/20221117-143318
        git checkout ac41c97354fe9c549e20dc7e50a237a577cd71e9
        # 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=m68k SHELL=/bin/bash drivers/gpu/drm/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/drm_bridge.c: In function 'of_drm_find_bridge':
>> drivers/gpu/drm/drm_bridge.c:1310:42: error: passing argument 1 of 'device_match_of_node' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1310 |                 if (device_match_of_node(bridge, np)) {
         |                                          ^~~~~~
         |                                          |
         |                                          struct drm_bridge *
   In file included from include/linux/device.h:30,
                    from include/linux/hdmi.h:28,
                    from include/drm/drm_modes.h:30,
                    from include/drm/drm_crtc.h:32,
                    from include/drm/drm_atomic.h:31,
                    from include/drm/drm_bridge.h:30,
                    from drivers/gpu/drm/drm_bridge.c:30:
   include/linux/device/bus.h:145:41: note: expected 'struct device *' but argument is of type 'struct drm_bridge *'
     145 | int device_match_of_node(struct device *dev, const void *np);
         |                          ~~~~~~~~~~~~~~~^~~
   cc1: some warnings being treated as errors


vim +/device_match_of_node +1310 drivers/gpu/drm/drm_bridge.c

  1292	
  1293	#ifdef CONFIG_OF
  1294	/**
  1295	 * of_drm_find_bridge - find the bridge corresponding to the device node in
  1296	 *			the global bridge list
  1297	 *
  1298	 * @np: device node
  1299	 *
  1300	 * RETURNS:
  1301	 * drm_bridge control struct on success, NULL on failure
  1302	 */
  1303	struct drm_bridge *of_drm_find_bridge(struct device_node *np)
  1304	{
  1305		struct drm_bridge *bridge;
  1306	
  1307		mutex_lock(&bridge_lock);
  1308	
  1309		list_for_each_entry(bridge, &bridge_list, list) {
> 1310			if (device_match_of_node(bridge, np)) {
  1311				mutex_unlock(&bridge_lock);
  1312				return bridge;
  1313			}
  1314		}
  1315	
  1316		mutex_unlock(&bridge_lock);
  1317		return NULL;
  1318	}
  1319	EXPORT_SYMBOL(of_drm_find_bridge);
  1320	#endif
  1321
  
kernel test robot Nov. 17, 2022, 10:31 p.m. UTC | #3
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-bridge-Use-device_match_of_node/20221117-143318
patch link:    https://lore.kernel.org/r/202211171431525183998%40zte.com.cn
patch subject: [PATCH linux-next] drm/bridge: Use device_match_of_node()
config: arm-randconfig-r024-20221117
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project bbe6bd724a6335e497c7edaed191d37a828d0390)
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
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/ac41c97354fe9c549e20dc7e50a237a577cd71e9
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ye-xingchen-zte-com-cn/drm-bridge-Use-device_match_of_node/20221117-143318
        git checkout ac41c97354fe9c549e20dc7e50a237a577cd71e9
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_bridge.c:1310:28: error: incompatible pointer types passing 'struct drm_bridge *' to parameter of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
                   if (device_match_of_node(bridge, np)) {
                                            ^~~~~~
   include/linux/device/bus.h:145:41: note: passing argument to parameter 'dev' here
   int device_match_of_node(struct device *dev, const void *np);
                                           ^
   1 error generated.


vim +1310 drivers/gpu/drm/drm_bridge.c

  1292	
  1293	#ifdef CONFIG_OF
  1294	/**
  1295	 * of_drm_find_bridge - find the bridge corresponding to the device node in
  1296	 *			the global bridge list
  1297	 *
  1298	 * @np: device node
  1299	 *
  1300	 * RETURNS:
  1301	 * drm_bridge control struct on success, NULL on failure
  1302	 */
  1303	struct drm_bridge *of_drm_find_bridge(struct device_node *np)
  1304	{
  1305		struct drm_bridge *bridge;
  1306	
  1307		mutex_lock(&bridge_lock);
  1308	
  1309		list_for_each_entry(bridge, &bridge_list, list) {
> 1310			if (device_match_of_node(bridge, np)) {
  1311				mutex_unlock(&bridge_lock);
  1312				return bridge;
  1313			}
  1314		}
  1315	
  1316		mutex_unlock(&bridge_lock);
  1317		return NULL;
  1318	}
  1319	EXPORT_SYMBOL(of_drm_find_bridge);
  1320	#endif
  1321
  

Patch

diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 1545c50fd1c8..4a8cafe2b130 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -1307,7 +1307,7 @@  struct drm_bridge *of_drm_find_bridge(struct device_node *np)
 	mutex_lock(&bridge_lock);

 	list_for_each_entry(bridge, &bridge_list, list) {
-		if (bridge->of_node == np) {
+		if (device_match_of_node(bridge, np)) {
 			mutex_unlock(&bridge_lock);
 			return bridge;
 		}