diff options
author | Oliver Neukum <oneukum@suse.de> | 2008-12-19 02:00:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-19 02:00:59 -0500 |
commit | c94cb314503a69492bf4455dce4f6d300cff0851 (patch) | |
tree | f049d27da8345fae393916c0ec5be0aed94b65a7 /drivers/net/usb/rtl8150.c | |
parent | ab5024ab23b78c86a0a1425defcdde48710fe449 (diff) |
net: prepare usb net drivers for addition of status as a parameter
USB is going to switch the signature of the callbacks to
void callback(struct urb *urb, int status)
This patch will ease the transition.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/rtl8150.c')
-rw-r--r-- | drivers/net/usb/rtl8150.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 6133401ebc67..d8664bf18c00 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -212,8 +212,9 @@ static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data) | |||
212 | static void ctrl_callback(struct urb *urb) | 212 | static void ctrl_callback(struct urb *urb) |
213 | { | 213 | { |
214 | rtl8150_t *dev; | 214 | rtl8150_t *dev; |
215 | int status = urb->status; | ||
215 | 216 | ||
216 | switch (urb->status) { | 217 | switch (status) { |
217 | case 0: | 218 | case 0: |
218 | break; | 219 | break; |
219 | case -EINPROGRESS: | 220 | case -EINPROGRESS: |
@@ -221,7 +222,7 @@ static void ctrl_callback(struct urb *urb) | |||
221 | case -ENOENT: | 222 | case -ENOENT: |
222 | break; | 223 | break; |
223 | default: | 224 | default: |
224 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", urb->status); | 225 | dev_warn(&urb->dev->dev, "ctrl urb status %d\n", status); |
225 | } | 226 | } |
226 | dev = urb->context; | 227 | dev = urb->context; |
227 | clear_bit(RX_REG_SET, &dev->flags); | 228 | clear_bit(RX_REG_SET, &dev->flags); |
@@ -424,7 +425,8 @@ static void read_bulk_callback(struct urb *urb) | |||
424 | struct sk_buff *skb; | 425 | struct sk_buff *skb; |
425 | struct net_device *netdev; | 426 | struct net_device *netdev; |
426 | u16 rx_stat; | 427 | u16 rx_stat; |
427 | int status; | 428 | int status = urb->status; |
429 | int result; | ||
428 | 430 | ||
429 | dev = urb->context; | 431 | dev = urb->context; |
430 | if (!dev) | 432 | if (!dev) |
@@ -435,7 +437,7 @@ static void read_bulk_callback(struct urb *urb) | |||
435 | if (!netif_device_present(netdev)) | 437 | if (!netif_device_present(netdev)) |
436 | return; | 438 | return; |
437 | 439 | ||
438 | switch (urb->status) { | 440 | switch (status) { |
439 | case 0: | 441 | case 0: |
440 | break; | 442 | break; |
441 | case -ENOENT: | 443 | case -ENOENT: |
@@ -444,7 +446,7 @@ static void read_bulk_callback(struct urb *urb) | |||
444 | dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); | 446 | dev_warn(&urb->dev->dev, "may be reset is needed?..\n"); |
445 | goto goon; | 447 | goto goon; |
446 | default: | 448 | default: |
447 | dev_warn(&urb->dev->dev, "Rx status %d\n", urb->status); | 449 | dev_warn(&urb->dev->dev, "Rx status %d\n", status); |
448 | goto goon; | 450 | goto goon; |
449 | } | 451 | } |
450 | 452 | ||
@@ -474,10 +476,10 @@ static void read_bulk_callback(struct urb *urb) | |||
474 | goon: | 476 | goon: |
475 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | 477 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), |
476 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 478 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
477 | status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); | 479 | result = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); |
478 | if (status == -ENODEV) | 480 | if (result == -ENODEV) |
479 | netif_device_detach(dev->netdev); | 481 | netif_device_detach(dev->netdev); |
480 | else if (status) { | 482 | else if (result) { |
481 | set_bit(RX_URB_FAIL, &dev->flags); | 483 | set_bit(RX_URB_FAIL, &dev->flags); |
482 | goto resched; | 484 | goto resched; |
483 | } else { | 485 | } else { |
@@ -530,6 +532,7 @@ tlsched: | |||
530 | static void write_bulk_callback(struct urb *urb) | 532 | static void write_bulk_callback(struct urb *urb) |
531 | { | 533 | { |
532 | rtl8150_t *dev; | 534 | rtl8150_t *dev; |
535 | int status = urb->status; | ||
533 | 536 | ||
534 | dev = urb->context; | 537 | dev = urb->context; |
535 | if (!dev) | 538 | if (!dev) |
@@ -537,9 +540,9 @@ static void write_bulk_callback(struct urb *urb) | |||
537 | dev_kfree_skb_irq(dev->tx_skb); | 540 | dev_kfree_skb_irq(dev->tx_skb); |
538 | if (!netif_device_present(dev->netdev)) | 541 | if (!netif_device_present(dev->netdev)) |
539 | return; | 542 | return; |
540 | if (urb->status) | 543 | if (status) |
541 | dev_info(&urb->dev->dev, "%s: Tx status %d\n", | 544 | dev_info(&urb->dev->dev, "%s: Tx status %d\n", |
542 | dev->netdev->name, urb->status); | 545 | dev->netdev->name, status); |
543 | dev->netdev->trans_start = jiffies; | 546 | dev->netdev->trans_start = jiffies; |
544 | netif_wake_queue(dev->netdev); | 547 | netif_wake_queue(dev->netdev); |
545 | } | 548 | } |
@@ -548,12 +551,13 @@ static void intr_callback(struct urb *urb) | |||
548 | { | 551 | { |
549 | rtl8150_t *dev; | 552 | rtl8150_t *dev; |
550 | __u8 *d; | 553 | __u8 *d; |
551 | int status; | 554 | int status = urb->status; |
555 | int res; | ||
552 | 556 | ||
553 | dev = urb->context; | 557 | dev = urb->context; |
554 | if (!dev) | 558 | if (!dev) |
555 | return; | 559 | return; |
556 | switch (urb->status) { | 560 | switch (status) { |
557 | case 0: /* success */ | 561 | case 0: /* success */ |
558 | break; | 562 | break; |
559 | case -ECONNRESET: /* unlink */ | 563 | case -ECONNRESET: /* unlink */ |
@@ -563,7 +567,7 @@ static void intr_callback(struct urb *urb) | |||
563 | /* -EPIPE: should clear the halt */ | 567 | /* -EPIPE: should clear the halt */ |
564 | default: | 568 | default: |
565 | dev_info(&urb->dev->dev, "%s: intr status %d\n", | 569 | dev_info(&urb->dev->dev, "%s: intr status %d\n", |
566 | dev->netdev->name, urb->status); | 570 | dev->netdev->name, status); |
567 | goto resubmit; | 571 | goto resubmit; |
568 | } | 572 | } |
569 | 573 | ||
@@ -591,13 +595,13 @@ static void intr_callback(struct urb *urb) | |||
591 | } | 595 | } |
592 | 596 | ||
593 | resubmit: | 597 | resubmit: |
594 | status = usb_submit_urb (urb, GFP_ATOMIC); | 598 | res = usb_submit_urb (urb, GFP_ATOMIC); |
595 | if (status == -ENODEV) | 599 | if (res == -ENODEV) |
596 | netif_device_detach(dev->netdev); | 600 | netif_device_detach(dev->netdev); |
597 | else if (status) | 601 | else if (res) |
598 | err ("can't resubmit intr, %s-%s/input0, status %d", | 602 | err ("can't resubmit intr, %s-%s/input0, status %d", |
599 | dev->udev->bus->bus_name, | 603 | dev->udev->bus->bus_name, |
600 | dev->udev->devpath, status); | 604 | dev->udev->devpath, res); |
601 | } | 605 | } |
602 | 606 | ||
603 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message) | 607 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message) |