[linux-next] dmaengine: of-dma: Use device_match_of_node()

Message ID 202211171341474562261@zte.com.cn
State New
Headers
Series [linux-next] dmaengine: of-dma: Use device_match_of_node() |

Commit Message

ye.xingchen@zte.com.cn Nov. 17, 2022, 5:41 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/dma/of-dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

kernel test robot Nov. 17, 2022, 9:10 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/dmaengine-of-dma-Use-device_match_of_node/20221117-134259
patch link:    https://lore.kernel.org/r/202211171341474562261%40zte.com.cn
patch subject: [PATCH linux-next] dmaengine: of-dma: Use device_match_of_node()
config: arm-buildonly-randconfig-r001-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/15adf668da6fd1025f2aee6634033ec9d0c13a0a
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review ye-xingchen-zte-com-cn/dmaengine-of-dma-Use-device_match_of_node/20221117-134259
        git checkout 15adf668da6fd1025f2aee6634033ec9d0c13a0a
        # 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 drivers/

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/dma/of-dma.c:160:28: error: incompatible pointer types passing 'struct of_dma *' to parameter of type 'struct device *' [-Werror,-Wincompatible-pointer-types]
                   if (device_match_of_node(ofdma, 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 +160 drivers/dma/of-dma.c

   146	
   147	/**
   148	 * of_dma_controller_free - Remove a DMA controller from DT DMA helpers list
   149	 * @np:		device node of DMA controller
   150	 *
   151	 * Memory allocated by of_dma_controller_register() is freed here.
   152	 */
   153	void of_dma_controller_free(struct device_node *np)
   154	{
   155		struct of_dma *ofdma;
   156	
   157		mutex_lock(&of_dma_lock);
   158	
   159		list_for_each_entry(ofdma, &of_dma_list, of_dma_controllers)
 > 160			if (device_match_of_node(ofdma, np)) {
   161				list_del(&ofdma->of_dma_controllers);
   162				kfree(ofdma);
   163				break;
   164			}
   165	
   166		mutex_unlock(&of_dma_lock);
   167	}
   168	EXPORT_SYMBOL_GPL(of_dma_controller_free);
   169
  

Patch

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index ac61ecda2926..8281a4aebca8 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -157,7 +157,7 @@  void of_dma_controller_free(struct device_node *np)
 	mutex_lock(&of_dma_lock);

 	list_for_each_entry(ofdma, &of_dma_list, of_dma_controllers)
-		if (ofdma->of_node == np) {
+		if (device_match_of_node(ofdma, np)) {
 			list_del(&ofdma->of_dma_controllers);
 			kfree(ofdma);
 			break;