diff options
Diffstat (limited to 'drivers/usb/gadget/net2272.c')
-rw-r--r-- | drivers/usb/gadget/net2272.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c index 32524b631959..f1e50a3e322d 100644 --- a/drivers/usb/gadget/net2272.c +++ b/drivers/usb/gadget/net2272.c | |||
@@ -58,7 +58,6 @@ static const char * const ep_name[] = { | |||
58 | "ep-a", "ep-b", "ep-c", | 58 | "ep-a", "ep-b", "ep-c", |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #define DMA_ADDR_INVALID (~(dma_addr_t)0) | ||
62 | #ifdef CONFIG_USB_NET2272_DMA | 61 | #ifdef CONFIG_USB_NET2272_DMA |
63 | /* | 62 | /* |
64 | * use_dma: the NET2272 can use an external DMA controller. | 63 | * use_dma: the NET2272 can use an external DMA controller. |
@@ -341,7 +340,6 @@ net2272_alloc_request(struct usb_ep *_ep, gfp_t gfp_flags) | |||
341 | if (!req) | 340 | if (!req) |
342 | return NULL; | 341 | return NULL; |
343 | 342 | ||
344 | req->req.dma = DMA_ADDR_INVALID; | ||
345 | INIT_LIST_HEAD(&req->queue); | 343 | INIT_LIST_HEAD(&req->queue); |
346 | 344 | ||
347 | return &req->req; | 345 | return &req->req; |
@@ -913,7 +911,7 @@ net2272_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
913 | } | 911 | } |
914 | } | 912 | } |
915 | } | 913 | } |
916 | if (likely(req != 0)) | 914 | if (likely(req)) |
917 | list_add_tail(&req->queue, &ep->queue); | 915 | list_add_tail(&req->queue, &ep->queue); |
918 | 916 | ||
919 | if (likely(!list_empty(&ep->queue))) | 917 | if (likely(!list_empty(&ep->queue))) |
@@ -1467,7 +1465,6 @@ static int net2272_start(struct usb_gadget *_gadget, | |||
1467 | dev->softconnect = 1; | 1465 | dev->softconnect = 1; |
1468 | driver->driver.bus = NULL; | 1466 | driver->driver.bus = NULL; |
1469 | dev->driver = driver; | 1467 | dev->driver = driver; |
1470 | dev->gadget.dev.driver = &driver->driver; | ||
1471 | 1468 | ||
1472 | /* ... then enable host detection and ep0; and we're ready | 1469 | /* ... then enable host detection and ep0; and we're ready |
1473 | * for set_configuration as well as eventual disconnect. | 1470 | * for set_configuration as well as eventual disconnect. |
@@ -1517,7 +1514,6 @@ static int net2272_stop(struct usb_gadget *_gadget, | |||
1517 | stop_activity(dev, driver); | 1514 | stop_activity(dev, driver); |
1518 | spin_unlock_irqrestore(&dev->lock, flags); | 1515 | spin_unlock_irqrestore(&dev->lock, flags); |
1519 | 1516 | ||
1520 | dev->gadget.dev.driver = NULL; | ||
1521 | dev->driver = NULL; | 1517 | dev->driver = NULL; |
1522 | 1518 | ||
1523 | dev_dbg(dev->dev, "unregistered driver '%s'\n", driver->driver.name); | 1519 | dev_dbg(dev->dev, "unregistered driver '%s'\n", driver->driver.name); |
@@ -1549,7 +1545,7 @@ net2272_handle_dma(struct net2272_ep *ep) | |||
1549 | | (ep->dev->dma_eot_polarity << EOT_POLARITY) | 1545 | | (ep->dev->dma_eot_polarity << EOT_POLARITY) |
1550 | | (ep->dev->dma_dack_polarity << DACK_POLARITY) | 1546 | | (ep->dev->dma_dack_polarity << DACK_POLARITY) |
1551 | | (ep->dev->dma_dreq_polarity << DREQ_POLARITY) | 1547 | | (ep->dev->dma_dreq_polarity << DREQ_POLARITY) |
1552 | | ((ep->dma >> 1) << DMA_ENDPOINT_SELECT)); | 1548 | | (ep->dma << DMA_ENDPOINT_SELECT)); |
1553 | 1549 | ||
1554 | ep->dev->dma_busy = 0; | 1550 | ep->dev->dma_busy = 0; |
1555 | 1551 | ||
@@ -1622,7 +1618,7 @@ net2272_handle_ep(struct net2272_ep *ep) | |||
1622 | ep->irqs++; | 1618 | ep->irqs++; |
1623 | 1619 | ||
1624 | dev_vdbg(ep->dev->dev, "%s ack ep_stat0 %02x, ep_stat1 %02x, req %p\n", | 1620 | dev_vdbg(ep->dev->dev, "%s ack ep_stat0 %02x, ep_stat1 %02x, req %p\n", |
1625 | ep->ep.name, stat0, stat1, req ? &req->req : 0); | 1621 | ep->ep.name, stat0, stat1, req ? &req->req : NULL); |
1626 | 1622 | ||
1627 | net2272_ep_write(ep, EP_STAT0, stat0 & | 1623 | net2272_ep_write(ep, EP_STAT0, stat0 & |
1628 | ~((1 << NAK_OUT_PACKETS) | 1624 | ~((1 << NAK_OUT_PACKETS) |
@@ -2216,7 +2212,6 @@ net2272_remove(struct net2272 *dev) | |||
2216 | free_irq(dev->irq, dev); | 2212 | free_irq(dev->irq, dev); |
2217 | iounmap(dev->base_addr); | 2213 | iounmap(dev->base_addr); |
2218 | 2214 | ||
2219 | device_unregister(&dev->gadget.dev); | ||
2220 | device_remove_file(dev->dev, &dev_attr_registers); | 2215 | device_remove_file(dev->dev, &dev_attr_registers); |
2221 | 2216 | ||
2222 | dev_info(dev->dev, "unbind\n"); | 2217 | dev_info(dev->dev, "unbind\n"); |
@@ -2243,10 +2238,6 @@ static struct net2272 *net2272_probe_init(struct device *dev, unsigned int irq) | |||
2243 | ret->gadget.max_speed = USB_SPEED_HIGH; | 2238 | ret->gadget.max_speed = USB_SPEED_HIGH; |
2244 | 2239 | ||
2245 | /* the "gadget" abstracts/virtualizes the controller */ | 2240 | /* the "gadget" abstracts/virtualizes the controller */ |
2246 | dev_set_name(&ret->gadget.dev, "gadget"); | ||
2247 | ret->gadget.dev.parent = dev; | ||
2248 | ret->gadget.dev.dma_mask = dev->dma_mask; | ||
2249 | ret->gadget.dev.release = net2272_gadget_release; | ||
2250 | ret->gadget.name = driver_name; | 2241 | ret->gadget.name = driver_name; |
2251 | 2242 | ||
2252 | return ret; | 2243 | return ret; |
@@ -2282,14 +2273,12 @@ net2272_probe_fin(struct net2272 *dev, unsigned int irqflags) | |||
2282 | dma_mode_string()); | 2273 | dma_mode_string()); |
2283 | dev_info(dev->dev, "version: %s\n", driver_vers); | 2274 | dev_info(dev->dev, "version: %s\n", driver_vers); |
2284 | 2275 | ||
2285 | ret = device_register(&dev->gadget.dev); | ||
2286 | if (ret) | ||
2287 | goto err_irq; | ||
2288 | ret = device_create_file(dev->dev, &dev_attr_registers); | 2276 | ret = device_create_file(dev->dev, &dev_attr_registers); |
2289 | if (ret) | 2277 | if (ret) |
2290 | goto err_dev_reg; | 2278 | goto err_irq; |
2291 | 2279 | ||
2292 | ret = usb_add_gadget_udc(dev->dev, &dev->gadget); | 2280 | ret = usb_add_gadget_udc_release(dev->dev, &dev->gadget, |
2281 | net2272_gadget_release); | ||
2293 | if (ret) | 2282 | if (ret) |
2294 | goto err_add_udc; | 2283 | goto err_add_udc; |
2295 | 2284 | ||
@@ -2297,8 +2286,6 @@ net2272_probe_fin(struct net2272 *dev, unsigned int irqflags) | |||
2297 | 2286 | ||
2298 | err_add_udc: | 2287 | err_add_udc: |
2299 | device_remove_file(dev->dev, &dev_attr_registers); | 2288 | device_remove_file(dev->dev, &dev_attr_registers); |
2300 | err_dev_reg: | ||
2301 | device_unregister(&dev->gadget.dev); | ||
2302 | err_irq: | 2289 | err_irq: |
2303 | free_irq(dev->irq, dev); | 2290 | free_irq(dev->irq, dev); |
2304 | err: | 2291 | err: |