linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: use kobj_to_dev() API
@ 2020-02-14 12:56 qiwuchen55
  2020-02-16 21:46 ` Luca Ceresoli
  2020-03-10  9:51 ` Wolfram Sang
  0 siblings, 2 replies; 5+ messages in thread
From: qiwuchen55 @ 2020-02-14 12:56 UTC (permalink / raw)
  To: wsa; +Cc: linux-i2c, chenqiwu

From: chenqiwu <chenqiwu@xiaomi.com>

Use kobj_to_dev() API instead of container_of().

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
 drivers/i2c/i2c-slave-eeprom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index db9763c..cb415b1 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -96,7 +96,7 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj
 	struct eeprom_data *eeprom;
 	unsigned long flags;
 
-	eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
+	eeprom = dev_get_drvdata(kobj_to_dev(kobj));
 
 	spin_lock_irqsave(&eeprom->buffer_lock, flags);
 	memcpy(buf, &eeprom->buffer[off], count);
@@ -111,7 +111,7 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob
 	struct eeprom_data *eeprom;
 	unsigned long flags;
 
-	eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
+	eeprom = dev_get_drvdata(kobj_to_dev(kobj));
 
 	spin_lock_irqsave(&eeprom->buffer_lock, flags);
 	memcpy(&eeprom->buffer[off], buf, count);
-- 
1.9.1

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

* Re: [PATCH] i2c: use kobj_to_dev() API
  2020-02-14 12:56 [PATCH] i2c: use kobj_to_dev() API qiwuchen55
@ 2020-02-16 21:46 ` Luca Ceresoli
  2020-03-10  9:51 ` Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2020-02-16 21:46 UTC (permalink / raw)
  To: qiwuchen55, wsa; +Cc: linux-i2c, chenqiwu

Hi,

On 14/02/20 13:56, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> Use kobj_to_dev() API instead of container_of().
> 
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>

Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>

-- 
Luca

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

* Re: [PATCH] i2c: use kobj_to_dev() API
  2020-02-14 12:56 [PATCH] i2c: use kobj_to_dev() API qiwuchen55
  2020-02-16 21:46 ` Luca Ceresoli
@ 2020-03-10  9:51 ` Wolfram Sang
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-03-10  9:51 UTC (permalink / raw)
  To: qiwuchen55; +Cc: linux-i2c, chenqiwu

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

On Fri, Feb 14, 2020 at 08:56:37PM +0800, qiwuchen55@gmail.com wrote:
> From: chenqiwu <chenqiwu@xiaomi.com>
> 
> Use kobj_to_dev() API instead of container_of().
> 
> Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* [PATCH] i2c: Use kobj_to_dev() API
@ 2020-09-17  3:08 Wang Qing
  2020-09-21  9:15 ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Wang Qing @ 2020-09-17  3:08 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-kernel; +Cc: Wang Qing

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(-)

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);
 }
 
-- 
2.7.4


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

* Re: [PATCH] i2c: Use kobj_to_dev() API
  2020-09-17  3:08 [PATCH] i2c: Use " Wang Qing
@ 2020-09-21  9:15 ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-09-21  9:15 UTC (permalink / raw)
  To: Wang Qing; +Cc: linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

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!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-09-21  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-14 12:56 [PATCH] i2c: use kobj_to_dev() API qiwuchen55
2020-02-16 21:46 ` Luca Ceresoli
2020-03-10  9:51 ` Wolfram Sang
  -- strict thread matches above, loose matches on Subject: below --
2020-09-17  3:08 [PATCH] i2c: Use " Wang Qing
2020-09-21  9:15 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).