diff options
author | chenqiwu <chenqiwu@xiaomi.com> | 2020-02-14 20:37:00 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-14 08:38:15 -0800 |
commit | 0616ca73fd35409b0d8d2a17bbca42f6febcd235 (patch) | |
tree | e5851c13f4cdca3d85a88c09b310c515df9ccf4b /drivers/usb/core | |
parent | ca065bf12771078571dec758300631624edc19a2 (diff) | |
download | linux-stable-0616ca73fd35409b0d8d2a17bbca42f6febcd235.tar.gz linux-stable-0616ca73fd35409b0d8d2a17bbca42f6febcd235.tar.bz2 linux-stable-0616ca73fd35409b0d8d2a17bbca42f6febcd235.zip |
usb: use kobj_to_dev() API
Use kobj_to_dev() API instead of container_of().
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
Link: https://lore.kernel.org/r/1581683820-9978-1-git-send-email-qiwuchen55@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/sysfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index f19694e69f5c..9f4320b9d7fc 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -849,7 +849,7 @@ static struct attribute *dev_string_attrs[] = { static umode_t dev_string_attrs_are_visible(struct kobject *kobj, struct attribute *a, int n) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct usb_device *udev = to_usb_device(dev); if (a == &dev_attr_manufacturer.attr) { @@ -883,7 +883,7 @@ read_descriptors(struct file *filp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct usb_device *udev = to_usb_device(dev); size_t nleft = count; size_t srclen, n; @@ -1233,7 +1233,7 @@ static struct attribute *intf_assoc_attrs[] = { static umode_t intf_assoc_attrs_are_visible(struct kobject *kobj, struct attribute *a, int n) { - struct device *dev = container_of(kobj, struct device, kobj); + struct device *dev = kobj_to_dev(kobj); struct usb_interface *intf = to_usb_interface(dev); if (intf->intf_assoc == NULL) |