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 <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Viresh Kumar 2015-12-28 11:59:00 +05:30 committed by Greg Kroah-Hartman
parent 63d742b68a
commit 57c6bcc635
8 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,14 @@ Contact: Greg Kroah-Hartman <greg@kroah.com>
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 <greg@kroah.com>
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

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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) {