+ Shuah Khan
On 03/23/2017 03:46 AM, Yuyang Du wrote:
This number facilitates user space tool to easily know what we have.
Signed-off-by: Yuyang Du <[email protected]>
---
drivers/usb/usbip/vhci_sysfs.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c
index b96e5b1..af75ffb 100644
--- a/drivers/usb/usbip/vhci_sysfs.c
+++ b/drivers/usb/usbip/vhci_sysfs.c
@@ -146,6 +146,16 @@ static ssize_t nports_show(struct device *dev, struct
device_attribute *attr,
}
static DEVICE_ATTR_RO(nports);
+static ssize_t ncontrollers_show(struct device *dev, struct device_attribute
*attr,
+ char *out)
+{
+ char *s = out;
+
+ out += sprintf(out, "%d\n", vhci_num_controllers);
+ return out - s;
+}
+static DEVICE_ATTR_RO(ncontrollers);
+
Why you need a special RO attribute for this? Can't just cannot check
content of directory using for example scandir() to learn what we have?
Best regards,
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html