diff options
Diffstat (limited to 'drivers/staging/greybus')
-rw-r--r-- | drivers/staging/greybus/Documentation/sysfs-bus-greybus | 8 | ||||
-rw-r--r-- | drivers/staging/greybus/svc.c | 29 |
2 files changed, 37 insertions, 0 deletions
diff --git a/drivers/staging/greybus/Documentation/sysfs-bus-greybus b/drivers/staging/greybus/Documentation/sysfs-bus-greybus index 9ce36ddfb4da..1550b7f8d776 100644 --- a/drivers/staging/greybus/Documentation/sysfs-bus-greybus +++ b/drivers/staging/greybus/Documentation/sysfs-bus-greybus @@ -142,6 +142,14 @@ Description: defined by the Endo layout scheme, documented in the ARA Module Developer Kit. +What: /sys/bus/greybus/device/N-svc/intf_eject +Date: October 2015 +KernelVersion: 4.XX +Contact: Greg Kroah-Hartman <greg@kroah.com> +Description: + Write the number of the interface that you wish to + forcibly eject from the system. + What: /sys/bus/greybus/device/N-svc/unique_id Date: October 2015 KernelVersion: 4.XX diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index ef10b67c7bf5..be62d308d1c9 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -40,9 +40,38 @@ static ssize_t ap_intf_id_show(struct device *dev, } static DEVICE_ATTR_RO(ap_intf_id); + +// FIXME +// This is a hack, we need to do this "right" and clean the interface up +// properly, not just forcibly yank the thing out of the system and hope for the +// best. But for now, people want their modules to come out without having to +// throw the thing to the ground or get out a screwdriver. +static ssize_t intf_eject_store(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t len) +{ + struct gb_svc *svc = to_gb_svc(dev); + unsigned short intf_id; + int ret; + + ret = kstrtou16(buf, 10, &intf_id); + if (ret < 0) + return ret; + + dev_warn(dev, "Forcibly trying to eject interface %d\n", intf_id); + + ret = gb_svc_intf_eject(svc, intf_id); + if (ret < 0) + return ret; + + return len; +} +static DEVICE_ATTR_WO(intf_eject); + static struct attribute *svc_attrs[] = { &dev_attr_endo_id.attr, &dev_attr_ap_intf_id.attr, + &dev_attr_intf_eject.attr, NULL, }; ATTRIBUTE_GROUPS(svc); |