summaryrefslogtreecommitdiffstats
path: root/drivers/usb/core
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2018-09-28 15:40:31 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-02 12:05:30 -0700
commit355c74e55e9992126ec5e568a3edb8e280fe040d (patch)
tree0d45517642de599088dede57dc0d51144edbc25e /drivers/usb/core
parentbd0e6c9614b95352eb31d0207df16dc156c527fa (diff)
downloadblackbird-op-linux-355c74e55e9992126ec5e568a3edb8e280fe040d.tar.gz
blackbird-op-linux-355c74e55e9992126ec5e568a3edb8e280fe040d.zip
usb: export firmware port location in sysfs
The platform firmware "location" data is used to find port peer relationships. But firmware is an unreliable source, and there are real world examples of errors leading to missing or wrong peer relationships. Debugging this is currently hard. Exporting the location attribute makes it easier to spot mismatches between the firmware data and the real world. Signed-off-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r--drivers/usb/core/port.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 4a2143195395..1a06a4b5fbb1 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -16,6 +16,15 @@ static int usb_port_block_power_off;
static const struct attribute_group *port_dev_group[];
+static ssize_t location_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct usb_port *port_dev = to_usb_port(dev);
+
+ return sprintf(buf, "0x%08x\n", port_dev->location);
+}
+static DEVICE_ATTR_RO(location);
+
static ssize_t connect_type_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -140,6 +149,7 @@ static DEVICE_ATTR_RW(usb3_lpm_permit);
static struct attribute *port_dev_attrs[] = {
&dev_attr_connect_type.attr,
+ &dev_attr_location.attr,
&dev_attr_quirks.attr,
&dev_attr_over_current_count.attr,
NULL,
OpenPOWER on IntegriCloud