usb: composite: Check only first string in cdev for assigning IDs
Function drivers call usb_gstrings_attach() to reserve strings IDs
for its strings. This function already checks if strings are
present to avoid exceeding the 255 max limit of strings IDs.
Currently driver checks for all the strings of a function to find
if they are present in cdev. Simplify this to check only for the
first string as it is unlikely for a function to change its strings
dynamically which are typically static. This also helps to deal with
ECM function which uses 2nd string ID for host mac_address that
can change. Even if same host mac address is used with ECM across
composition switches, usb_gstrings_attach still fails to find the
string in cdev as string addresses are compared instead of strcmp
and mac_address string address changes across composition switch.
Other way to fix this could be to reuse host MAC address during
composition switch for ECM and use strcmp for checking strings.
Not doing this as strcmp is heavy operation and doing this for all
the strings would be overkill given that functions' strings don't
change.
Change-Id: Id73158217285fbbd8edab1994ccbdbe4b95f1758
Signed-off-by:
Manu Gautam <mgautam@codeaurora.org>
Loading
Please register or sign in to comment