diff options
author | chenqiwu | 2020-02-14 20:56:37 +0800 |
---|---|---|
committer | Wolfram Sang | 2020-03-10 10:50:08 +0100 |
commit | 6b060d8a09e9ab03748d1134c34275714a3c0217 (patch) | |
tree | a255085348c32904546c8de37265c012f9b73337 /drivers/i2c | |
parent | a786b80c48c2d135a2387b870b19ab503701c314 (diff) |
i2c: use kobj_to_dev() API
Use kobj_to_dev() API instead of container_of().
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/i2c-slave-eeprom.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c index db9763cb4dae..cb415b10642f 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); |