diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2012-05-10 04:08:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-10 15:22:43 -0400 |
commit | cad4cd8fbde6b2f45b51711260343b3195615c79 (patch) | |
tree | abe2c3a65dd1843f2c7c4e7d6ccaf9333c26be4b /drivers/usb/gadget | |
parent | 4fffd6e5a24c4df3341d404446e3672bef8cffb7 (diff) |
usb: gadget: composite: add iSerialNumber to usb_composite_driver
Add iSerialNumber to usb_composite_driver to allow setting a default value.
This is useful when the module is compiled-in. Then the composite_bind
is executed at kernel boot and string id for iSerialNumber can be overridden
even if there is no iSerialNumber kernel commandline parameter.
If the string id is not overridden, then get_string will never attempt to
look for the alternative string contents using cdev->serial_override.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/composite.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index df2749052e2c..390749bbb0c3 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -938,7 +938,7 @@ static int get_string(struct usb_composite_dev *cdev, | |||
938 | else if (cdev->product_override == id) | 938 | else if (cdev->product_override == id) |
939 | str = iProduct ?: composite->iProduct; | 939 | str = iProduct ?: composite->iProduct; |
940 | else if (cdev->serial_override == id) | 940 | else if (cdev->serial_override == id) |
941 | str = iSerialNumber; | 941 | str = iSerialNumber ?: composite->iSerialNumber; |
942 | else | 942 | else |
943 | str = NULL; | 943 | str = NULL; |
944 | if (str) { | 944 | if (str) { |
@@ -1503,7 +1503,8 @@ static int composite_bind(struct usb_gadget *gadget) | |||
1503 | cdev->product_override = | 1503 | cdev->product_override = |
1504 | override_id(cdev, &cdev->desc.iProduct); | 1504 | override_id(cdev, &cdev->desc.iProduct); |
1505 | 1505 | ||
1506 | if (iSerialNumber) | 1506 | if (iSerialNumber || |
1507 | (!cdev->desc.iSerialNumber && composite->iSerialNumber)) | ||
1507 | cdev->serial_override = | 1508 | cdev->serial_override = |
1508 | override_id(cdev, &cdev->desc.iSerialNumber); | 1509 | override_id(cdev, &cdev->desc.iSerialNumber); |
1509 | 1510 | ||