diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2013-05-23 03:22:09 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-06-10 10:13:57 -0400 |
commit | 8feffd0030fef652224439ac6facbfbf6ba85139 (patch) | |
tree | 6d2859a476c099faadba30b6743e1a746af207e5 /drivers/usb/gadget/f_ncm.c | |
parent | dd67a17f2b8866d165699e4581ae8847ef8c0fe6 (diff) |
usb: gadget: f_ncm: use usb_gstrings_attach
Trivial patch making use of the new usb_gstrings_attach
interface.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_ncm.c')
-rw-r--r-- | drivers/usb/gadget/f_ncm.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c index d8069de4f9d8..effd2fada925 100644 --- a/drivers/usb/gadget/f_ncm.c +++ b/drivers/usb/gadget/f_ncm.c | |||
@@ -1158,6 +1158,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1158 | { | 1158 | { |
1159 | struct usb_composite_dev *cdev = c->cdev; | 1159 | struct usb_composite_dev *cdev = c->cdev; |
1160 | struct f_ncm *ncm = func_to_ncm(f); | 1160 | struct f_ncm *ncm = func_to_ncm(f); |
1161 | struct usb_string *us; | ||
1161 | int status; | 1162 | int status; |
1162 | struct usb_ep *ep; | 1163 | struct usb_ep *ep; |
1163 | struct f_ncm_opts *ncm_opts; | 1164 | struct f_ncm_opts *ncm_opts; |
@@ -1180,20 +1181,15 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1180 | return status; | 1181 | return status; |
1181 | ncm_opts->bound = true; | 1182 | ncm_opts->bound = true; |
1182 | } | 1183 | } |
1183 | if (ncm_string_defs[0].id == 0) { | 1184 | us = usb_gstrings_attach(cdev, ncm_strings, |
1184 | status = usb_string_ids_tab(c->cdev, ncm_string_defs); | 1185 | ARRAY_SIZE(ncm_string_defs)); |
1185 | if (status < 0) | 1186 | if (IS_ERR(us)) |
1186 | return status; | 1187 | return PTR_ERR(us); |
1187 | ncm_control_intf.iInterface = | 1188 | ncm_control_intf.iInterface = us[STRING_CTRL_IDX].id; |
1188 | ncm_string_defs[STRING_CTRL_IDX].id; | 1189 | ncm_data_nop_intf.iInterface = us[STRING_DATA_IDX].id; |
1189 | 1190 | ncm_data_intf.iInterface = us[STRING_DATA_IDX].id; | |
1190 | status = ncm_string_defs[STRING_DATA_IDX].id; | 1191 | ecm_desc.iMACAddress = us[STRING_MAC_IDX].id; |
1191 | ncm_data_nop_intf.iInterface = status; | 1192 | ncm_iad_desc.iFunction = us[STRING_IAD_IDX].id; |
1192 | ncm_data_intf.iInterface = status; | ||
1193 | |||
1194 | ecm_desc.iMACAddress = ncm_string_defs[STRING_MAC_IDX].id; | ||
1195 | ncm_iad_desc.iFunction = ncm_string_defs[STRING_IAD_IDX].id; | ||
1196 | } | ||
1197 | 1193 | ||
1198 | /* allocate instance-specific interface IDs */ | 1194 | /* allocate instance-specific interface IDs */ |
1199 | status = usb_interface_id(c, f); | 1195 | status = usb_interface_id(c, f); |
@@ -1335,7 +1331,6 @@ static void ncm_unbind(struct usb_configuration *c, struct usb_function *f) | |||
1335 | 1331 | ||
1336 | DBG(c->cdev, "ncm unbind\n"); | 1332 | DBG(c->cdev, "ncm unbind\n"); |
1337 | 1333 | ||
1338 | ncm_string_defs[0].id = 0; | ||
1339 | usb_free_all_descriptors(f); | 1334 | usb_free_all_descriptors(f); |
1340 | 1335 | ||
1341 | kfree(ncm->notify_req->buf); | 1336 | kfree(ncm->notify_req->buf); |
@@ -1370,7 +1365,6 @@ struct usb_function *ncm_alloc(struct usb_function_instance *fi) | |||
1370 | ncm->port.is_fixed = true; | 1365 | ncm->port.is_fixed = true; |
1371 | 1366 | ||
1372 | ncm->port.func.name = "cdc_network"; | 1367 | ncm->port.func.name = "cdc_network"; |
1373 | ncm->port.func.strings = ncm_strings; | ||
1374 | /* descriptors are per-instance copies */ | 1368 | /* descriptors are per-instance copies */ |
1375 | ncm->port.func.bind = ncm_bind; | 1369 | ncm->port.func.bind = ncm_bind; |
1376 | ncm->port.func.unbind = ncm_unbind; | 1370 | ncm->port.func.unbind = ncm_unbind; |