Commit 289eac22 authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: convert kaweth to usb_buffer_alloc

  - switch to usb_buffer_alloc
parent 1837f6a9
...@@ -226,12 +226,16 @@ struct kaweth_device ...@@ -226,12 +226,16 @@ struct kaweth_device
struct urb *tx_urb; struct urb *tx_urb;
struct urb *irq_urb; struct urb *irq_urb;
dma_addr_t intbufferhandle;
__u8 *intbuffer;
dma_addr_t rxbufferhandle;
__u8 *rx_buf;
struct sk_buff *tx_skb; struct sk_buff *tx_skb;
__u8 *firmware_buf; __u8 *firmware_buf;
__u8 scratch[KAWETH_SCRATCH_SIZE]; __u8 scratch[KAWETH_SCRATCH_SIZE];
__u8 rx_buf[KAWETH_BUF_SIZE];
__u8 intbuffer[INTBUFFERSIZE];
__u16 packet_filter_bitmap; __u16 packet_filter_bitmap;
struct kaweth_ethernet_configuration configuration; struct kaweth_ethernet_configuration configuration;
...@@ -524,6 +528,8 @@ static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth, ...@@ -524,6 +528,8 @@ static int kaweth_resubmit_rx_urb(struct kaweth_device *kaweth,
KAWETH_BUF_SIZE, KAWETH_BUF_SIZE,
kaweth_usb_receive, kaweth_usb_receive,
kaweth); kaweth);
kaweth->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
kaweth->rx_urb->transfer_dma = kaweth->rxbufferhandle;
if((result = usb_submit_urb(kaweth->rx_urb, mem_flags))) { if((result = usb_submit_urb(kaweth->rx_urb, mem_flags))) {
if (result == -ENOMEM) if (result == -ENOMEM)
...@@ -630,6 +636,8 @@ static int kaweth_open(struct net_device *net) ...@@ -630,6 +636,8 @@ static int kaweth_open(struct net_device *net)
int_callback, int_callback,
kaweth, kaweth,
HZ/4); HZ/4);
kaweth->irq_urb->transfer_dma = kaweth->intbufferhandle;
kaweth->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
res = usb_submit_urb(kaweth->irq_urb, GFP_KERNEL); res = usb_submit_urb(kaweth->irq_urb, GFP_KERNEL);
if (res) { if (res) {
...@@ -1033,6 +1041,19 @@ static int kaweth_probe( ...@@ -1033,6 +1041,19 @@ static int kaweth_probe(
if (!kaweth->irq_urb) if (!kaweth->irq_urb)
goto err_tx_and_rx; goto err_tx_and_rx;
kaweth->intbuffer = usb_buffer_alloc( kaweth->dev,
INTBUFFERSIZE,
GFP_KERNEL,
&kaweth->intbufferhandle);
if (!kaweth->intbuffer)
goto err_tx_and_rx_and_irq;
kaweth->rx_buf = usb_buffer_alloc( kaweth->dev,
KAWETH_BUF_SIZE,
GFP_KERNEL,
&kaweth->rxbufferhandle);
if (!kaweth->rx_buf)
goto err_all_but_rxbuf;
kaweth->net = netdev; kaweth->net = netdev;
memcpy(kaweth->net->broadcast, &bcast_addr, sizeof(bcast_addr)); memcpy(kaweth->net->broadcast, &bcast_addr, sizeof(bcast_addr));
memcpy(kaweth->net->dev_addr, memcpy(kaweth->net->dev_addr,
...@@ -1071,6 +1092,12 @@ static int kaweth_probe( ...@@ -1071,6 +1092,12 @@ static int kaweth_probe(
err_intfdata: err_intfdata:
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
err_all:
usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
err_all_but_rxbuf:
usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
err_tx_and_rx_and_irq:
usb_free_urb(kaweth->irq_urb);
err_tx_and_rx: err_tx_and_rx:
usb_free_urb(kaweth->rx_urb); usb_free_urb(kaweth->rx_urb);
err_only_tx: err_only_tx:
...@@ -1123,6 +1150,11 @@ static void kaweth_disconnect(struct usb_interface *intf) ...@@ -1123,6 +1150,11 @@ static void kaweth_disconnect(struct usb_interface *intf)
usb_free_urb(kaweth->rx_urb); usb_free_urb(kaweth->rx_urb);
usb_free_urb(kaweth->tx_urb); usb_free_urb(kaweth->tx_urb);
usb_free_urb(kaweth->irq_urb);
usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, kaweth->rxbufferhandle);
usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, kaweth->intbufferhandle);
kfree(kaweth); kfree(kaweth);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment