aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/f_ncm.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2013-05-23 03:22:08 -0400
committerFelipe Balbi <balbi@ti.com>2013-06-10 10:13:22 -0400
commitdd67a17f2b8866d165699e4581ae8847ef8c0fe6 (patch)
treea940c914c86e72fe17cbea41cd64adfa2a8cfe41 /drivers/usb/gadget/f_ncm.c
parent9575bcf9c0c98350c61964214c0c029dfed0c32e (diff)
usb: gadget: f_ncm: remove compatibility layer
There are no old function interface users left, so the old interface can be removed. 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.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c
index 722ca1b0dda0..d8069de4f9d8 100644
--- a/drivers/usb/gadget/f_ncm.c
+++ b/drivers/usb/gadget/f_ncm.c
@@ -1160,8 +1160,6 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
1160 struct f_ncm *ncm = func_to_ncm(f); 1160 struct f_ncm *ncm = func_to_ncm(f);
1161 int status; 1161 int status;
1162 struct usb_ep *ep; 1162 struct usb_ep *ep;
1163
1164#ifndef USB_FNCM_INCLUDED
1165 struct f_ncm_opts *ncm_opts; 1163 struct f_ncm_opts *ncm_opts;
1166 1164
1167 if (!can_support_ecm(cdev->gadget)) 1165 if (!can_support_ecm(cdev->gadget))
@@ -1182,7 +1180,6 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
1182 return status; 1180 return status;
1183 ncm_opts->bound = true; 1181 ncm_opts->bound = true;
1184 } 1182 }
1185#endif
1186 if (ncm_string_defs[0].id == 0) { 1183 if (ncm_string_defs[0].id == 0) {
1187 status = usb_string_ids_tab(c->cdev, ncm_string_defs); 1184 status = usb_string_ids_tab(c->cdev, ncm_string_defs);
1188 if (status < 0) 1185 if (status < 0)
@@ -1297,80 +1294,6 @@ fail:
1297 return status; 1294 return status;
1298} 1295}
1299 1296
1300#ifdef USB_FNCM_INCLUDED
1301
1302static void
1303ncm_old_unbind(struct usb_configuration *c, struct usb_function *f)
1304{
1305 struct f_ncm *ncm = func_to_ncm(f);
1306
1307 DBG(c->cdev, "ncm unbind\n");
1308
1309 ncm_string_defs[0].id = 0;
1310 usb_free_all_descriptors(f);
1311
1312 kfree(ncm->notify_req->buf);
1313 usb_ep_free_request(ncm->notify, ncm->notify_req);
1314
1315 kfree(ncm);
1316}
1317
1318/**
1319 * ncm_bind_config - add CDC Network link to a configuration
1320 * @c: the configuration to support the network link
1321 * @ethaddr: a buffer in which the ethernet address of the host side
1322 * side of the link was recorded
1323 * Context: single threaded during gadget setup
1324 *
1325 * Returns zero on success, else negative errno.
1326 *
1327 * Caller must have called @gether_setup(). Caller is also responsible
1328 * for calling @gether_cleanup() before module unload.
1329 */
1330int __init ncm_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN],
1331 struct eth_dev *dev)
1332{
1333 struct f_ncm *ncm;
1334 int status;
1335
1336 if (!can_support_ecm(c->cdev->gadget) || !ethaddr)
1337 return -EINVAL;
1338
1339 /* allocate and initialize one new instance */
1340 ncm = kzalloc(sizeof *ncm, GFP_KERNEL);
1341 if (!ncm)
1342 return -ENOMEM;
1343
1344 /* export host's Ethernet address in CDC format */
1345 snprintf(ncm->ethaddr, sizeof ncm->ethaddr, "%pm", ethaddr);
1346 ncm_string_defs[STRING_MAC_IDX].s = ncm->ethaddr;
1347
1348 spin_lock_init(&ncm->lock);
1349 ncm_reset_values(ncm);
1350 ncm->port.ioport = dev;
1351 ncm->port.is_fixed = true;
1352
1353 ncm->port.func.name = "cdc_network";
1354 ncm->port.func.strings = ncm_strings;
1355 /* descriptors are per-instance copies */
1356 ncm->port.func.bind = ncm_bind;
1357 ncm->port.func.unbind = ncm_old_unbind;
1358 ncm->port.func.set_alt = ncm_set_alt;
1359 ncm->port.func.get_alt = ncm_get_alt;
1360 ncm->port.func.setup = ncm_setup;
1361 ncm->port.func.disable = ncm_disable;
1362
1363 ncm->port.wrap = ncm_wrap_ntb;
1364 ncm->port.unwrap = ncm_unwrap_ntb;
1365
1366 status = usb_add_function(c, &ncm->port.func);
1367 if (status)
1368 kfree(ncm);
1369 return status;
1370}
1371
1372#else
1373
1374static void ncm_free_inst(struct usb_function_instance *f) 1297static void ncm_free_inst(struct usb_function_instance *f)
1375{ 1298{
1376 struct f_ncm_opts *opts; 1299 struct f_ncm_opts *opts;
@@ -1466,6 +1389,3 @@ struct usb_function *ncm_alloc(struct usb_function_instance *fi)
1466DECLARE_USB_FUNCTION_INIT(ncm, ncm_alloc_inst, ncm_alloc); 1389DECLARE_USB_FUNCTION_INIT(ncm, ncm_alloc_inst, ncm_alloc);
1467MODULE_LICENSE("GPL"); 1390MODULE_LICENSE("GPL");
1468MODULE_AUTHOR("Yauheni Kaliuta"); 1391MODULE_AUTHOR("Yauheni Kaliuta");
1469
1470#endif
1471