Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/chrome: Use kobj_to_dev() instead of container_of()

Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing <wangqing@vivo.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>

authored by

Wang Qing and committed by
Enric Balletbo i Serra
9aa7bd45 6b194ee9

+3 -3
+1 -1
drivers/platform/chrome/cros_ec_sysfs.c
··· 320 320 static umode_t cros_ec_ctrl_visible(struct kobject *kobj, 321 321 struct attribute *a, int n) 322 322 { 323 - struct device *dev = container_of(kobj, struct device, kobj); 323 + struct device *dev = kobj_to_dev(kobj); 324 324 struct cros_ec_dev *ec = to_cros_ec_dev(dev); 325 325 326 326 if (a == &dev_attr_kb_wake_angle.attr && !ec->has_kb_wake_angle)
+2 -2
drivers/platform/chrome/cros_ec_vbc.c
··· 17 17 struct bin_attribute *att, char *buf, 18 18 loff_t pos, size_t count) 19 19 { 20 - struct device *dev = container_of(kobj, struct device, kobj); 20 + struct device *dev = kobj_to_dev(kobj); 21 21 struct cros_ec_dev *ec = to_cros_ec_dev(dev); 22 22 struct cros_ec_device *ecdev = ec->ec_dev; 23 23 struct ec_params_vbnvcontext *params; ··· 57 57 struct bin_attribute *attr, char *buf, 58 58 loff_t pos, size_t count) 59 59 { 60 - struct device *dev = container_of(kobj, struct device, kobj); 60 + struct device *dev = kobj_to_dev(kobj); 61 61 struct cros_ec_dev *ec = to_cros_ec_dev(dev); 62 62 struct cros_ec_device *ecdev = ec->ec_dev; 63 63 struct ec_params_vbnvcontext *params;