Skip to content

Commit

Permalink
[PATCH] USB: more pegasus log spamming removed
Browse files Browse the repository at this point in the history
Remove more log spamming from pegasus:  stop talking to the device once we
see ENODEV reported.  It may take a while before khubd notifies us.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
David Brownell authored and gregkh committed Jun 21, 2006
1 parent b560033 commit 955a260
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions drivers/usb/net/pegasus.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size,

/* using ATOMIC, we'd never wake up if we slept */
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
Expand Down Expand Up @@ -217,6 +219,8 @@ static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
set_current_state(TASK_UNINTERRUPTIBLE);

if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
Expand Down Expand Up @@ -268,6 +272,8 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
set_current_state(TASK_UNINTERRUPTIBLE);

if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
Expand Down Expand Up @@ -298,10 +304,13 @@ static int update_eth_regs_async(pegasus_t * pegasus)
(char *) &pegasus->dr,
pegasus->eth_regs, 3, ctrl_callback, pegasus);

if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC)))
if ((ret = usb_submit_urb(pegasus->ctrl_urb, GFP_ATOMIC))) {
if (ret == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_drv(pegasus))
dev_err(&pegasus->intf->dev, "%s, status %d\n",
__FUNCTION__, ret);
}

return ret;
}
Expand Down Expand Up @@ -692,7 +701,10 @@ static void read_bulk_callback(struct urb *urb, struct pt_regs *regs)
usb_rcvbulkpipe(pegasus->usb, 1),
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
if (usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC)) {
rx_status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
if (rx_status == -ENODEV)
netif_device_detach(pegasus->net);
else if (rx_status) {
pegasus->flags |= PEGASUS_RX_URB_FAIL;
goto tl_sched;
} else {
Expand All @@ -709,6 +721,7 @@ static void rx_fixup(unsigned long data)
{
pegasus_t *pegasus;
unsigned long flags;
int status;

pegasus = (pegasus_t *) data;
if (pegasus->flags & PEGASUS_UNPLUG)
Expand All @@ -734,7 +747,10 @@ static void rx_fixup(unsigned long data)
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
try_again:
if (usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC)) {
status = usb_submit_urb(pegasus->rx_urb, GFP_ATOMIC);
if (status == -ENODEV)
netif_device_detach(pegasus->net);
else if (status) {
pegasus->flags |= PEGASUS_RX_URB_FAIL;
tasklet_schedule(&pegasus->rx_tl);
} else {
Expand Down Expand Up @@ -836,6 +852,8 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
}

status = usb_submit_urb(urb, SLAB_ATOMIC);
if (status == -ENODEV)
netif_device_detach(pegasus->net);
if (status && netif_msg_timer(pegasus))
printk(KERN_ERR "%s: can't resubmit interrupt urb, %d\n",
net->name, status);
Expand Down Expand Up @@ -874,6 +892,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
/* cleanup should already have been scheduled */
break;
case -ENODEV: /* disconnect() upcoming */
netif_device_detach(pegasus->net);
break;
default:
pegasus->stats.tx_errors++;
Expand Down Expand Up @@ -999,6 +1018,8 @@ static int pegasus_open(struct net_device *net)
pegasus->rx_skb->data, PEGASUS_MTU + 8,
read_bulk_callback, pegasus);
if ((res = usb_submit_urb(pegasus->rx_urb, GFP_KERNEL))) {
if (res == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_ifup(pegasus))
pr_debug("%s: failed rx_urb, %d", net->name, res);
goto exit;
Expand All @@ -1009,6 +1030,8 @@ static int pegasus_open(struct net_device *net)
pegasus->intr_buff, sizeof (pegasus->intr_buff),
intr_callback, pegasus, pegasus->intr_interval);
if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) {
if (res == -ENODEV)
netif_device_detach(pegasus->net);
if (netif_msg_ifup(pegasus))
pr_debug("%s: failed intr_urb, %d\n", net->name, res);
usb_kill_urb(pegasus->rx_urb);
Expand Down

0 comments on commit 955a260

Please sign in to comment.