Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
{
struct at24_data *at24;
- at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
+ at24 = dev_get_drvdata(kobj_to_dev(kobj));
return at24_read(at24, buf, off, count);
}
{
struct at24_data *at24;
- at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
+ at24 = dev_get_drvdata(kobj_to_dev(kobj));
return at24_write(at24, buf, off, count);
}
struct device *dev;
struct at25_data *at25;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
at25 = dev_get_drvdata(dev);
return at25_ee_read(at25, buf, off, count);
struct device *dev;
struct at25_data *at25;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
at25 = dev_get_drvdata(dev);
return at25_ee_write(at25, buf, off, count);
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
- struct i2c_client *client = to_i2c_client(container_of(kobj, struct device, kobj));
+ struct i2c_client *client = to_i2c_client(kobj_to_dev(kobj));
struct eeprom_data *data = i2c_get_clientdata(client);
u8 slice;
int bits, ret;
u16 cmd_addr;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
edev = dev_get_drvdata(dev);
cmd_addr = OP_READ << edev->addrlen;
struct device *dev;
int i, ret, step = 1;
- dev = container_of(kobj, struct device, kobj);
+ dev = kobj_to_dev(kobj);
edev = dev_get_drvdata(dev);
/* only write even number of bytes on 16-bit devices */