diff mbox series

i2c: Use kobj_to_dev() API

Message ID 1600312126-24048-1-git-send-email-wangqing@vivo.com
State New
Headers show
Series i2c: Use kobj_to_dev() API | expand

Commit Message

Qing Wang Sept. 17, 2020, 3:08 a.m. UTC
Use kobj_to_dev() instead of container_of()

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 include/linux/i2c.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Sept. 21, 2020, 9:15 a.m. UTC | #1
On Thu, Sep 17, 2020 at 11:08:44AM +0800, Wang Qing wrote:
> Use kobj_to_dev() instead of container_of()

Correct. But same patch was already sent earlier:

http://patchwork.ozlabs.org/project/linux-i2c/patch/1600133898-35883-1-git-send-email-tiantao6@hisilicon.com/

Still thanks!
diff mbox series

Patch

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fc55ea4..5662265
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -344,7 +344,7 @@  const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id,
 
 static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
 {
-	struct device * const dev = container_of(kobj, struct device, kobj);
+	struct device * const dev = kobj_to_dev(kobj);
 	return to_i2c_client(dev);
 }