diff mbox series

[v3,1/6] pinctrl: s32g2: use of_device_get_match_data() to get device data

Message ID 20230323144833.28562-2-clin@suse.com (mailing list archive)
State New, archived
Headers show
Series pinctrl: s32: driver improvements and generic struct use | expand

Commit Message

Chester Lin March 23, 2023, 2:48 p.m. UTC
Choose of_device_get_match_data() instead of indirect reference via
of_match_device() so that the implementation can be more concise.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Chester Lin <clin@suse.com>
---
Changes in v3:
- Declare the struct var 'info' as const and remove unnecessary type casting.

 drivers/pinctrl/nxp/pinctrl-s32g2.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

kernel test robot March 23, 2023, 5:11 p.m. UTC | #1
Hi Chester,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on linusw-pinctrl/for-next next-20230323]
[cannot apply to linus/master v6.3-rc3]
[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/Chester-Lin/pinctrl-s32g2-use-of_device_get_match_data-to-get-device-data/20230323-225141
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link:    https://lore.kernel.org/r/20230323144833.28562-2-clin%40suse.com
patch subject: [PATCH v3 1/6] pinctrl: s32g2: use of_device_get_match_data() to get device data
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20230324/202303240158.uaLsPb4O-lkp@intel.com/config)
compiler: aarch64-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/b716f96ba217e92e79b0d888f187ba0f30d705cf
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Chester-Lin/pinctrl-s32g2-use-of_device_get_match_data-to-get-device-data/20230323-225141
        git checkout b716f96ba217e92e79b0d888f187ba0f30d705cf
        # 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=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/pinctrl/nxp/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303240158.uaLsPb4O-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/pinctrl/nxp/pinctrl-s32g2.c: In function 's32g_pinctrl_probe':
>> drivers/pinctrl/nxp/pinctrl-s32g2.c:747:40: warning: passing argument 2 of 's32_pinctrl_probe' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     747 |         return s32_pinctrl_probe(pdev, info);
         |                                        ^~~~
   In file included from drivers/pinctrl/nxp/pinctrl-s32g2.c:18:
   drivers/pinctrl/nxp/pinctrl-s32.h:70:54: note: expected 'struct s32_pinctrl_soc_info *' but argument is of type 'const struct s32_pinctrl_soc_info *'
      70 |                         struct s32_pinctrl_soc_info *info);
         |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~


vim +747 drivers/pinctrl/nxp/pinctrl-s32g2.c

   740	
   741	static int s32g_pinctrl_probe(struct platform_device *pdev)
   742	{
   743		const struct s32_pinctrl_soc_info *info;
   744	
   745		info = of_device_get_match_data(&pdev->dev);
   746	
 > 747		return s32_pinctrl_probe(pdev, info);
   748	}
   749
Chester Lin March 23, 2023, 5:42 p.m. UTC | #2
On Fri, Mar 24, 2023 at 01:11:37AM +0800, kernel test robot wrote:
> Hi Chester,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on linusw-pinctrl/devel]
> [also build test WARNING on linusw-pinctrl/for-next next-20230323]
> [cannot apply to linus/master v6.3-rc3]
> [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/Chester-Lin/pinctrl-s32g2-use-of_device_get_match_data-to-get-device-data/20230323-225141
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
> patch link:    https://lore.kernel.org/r/20230323144833.28562-2-clin%40suse.com
> patch subject: [PATCH v3 1/6] pinctrl: s32g2: use of_device_get_match_data() to get device data
> config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20230324/202303240158.uaLsPb4O-lkp@intel.com/config)
> compiler: aarch64-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/b716f96ba217e92e79b0d888f187ba0f30d705cf
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Chester-Lin/pinctrl-s32g2-use-of_device_get_match_data-to-get-device-data/20230323-225141
>         git checkout b716f96ba217e92e79b0d888f187ba0f30d705cf
>         # 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=arm64 olddefconfig
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/pinctrl/nxp/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303240158.uaLsPb4O-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/pinctrl/nxp/pinctrl-s32g2.c: In function 's32g_pinctrl_probe':
> >> drivers/pinctrl/nxp/pinctrl-s32g2.c:747:40: warning: passing argument 2 of 's32_pinctrl_probe' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      747 |         return s32_pinctrl_probe(pdev, info);
>          |                                        ^~~~
>    In file included from drivers/pinctrl/nxp/pinctrl-s32g2.c:18:
>    drivers/pinctrl/nxp/pinctrl-s32.h:70:54: note: expected 'struct s32_pinctrl_soc_info *' but argument is of type 'const struct s32_pinctrl_soc_info *'
>       70 |                         struct s32_pinctrl_soc_info *info);
>          |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
> 

I will appreciate if someone can give me suggestions. In fact the patch [v3 6/6]
in this series can solve this warning properly rather than casting data type,
should I combine [1/6, changed from v2] and [6/6, new in v3] together since
they are relevant?

Thanks,
Chester

> 
> vim +747 drivers/pinctrl/nxp/pinctrl-s32g2.c
> 
>    740	
>    741	static int s32g_pinctrl_probe(struct platform_device *pdev)
>    742	{
>    743		const struct s32_pinctrl_soc_info *info;
>    744	
>    745		info = of_device_get_match_data(&pdev->dev);
>    746	
>  > 747		return s32_pinctrl_probe(pdev, info);
>    748	}
>    749	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
diff mbox series

Patch

diff --git a/drivers/pinctrl/nxp/pinctrl-s32g2.c b/drivers/pinctrl/nxp/pinctrl-s32g2.c
index 5028f4adc389..0e2d93681769 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32g2.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32g2.c
@@ -740,14 +740,11 @@  MODULE_DEVICE_TABLE(of, s32_pinctrl_of_match);
 
 static int s32g_pinctrl_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id =
-		of_match_device(s32_pinctrl_of_match, &pdev->dev);
+	const struct s32_pinctrl_soc_info *info;
 
-	if (!of_id)
-		return -ENODEV;
+	info = of_device_get_match_data(&pdev->dev);
 
-	return s32_pinctrl_probe
-			(pdev, (struct s32_pinctrl_soc_info *) of_id->data);
+	return s32_pinctrl_probe(pdev, info);
 }
 
 static const struct dev_pm_ops s32g_pinctrl_pm_ops = {