Skip to contentSkip to conversation

w1: Use kobj_to_dev() API

PATCH Superseded Wang Qing 2 participants 2 messages Sep 17, 2020 W1 dallas's 1-wire bus

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 w1: Use kobj_to_dev() API

Use kobj_to_dev() instead of container_of()

---
 include/linux/w1.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/w1.h +1 -1
index cebf346..7f45174
@@ -311,7 +311,7 @@ static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
 
 static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
 {
-	return dev_to_w1_slave(container_of(kobj, struct device, kobj));
+	return dev_to_w1_slave(kobj_to_dev(kobj););
 }
 
 static inline struct w1_master* dev_to_w1_master(struct device *dev)
Signature · 1 line
2.7.4
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Wang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.9-rc5 next-20200916] [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/0day-ci/linux/commits/Wang-Qing/w1-Use-kobj_to_dev-API/20200917-111747
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bcf876870b95592b52519ed4aafcf9d95999bc9c
config: x86_64-randconfig-r001-20200917 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1321160a26e7e489baf9b10d6de90a342f898960)

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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from drivers/base/regmap/regmap-w1.c:10:

>> include/linux/w1.h:314:42: error: unexpected ';' before ')'
           return dev_to_w1_slave(kobj_to_dev(kobj););
                                                   ^

1 error generated.

# https://github.com/0day-ci/linux/commit/8f6dda3bde8b884cd5eec16f69f90baf83a6eabc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Wang-Qing/w1-Use-kobj_to_dev-API/20200917-111747 git checkout 8f6dda3bde8b884cd5eec16f69f90baf83a6eabc
vim +314 include/linux/w1.h

311
312 static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
313 {

 > 314		return dev_to_w1_slave(kobj_to_dev(kobj););

315 }
316

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org