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/pegasus.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/pegasus.c')
-rw-r--r-- | drivers/net/usb/pegasus.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c index 075e8e94225e..166880c113d6 100644 --- a/drivers/net/usb/pegasus.c +++ b/drivers/net/usb/pegasus.c | |||
@@ -99,11 +99,12 @@ static int update_eth_regs_async(pegasus_t *); | |||
99 | static void ctrl_callback(struct urb *urb) | 99 | static void ctrl_callback(struct urb *urb) |
100 | { | 100 | { |
101 | pegasus_t *pegasus = urb->context; | 101 | pegasus_t *pegasus = urb->context; |
102 | int status = urb->status; | ||
102 | 103 | ||
103 | if (!pegasus) | 104 | if (!pegasus) |
104 | return; | 105 | return; |
105 | 106 | ||
106 | switch (urb->status) { | 107 | switch (status) { |
107 | case 0: | 108 | case 0: |
108 | if (pegasus->flags & ETH_REGS_CHANGE) { | 109 | if (pegasus->flags & ETH_REGS_CHANGE) { |
109 | pegasus->flags &= ~ETH_REGS_CHANGE; | 110 | pegasus->flags &= ~ETH_REGS_CHANGE; |
@@ -119,7 +120,7 @@ static void ctrl_callback(struct urb *urb) | |||
119 | default: | 120 | default: |
120 | if (netif_msg_drv(pegasus) && printk_ratelimit()) | 121 | if (netif_msg_drv(pegasus) && printk_ratelimit()) |
121 | dev_dbg(&pegasus->intf->dev, "%s, status %d\n", | 122 | dev_dbg(&pegasus->intf->dev, "%s, status %d\n", |
122 | __func__, urb->status); | 123 | __func__, status); |
123 | } | 124 | } |
124 | pegasus->flags &= ~ETH_REGS_CHANGED; | 125 | pegasus->flags &= ~ETH_REGS_CHANGED; |
125 | wake_up(&pegasus->ctrl_wait); | 126 | wake_up(&pegasus->ctrl_wait); |
@@ -611,6 +612,7 @@ static void read_bulk_callback(struct urb *urb) | |||
611 | pegasus_t *pegasus = urb->context; | 612 | pegasus_t *pegasus = urb->context; |
612 | struct net_device *net; | 613 | struct net_device *net; |
613 | int rx_status, count = urb->actual_length; | 614 | int rx_status, count = urb->actual_length; |
615 | int status = urb->status; | ||
614 | u8 *buf = urb->transfer_buffer; | 616 | u8 *buf = urb->transfer_buffer; |
615 | __u16 pkt_len; | 617 | __u16 pkt_len; |
616 | 618 | ||
@@ -621,7 +623,7 @@ static void read_bulk_callback(struct urb *urb) | |||
621 | if (!netif_device_present(net) || !netif_running(net)) | 623 | if (!netif_device_present(net) || !netif_running(net)) |
622 | return; | 624 | return; |
623 | 625 | ||
624 | switch (urb->status) { | 626 | switch (status) { |
625 | case 0: | 627 | case 0: |
626 | break; | 628 | break; |
627 | case -ETIME: | 629 | case -ETIME: |
@@ -639,11 +641,11 @@ static void read_bulk_callback(struct urb *urb) | |||
639 | case -ECONNRESET: | 641 | case -ECONNRESET: |
640 | case -ESHUTDOWN: | 642 | case -ESHUTDOWN: |
641 | if (netif_msg_ifdown(pegasus)) | 643 | if (netif_msg_ifdown(pegasus)) |
642 | pr_debug("%s: rx unlink, %d\n", net->name, urb->status); | 644 | pr_debug("%s: rx unlink, %d\n", net->name, status); |
643 | return; | 645 | return; |
644 | default: | 646 | default: |
645 | if (netif_msg_rx_err(pegasus)) | 647 | if (netif_msg_rx_err(pegasus)) |
646 | pr_debug("%s: RX status %d\n", net->name, urb->status); | 648 | pr_debug("%s: RX status %d\n", net->name, status); |
647 | goto goon; | 649 | goto goon; |
648 | } | 650 | } |
649 | 651 | ||
@@ -769,6 +771,7 @@ static void write_bulk_callback(struct urb *urb) | |||
769 | { | 771 | { |
770 | pegasus_t *pegasus = urb->context; | 772 | pegasus_t *pegasus = urb->context; |
771 | struct net_device *net; | 773 | struct net_device *net; |
774 | int status = urb->status; | ||
772 | 775 | ||
773 | if (!pegasus) | 776 | if (!pegasus) |
774 | return; | 777 | return; |
@@ -778,7 +781,7 @@ static void write_bulk_callback(struct urb *urb) | |||
778 | if (!netif_device_present(net) || !netif_running(net)) | 781 | if (!netif_device_present(net) || !netif_running(net)) |
779 | return; | 782 | return; |
780 | 783 | ||
781 | switch (urb->status) { | 784 | switch (status) { |
782 | case -EPIPE: | 785 | case -EPIPE: |
783 | /* FIXME schedule_work() to clear the tx halt */ | 786 | /* FIXME schedule_work() to clear the tx halt */ |
784 | netif_stop_queue(net); | 787 | netif_stop_queue(net); |
@@ -790,11 +793,11 @@ static void write_bulk_callback(struct urb *urb) | |||
790 | case -ECONNRESET: | 793 | case -ECONNRESET: |
791 | case -ESHUTDOWN: | 794 | case -ESHUTDOWN: |
792 | if (netif_msg_ifdown(pegasus)) | 795 | if (netif_msg_ifdown(pegasus)) |
793 | pr_debug("%s: tx unlink, %d\n", net->name, urb->status); | 796 | pr_debug("%s: tx unlink, %d\n", net->name, status); |
794 | return; | 797 | return; |
795 | default: | 798 | default: |
796 | if (netif_msg_tx_err(pegasus)) | 799 | if (netif_msg_tx_err(pegasus)) |
797 | pr_info("%s: TX status %d\n", net->name, urb->status); | 800 | pr_info("%s: TX status %d\n", net->name, status); |
798 | /* FALL THROUGH */ | 801 | /* FALL THROUGH */ |
799 | case 0: | 802 | case 0: |
800 | break; | 803 | break; |
@@ -808,13 +811,13 @@ static void intr_callback(struct urb *urb) | |||
808 | { | 811 | { |
809 | pegasus_t *pegasus = urb->context; | 812 | pegasus_t *pegasus = urb->context; |
810 | struct net_device *net; | 813 | struct net_device *net; |
811 | int status; | 814 | int res, status = urb->status; |
812 | 815 | ||
813 | if (!pegasus) | 816 | if (!pegasus) |
814 | return; | 817 | return; |
815 | net = pegasus->net; | 818 | net = pegasus->net; |
816 | 819 | ||
817 | switch (urb->status) { | 820 | switch (status) { |
818 | case 0: | 821 | case 0: |
819 | break; | 822 | break; |
820 | case -ECONNRESET: /* unlink */ | 823 | case -ECONNRESET: /* unlink */ |
@@ -827,7 +830,7 @@ static void intr_callback(struct urb *urb) | |||
827 | */ | 830 | */ |
828 | if (netif_msg_timer(pegasus)) | 831 | if (netif_msg_timer(pegasus)) |
829 | pr_debug("%s: intr status %d\n", net->name, | 832 | pr_debug("%s: intr status %d\n", net->name, |
830 | urb->status); | 833 | status); |
831 | } | 834 | } |
832 | 835 | ||
833 | if (urb->actual_length >= 6) { | 836 | if (urb->actual_length >= 6) { |
@@ -854,12 +857,12 @@ static void intr_callback(struct urb *urb) | |||
854 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; | 857 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; |
855 | } | 858 | } |
856 | 859 | ||
857 | status = usb_submit_urb(urb, GFP_ATOMIC); | 860 | res = usb_submit_urb(urb, GFP_ATOMIC); |
858 | if (status == -ENODEV) | 861 | if (res == -ENODEV) |
859 | netif_device_detach(pegasus->net); | 862 | netif_device_detach(pegasus->net); |
860 | if (status && netif_msg_timer(pegasus)) | 863 | if (res && netif_msg_timer(pegasus)) |
861 | printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n", | 864 | printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n", |
862 | net->name, status); | 865 | net->name, res); |
863 | } | 866 | } |
864 | 867 | ||
865 | static void pegasus_tx_timeout(struct net_device *net) | 868 | static void pegasus_tx_timeout(struct net_device *net) |