aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/ether.c
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2008-06-19 21:19:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:10 -0400
commit15b2d2b529d11449910ac86f6093124bce8f6103 (patch)
treef8c153f86a19354e789c16af277dff2b68779f94 /drivers/usb/gadget/ether.c
parent7bb5ea54be47584869b9a748696e06788c55e28f (diff)
usb gadget: RNDIS cleanups
Some cleanup to the RNDIS code: - Minor bugfix: rndis_unit() is supposed to put the link into the RNDIS_UNINITIALIZED state, which does not mean "unused". There's a separate method to stop using the link. (Bug doesn't affect anything right now because of how the code is used.) - Reduce coupling between RNDIS code and its user(s), in preparation for updates in that code: * Decouple RNDIS_RESPONSE_AVAILABLE notifications from net_device by passing just a void* handle. (Also, remove the unused return value of the notification callback.) * When it needs a copy of net_device stats, just ask for it - Remove unused/untested code backing various never-used OIDs: * RNDIS_PM, RNDIS_WAKEUP ... "should" get implemented, but the relevant docs were unclear, ambguous, and incomplete. Someone with access to the Hidden Gospels (maybe in the EU?) might be able to figure out what this should do. * RNDIS_OPTIONAL_STATS ... as the name suggests, optional. Never implemented in part because not all the semantics were clear. * OID_GEN_RNDIS_CONFIG_PARAMETER, which has been #if 0 forever. - A few small whitespace fixes Plus switch the VERBOSE symbol over to the newer VERBOSE_DEBUG style. There should be no functional changes because of this patch; it's a net source code shrink (because of the dead/unused code removal) and a small object code shrink (a couple hundred bytes on ARMv5). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/ether.c')
-rw-r--r--drivers/usb/gadget/ether.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index d3891b2fc36e..dee1f081165d 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1106,6 +1106,8 @@ static void eth_reset_config (struct eth_dev *dev)
1106 1106
1107 netif_stop_queue (dev->net); 1107 netif_stop_queue (dev->net);
1108 netif_carrier_off (dev->net); 1108 netif_carrier_off (dev->net);
1109
1110 /* RNDIS enters RNDIS_UNINITIALIZED state */
1109 rndis_uninit(dev->rndis_config); 1111 rndis_uninit(dev->rndis_config);
1110 1112
1111 /* disable endpoints, forcing (synchronous) completion of 1113 /* disable endpoints, forcing (synchronous) completion of
@@ -1604,8 +1606,6 @@ eth_disconnect (struct usb_gadget *gadget)
1604 eth_reset_config (dev); 1606 eth_reset_config (dev);
1605 spin_unlock_irqrestore (&dev->lock, flags); 1607 spin_unlock_irqrestore (&dev->lock, flags);
1606 1608
1607 /* FIXME RNDIS should enter RNDIS_UNINITIALIZED */
1608
1609 /* next we may get setup() calls to enumerate new connections; 1609 /* next we may get setup() calls to enumerate new connections;
1610 * or an unbind() during shutdown (including removing module). 1610 * or an unbind() during shutdown (including removing module).
1611 */ 1611 */
@@ -2067,23 +2067,23 @@ rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *req)
2067 eth_req_free(ep, req); 2067 eth_req_free(ep, req);
2068} 2068}
2069 2069
2070static int rndis_control_ack (struct net_device *net) 2070static void rndis_resp_avail(void *_dev)
2071{ 2071{
2072 struct eth_dev *dev = netdev_priv(net); 2072 struct eth_dev *dev = _dev;
2073 int length; 2073 int length;
2074 struct usb_request *resp = dev->stat_req; 2074 struct usb_request *resp = dev->stat_req;
2075 2075
2076 /* in case RNDIS calls this after disconnect */ 2076 /* in case RNDIS calls this after disconnect */
2077 if (!dev->status) { 2077 if (!dev->status) {
2078 DEBUG (dev, "status ENODEV\n"); 2078 DEBUG (dev, "status ENODEV\n");
2079 return -ENODEV; 2079 return;
2080 } 2080 }
2081 2081
2082 /* in case queue length > 1 */ 2082 /* in case queue length > 1 */
2083 if (resp->context) { 2083 if (resp->context) {
2084 resp = eth_req_alloc (dev->status_ep, 8, GFP_ATOMIC); 2084 resp = eth_req_alloc (dev->status_ep, 8, GFP_ATOMIC);
2085 if (!resp) 2085 if (!resp)
2086 return -ENOMEM; 2086 return;
2087 } 2087 }
2088 2088
2089 /* Send RNDIS RESPONSE_AVAILABLE notification; 2089 /* Send RNDIS RESPONSE_AVAILABLE notification;
@@ -2101,13 +2101,11 @@ static int rndis_control_ack (struct net_device *net)
2101 resp->status = 0; 2101 resp->status = 0;
2102 rndis_control_ack_complete (dev->status_ep, resp); 2102 rndis_control_ack_complete (dev->status_ep, resp);
2103 } 2103 }
2104
2105 return 0;
2106} 2104}
2107 2105
2108#else 2106#else
2109 2107
2110#define rndis_control_ack NULL 2108#define rndis_resp_avail NULL
2111 2109
2112#endif /* RNDIS */ 2110#endif /* RNDIS */
2113 2111
@@ -2566,18 +2564,18 @@ autoconf_fail:
2566 2564
2567 /* FIXME RNDIS vendor id == "vendor NIC code" == ? */ 2565 /* FIXME RNDIS vendor id == "vendor NIC code" == ? */
2568 2566
2569 dev->rndis_config = rndis_register (rndis_control_ack); 2567 status = rndis_register(rndis_resp_avail, dev);
2570 if (dev->rndis_config < 0) { 2568 if (status < 0) {
2571fail0: 2569fail0:
2572 unregister_netdev (dev->net); 2570 unregister_netdev (dev->net);
2573 status = -ENODEV;
2574 goto fail; 2571 goto fail;
2575 } 2572 }
2573 dev->rndis_config = status;
2576 2574
2577 /* these set up a lot of the OIDs that RNDIS needs */ 2575 /* these set up a lot of the OIDs that RNDIS needs */
2578 rndis_set_host_mac (dev->rndis_config, dev->host_mac); 2576 rndis_set_host_mac (dev->rndis_config, dev->host_mac);
2579 if (rndis_set_param_dev (dev->rndis_config, dev->net, 2577 if (rndis_set_param_dev (dev->rndis_config, dev->net,
2580 &dev->stats, &dev->cdc_filter)) 2578 &dev->cdc_filter))
2581 goto fail0; 2579 goto fail0;
2582 if (rndis_set_param_vendor(dev->rndis_config, vendorID, 2580 if (rndis_set_param_vendor(dev->rndis_config, vendorID,
2583 manufacturer)) 2581 manufacturer))