From: Vijay Kumar Date: Thu, 6 Oct 2016 19:06:11 +0000 (-0700) Subject: usb/core: Added devspec sysfs entry for devices behind the usb hub X-Git-Tag: v4.1.12-105.0.20170705_2000~47 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4a6fa5aa920c90e606ab4538f7965aa97911076f;p=users%2Fjedix%2Flinux-maple.git usb/core: Added devspec sysfs entry for devices behind the usb hub Grub finds incorrect of_node path for devices behind usb hub. Added devspec sysfs entry for devices behind usb hub so that right of_node path is returned during grub sysfs walk for these devices. Signed-off-by: Vijay Kumar Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 51fa91475e431e75b802dbab7c056f2829dc9410) Signed-off-by: Vijay Kumar Reviewed-by: Babu Moger Orabug: 24785721 Signed-off-by: Allen Pais --- diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index d26973844a4d..c905bff66763 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "usb.h" /* Active configuration fields */ @@ -96,6 +97,17 @@ static ssize_t bConfigurationValue_store(struct device *dev, static DEVICE_ATTR_IGNORE_LOCKDEP(bConfigurationValue, S_IRUGO | S_IWUSR, bConfigurationValue_show, bConfigurationValue_store); +#ifdef CONFIG_OF +static ssize_t devspec_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct device_node *of_node = dev->of_node; + + return sprintf(buf, "%s\n", of_node_full_name(of_node)); +} +static DEVICE_ATTR_RO(devspec); +#endif + /* String fields */ #define usb_string_attr(name) \ static ssize_t name##_show(struct device *dev, \ @@ -706,6 +718,9 @@ static struct attribute *dev_attrs[] = { &dev_attr_remove.attr, &dev_attr_removable.attr, &dev_attr_ltm_capable.attr, +#ifdef CONFIG_OF + &dev_attr_devspec.attr, +#endif NULL, }; static struct attribute_group dev_attr_grp = {