All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] device-dax: use kobj_to_dev()
@ 2022-04-25 10:53 cgel.zte
  2022-04-25 16:33 ` kernel test robot
  2022-04-25 18:25 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: cgel.zte @ 2022-04-25 10:53 UTC (permalink / raw)
  To: dan.j.williams
  Cc: vishal.l.verma, dave.jiang, nvdimm, linux-kernel, Minghao Chi,
	Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

Use kobj_to_dev() instead of open-coding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 drivers/dax/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 1dad813ee4a6..aebe884f5d99 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -512,7 +512,7 @@ static DEVICE_ATTR_WO(delete);
 static umode_t dax_region_visible(struct kobject *kobj, struct attribute *a,
 		int n)
 {
-	struct device *dev = container_of(kobj, struct device, kobj);
+	struct device *dev = kobj_to_dev(kobj)
 	struct dax_region *dax_region = dev_get_drvdata(dev);
 
 	if (is_static(dax_region))
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] device-dax: use kobj_to_dev()
  2022-04-25 10:53 [PATCH] device-dax: use kobj_to_dev() cgel.zte
@ 2022-04-25 16:33 ` kernel test robot
  2022-04-25 18:25 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-25 16:33 UTC (permalink / raw)
  To: cgel.zte, dan.j.williams
  Cc: kbuild-all, vishal.l.verma, dave.jiang, nvdimm, linux-kernel,
	Minghao Chi, Zeal Robot

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.18-rc4 next-20220422]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/cgel-zte-gmail-com/device-dax-use-kobj_to_dev/20220425-185400
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git af2d861d4cd2a4da5137f795ee3509e6f944a25b
config: i386-randconfig-r016-20220425 (https://download.01.org/0day-ci/archive/20220426/202204260044.wlRoUZiW-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/83eff180ded41da8e042373de81fa823835a1be0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/device-dax-use-kobj_to_dev/20220425-185400
        git checkout 83eff180ded41da8e042373de81fa823835a1be0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/dax/

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

All errors (new ones prefixed by >>):

   drivers/dax/bus.c: In function 'dax_region_visible':
>> drivers/dax/bus.c:516:9: error: expected ',' or ';' before 'struct'
     516 |         struct dax_region *dax_region = dev_get_drvdata(dev);
         |         ^~~~~~
>> drivers/dax/bus.c:518:23: error: 'dax_region' undeclared (first use in this function)
     518 |         if (is_static(dax_region))
         |                       ^~~~~~~~~~
   drivers/dax/bus.c:518:23: note: each undeclared identifier is reported only once for each function it appears in
   drivers/dax/bus.c:515:24: warning: unused variable 'dev' [-Wunused-variable]
     515 |         struct device *dev = kobj_to_dev(kobj)
         |                        ^~~


vim +516 drivers/dax/bus.c

0f3da14a4f0503 Dan Williams 2020-10-13  511  
c2f3011ee697f8 Dan Williams 2020-10-13  512  static umode_t dax_region_visible(struct kobject *kobj, struct attribute *a,
c2f3011ee697f8 Dan Williams 2020-10-13  513  		int n)
c2f3011ee697f8 Dan Williams 2020-10-13  514  {
83eff180ded41d Minghao Chi  2022-04-25  515  	struct device *dev = kobj_to_dev(kobj)
c2f3011ee697f8 Dan Williams 2020-10-13 @516  	struct dax_region *dax_region = dev_get_drvdata(dev);
c2f3011ee697f8 Dan Williams 2020-10-13  517  
0f3da14a4f0503 Dan Williams 2020-10-13 @518  	if (is_static(dax_region))
0f3da14a4f0503 Dan Williams 2020-10-13  519  		if (a == &dev_attr_available_size.attr
0f3da14a4f0503 Dan Williams 2020-10-13  520  				|| a == &dev_attr_create.attr
0f3da14a4f0503 Dan Williams 2020-10-13  521  				|| a == &dev_attr_seed.attr
0f3da14a4f0503 Dan Williams 2020-10-13  522  				|| a == &dev_attr_delete.attr)
c2f3011ee697f8 Dan Williams 2020-10-13  523  			return 0;
c2f3011ee697f8 Dan Williams 2020-10-13  524  	return a->mode;
c2f3011ee697f8 Dan Williams 2020-10-13  525  }
c2f3011ee697f8 Dan Williams 2020-10-13  526  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] device-dax: use kobj_to_dev()
  2022-04-25 10:53 [PATCH] device-dax: use kobj_to_dev() cgel.zte
  2022-04-25 16:33 ` kernel test robot
@ 2022-04-25 18:25 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-04-25 18:25 UTC (permalink / raw)
  To: cgel.zte, dan.j.williams
  Cc: llvm, kbuild-all, vishal.l.verma, dave.jiang, nvdimm,
	linux-kernel, Minghao Chi, Zeal Robot

Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.18-rc4 next-20220422]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/cgel-zte-gmail-com/device-dax-use-kobj_to_dev/20220425-185400
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git af2d861d4cd2a4da5137f795ee3509e6f944a25b
config: hexagon-randconfig-r041-20220425 (https://download.01.org/0day-ci/archive/20220426/202204260238.kDqgLOsU-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 1cddcfdc3c683b393df1a5c9063252eb60e52818)
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/83eff180ded41da8e042373de81fa823835a1be0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review cgel-zte-gmail-com/device-dax-use-kobj_to_dev/20220425-185400
        git checkout 83eff180ded41da8e042373de81fa823835a1be0
        # 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=hexagon SHELL=/bin/bash drivers/

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

All errors (new ones prefixed by >>):

>> drivers/dax/bus.c:515:40: error: expected ';' at end of declaration
           struct device *dev = kobj_to_dev(kobj)
                                                 ^
                                                 ;
   1 error generated.


vim +515 drivers/dax/bus.c

   511	
   512	static umode_t dax_region_visible(struct kobject *kobj, struct attribute *a,
   513			int n)
   514	{
 > 515		struct device *dev = kobj_to_dev(kobj)
   516		struct dax_region *dax_region = dev_get_drvdata(dev);
   517	
   518		if (is_static(dax_region))
   519			if (a == &dev_attr_available_size.attr
   520					|| a == &dev_attr_create.attr
   521					|| a == &dev_attr_seed.attr
   522					|| a == &dev_attr_delete.attr)
   523				return 0;
   524		return a->mode;
   525	}
   526	

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-25 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25 10:53 [PATCH] device-dax: use kobj_to_dev() cgel.zte
2022-04-25 16:33 ` kernel test robot
2022-04-25 18:25 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.