Skip to content

Commit 9aa7bd4

Browse files
Wang QingEnric Balletbo i Serra
authored andcommitted
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>
1 parent 6b194ee commit 9aa7bd4

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/platform/chrome/cros_ec_sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ static struct attribute *__ec_attrs[] = {
320320
static umode_t cros_ec_ctrl_visible(struct kobject *kobj,
321321
struct attribute *a, int n)
322322
{
323-
struct device *dev = container_of(kobj, struct device, kobj);
323+
struct device *dev = kobj_to_dev(kobj);
324324
struct cros_ec_dev *ec = to_cros_ec_dev(dev);
325325

326326
if (a == &dev_attr_kb_wake_angle.attr && !ec->has_kb_wake_angle)

drivers/platform/chrome/cros_ec_vbc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static ssize_t vboot_context_read(struct file *filp, struct kobject *kobj,
1717
struct bin_attribute *att, char *buf,
1818
loff_t pos, size_t count)
1919
{
20-
struct device *dev = container_of(kobj, struct device, kobj);
20+
struct device *dev = kobj_to_dev(kobj);
2121
struct cros_ec_dev *ec = to_cros_ec_dev(dev);
2222
struct cros_ec_device *ecdev = ec->ec_dev;
2323
struct ec_params_vbnvcontext *params;
@@ -57,7 +57,7 @@ static ssize_t vboot_context_write(struct file *filp, struct kobject *kobj,
5757
struct bin_attribute *attr, char *buf,
5858
loff_t pos, size_t count)
5959
{
60-
struct device *dev = container_of(kobj, struct device, kobj);
60+
struct device *dev = kobj_to_dev(kobj);
6161
struct cros_ec_dev *ec = to_cros_ec_dev(dev);
6262
struct cros_ec_device *ecdev = ec->ec_dev;
6363
struct ec_params_vbnvcontext *params;

0 commit comments

Comments
 (0)