From: Viresh Kumar Date: Mon, 28 Dec 2015 06:29:00 +0000 (+0530) Subject: greybus: interface: Receive serial-number on hotplug event X-Git-Tag: Ubuntu-4.10.0-19.21~2488^2~378^2~21^2~890 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=57c6bcc635626e24fff3546bb072b4ba4163872b;p=mirror_ubuntu-artful-kernel.git greybus: interface: Receive serial-number on hotplug event Two exactly same modules can be uniquely identified using module's serial-number. This patch updates the interface hotplug event to also receive the serial-number of the module. Signed-off-by: Viresh Kumar Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/Documentation/sysfs-bus-greybus b/drivers/staging/greybus/Documentation/sysfs-bus-greybus index 2cd17c706940..0d16d7649a5a 100644 --- a/drivers/staging/greybus/Documentation/sysfs-bus-greybus +++ b/drivers/staging/greybus/Documentation/sysfs-bus-greybus @@ -37,6 +37,14 @@ Contact: Greg Kroah-Hartman Description: The ID of a Greybus interface. +What: /sys/bus/greybus/device/N-I/serial_number +Date: October 2015 +KernelVersion: 4.XX +Contact: Greg Kroah-Hartman +Description: + Serial Number of the Greybus interface, represented by a 64 bit + hexadecimal number. + What: /sys/bus/greybus/device/N-I/product_id Date: October 2015 KernelVersion: 4.XX diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus1/1-2/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus1/1-2/serial_number new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus1/1-4/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus1/1-4/serial_number new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/drivers/staging/greybus/Documentation/sysfs/greybus2/2-3/serial_number b/drivers/staging/greybus/Documentation/sysfs/greybus2/2-3/serial_number new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 773e1ab789c0..f66f4d784f27 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -757,6 +757,7 @@ struct gb_svc_intf_hotplug_request { __le32 ddbl1_prod_id; __le32 ara_vend_id; __le32 ara_prod_id; + __le64 serial_number; } data; } __packed; /* hotplug response has no payload */ diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index c4b9e1486828..69eb7886ceae 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -27,6 +27,7 @@ gb_interface_attr(vendor_id, "0x%08x"); gb_interface_attr(product_id, "0x%08x"); gb_interface_attr(vendor_string, "%s"); gb_interface_attr(product_string, "%s"); +gb_interface_attr(serial_number, "0x%016llx"); static struct attribute *interface_attrs[] = { &dev_attr_ddbl1_manufacturer_id.attr, @@ -36,6 +37,7 @@ static struct attribute *interface_attrs[] = { &dev_attr_product_id.attr, &dev_attr_vendor_string.attr, &dev_attr_product_string.attr, + &dev_attr_serial_number.attr, NULL, }; ATTRIBUTE_GROUPS(interface); diff --git a/drivers/staging/greybus/interface.h b/drivers/staging/greybus/interface.h index d192b74ab5e1..a1a1f9f5c2cb 100644 --- a/drivers/staging/greybus/interface.h +++ b/drivers/staging/greybus/interface.h @@ -30,6 +30,7 @@ struct gb_interface { u32 ddbl1_product_id; u32 vendor_id; u32 product_id; + u64 serial_number; struct gb_host_device *hd; diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 417869942d11..fe7bd2850d5d 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -429,6 +429,7 @@ static void gb_svc_process_intf_hotplug(struct gb_operation *operation) intf->ddbl1_product_id = le32_to_cpu(request->data.ddbl1_prod_id); intf->vendor_id = le32_to_cpu(request->data.ara_vend_id); intf->product_id = le32_to_cpu(request->data.ara_prod_id); + intf->serial_number = le64_to_cpu(request->data.serial_number); ret = gb_svc_read_and_clear_module_boot_status(intf); if (ret) {