diff options
author | Seung-Woo Kim <sw0312.kim@samsung.com> | 2018-04-09 15:57:15 +0900 |
---|---|---|
committer | Jaehoon Chung <jh80.chung@samsung.com> | 2019-01-29 11:25:36 +0900 |
commit | 6ff6a27ed4e41ef1f258cc2c2f632fa378b19de2 (patch) | |
tree | 013d7dfbb0a2084d9166c0a016ffdaa5919df503 /drivers | |
parent | 83f2e2a985ed10785f90cc60ef2f8f0c599e7ffb (diff) | |
download | linux-artik7-6ff6a27ed4e41ef1f258cc2c2f632fa378b19de2.tar.gz linux-artik7-6ff6a27ed4e41ef1f258cc2c2f632fa378b19de2.tar.bz2 linux-artik7-6ff6a27ed4e41ef1f258cc2c2f632fa378b19de2.zip |
usb: gadget: slp: fix to use serial-number if arm64 has no dmi serial
The arm64 artik710 board has no dmi serial. Fix to use serial-number
of devicetree which is attached from artik u-boot.
If there is the devicetree node, it is found from sysfs path,
/sys/firmware/devicetree/base/serial-number.
Change-Id: I78263c2fee2c15ce11cc3d72e1588eb941042e99
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/legacy/slp.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/usb/gadget/legacy/slp.c b/drivers/usb/gadget/legacy/slp.c index 1eeca11682ee..19a639bf7a23 100644 --- a/drivers/usb/gadget/legacy/slp.c +++ b/drivers/usb/gadget/legacy/slp.c @@ -1201,15 +1201,27 @@ static int slp_multi_bind(struct usb_composite_dev *cdev) strncpy(product_string, "TIZEN", sizeof(product_string) - 1); serial = dmi_get_system_info(DMI_PRODUCT_SERIAL); - if (serial) + if (serial) { snprintf(serial_string, 18, "%s", serial); - else + } else { #ifdef CONFIG_ARM snprintf(serial_string, 18, "%s", system_serial); #else - snprintf(serial_string, 18, "%s", "01234TEST"); + struct device_node *root; + const char *serial_number = NULL; + + root = of_find_node_by_path("/"); + if (root) + of_property_read_string(root, "serial-number", + &serial_number); + + if (serial_number) + snprintf(serial_string, 18, "%s", serial_number); + else + snprintf(serial_string, 18, "%s", "01234TEST"); #endif + } id = usb_string_id(cdev); if (id < 0) |