USB: android-gadget: Allow diag to update pid and serial no
PID and serial numbers need to be updated by DIAG in order
to support QPST s/w download functionality.
Since, different targets have different mechanism to
update pid and serial number, hence register android
composite device as a platform_device.
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c
index 8d362c9..8146af7 100644
--- a/drivers/usb/gadget/android.c
+++ b/drivers/usb/gadget/android.c
@@ -220,15 +220,22 @@
{
char *name;
char buf[32], *b;
- int err = -1;
+ int once = 0, err = -1;
+ int (*notify)(uint32_t, const char *);
strncpy(buf, diag_clients, sizeof(buf));
b = strim(buf);
while (b) {
name = strsep(&b, ",");
+ /* Allow only first diag channel to update pid and serial no */
+ if (!once++)
+ notify = _android_dev->pdata->update_pid_and_serial_num;
+ else
+ notify = NULL;
+
if (name) {
- err = diag_function_add(c, name);
+ err = diag_function_add(c, name, notify);
if (err)
pr_err("diag: Cannot open channel '%s'", name);
}