mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 01:36:52 +09:00
greybus: gpbridge: Expose protocol_id in sysfs
Right now, userspace doesn't have any way to find what protocol does a gpbridge device implement. And this is essential for the scripts to know, to expect what kind of device will be present inside the gpbN directory. Expose 'protocol_id' in sysfs to fix that. Tested by checking that the field appears with GP module on EVT 1.5. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
792db396d3
commit
6f8a028fd1
@@ -26,6 +26,22 @@ struct gpbridge_host {
|
||||
|
||||
static DEFINE_IDA(gpbridge_id);
|
||||
|
||||
static ssize_t protocol_id_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev);
|
||||
|
||||
return sprintf(buf, "0x%02x\n", gpbdev->cport_desc->protocol_id);
|
||||
}
|
||||
static DEVICE_ATTR_RO(protocol_id);
|
||||
|
||||
static struct attribute *gpbdev_attrs[] = {
|
||||
&dev_attr_protocol_id.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
ATTRIBUTE_GROUPS(gpbdev);
|
||||
|
||||
static void gpbdev_release(struct device *dev)
|
||||
{
|
||||
struct gpbridge_device *gpbdev = to_gpbridge_dev(dev);
|
||||
@@ -190,7 +206,7 @@ static struct gpbridge_device *gb_gpbridge_create_dev(struct gb_bundle *bundle,
|
||||
gpbdev->dev.parent = &bundle->dev;
|
||||
gpbdev->dev.bus = &gpbridge_bus_type;
|
||||
gpbdev->dev.release = gpbdev_release;
|
||||
gpbdev->dev.groups = NULL;
|
||||
gpbdev->dev.groups = gpbdev_groups;
|
||||
gpbdev->dev.dma_mask = bundle->dev.dma_mask;
|
||||
dev_set_name(&gpbdev->dev, "gpb%d", id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user