Commit 7e713b82 authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] USB: pegasus fixes (logstorm, suspend)

Teach "pegasus" to handle a few of the disconnect fault paths
without hundreds of usless syslog messages.

Handle the carrier check workqueue entry even if the driver has
not been opened.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6275cdfa
...@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) ...@@ -318,6 +318,8 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
set_register(pegasus, PhyCtrl, (indx | PHY_READ)); set_register(pegasus, PhyCtrl, (indx | PHY_READ));
for (i = 0; i < REG_TIMEOUT; i++) { for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, PhyCtrl, 1, data); ret = get_registers(pegasus, PhyCtrl, 1, data);
if (ret == -ESHUTDOWN)
goto fail;
if (data[0] & PHY_DONE) if (data[0] & PHY_DONE)
break; break;
} }
...@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) ...@@ -326,6 +328,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
*regd = le16_to_cpu(regdi); *regd = le16_to_cpu(regdi);
return ret; return ret;
} }
fail:
if (netif_msg_drv(pegasus)) if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
...@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd) ...@@ -354,12 +357,15 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
for (i = 0; i < REG_TIMEOUT; i++) { for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, PhyCtrl, 1, data); ret = get_registers(pegasus, PhyCtrl, 1, data);
if (ret == -ESHUTDOWN)
goto fail;
if (data[0] & PHY_DONE) if (data[0] & PHY_DONE)
break; break;
} }
if (i < REG_TIMEOUT) if (i < REG_TIMEOUT)
return ret; return ret;
fail:
if (netif_msg_drv(pegasus)) if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) ...@@ -387,6 +393,8 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
ret = get_registers(pegasus, EpromCtrl, 1, &tmp); ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
if (tmp & EPROM_DONE) if (tmp & EPROM_DONE)
break; break;
if (ret == -ESHUTDOWN)
goto fail;
} }
if (i < REG_TIMEOUT) { if (i < REG_TIMEOUT) {
ret = get_registers(pegasus, EpromData, 2, &retdatai); ret = get_registers(pegasus, EpromData, 2, &retdatai);
...@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) ...@@ -394,6 +402,7 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
return ret; return ret;
} }
fail:
if (netif_msg_drv(pegasus)) if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) ...@@ -433,12 +442,15 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
for (i = 0; i < REG_TIMEOUT; i++) { for (i = 0; i < REG_TIMEOUT; i++) {
ret = get_registers(pegasus, EpromCtrl, 1, &tmp); ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
if (ret == -ESHUTDOWN)
goto fail;
if (tmp & EPROM_DONE) if (tmp & EPROM_DONE)
break; break;
} }
disable_eprom_write(pegasus); disable_eprom_write(pegasus);
if (i < REG_TIMEOUT) if (i < REG_TIMEOUT)
return ret; return ret;
fail:
if (netif_msg_drv(pegasus)) if (netif_msg_drv(pegasus))
dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) ...@@ -1378,9 +1390,8 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
struct pegasus *pegasus = usb_get_intfdata(intf); struct pegasus *pegasus = usb_get_intfdata(intf);
netif_device_detach (pegasus->net); netif_device_detach (pegasus->net);
if (netif_running(pegasus->net)) {
cancel_delayed_work(&pegasus->carrier_check); cancel_delayed_work(&pegasus->carrier_check);
if (netif_running(pegasus->net)) {
usb_kill_urb(pegasus->rx_urb); usb_kill_urb(pegasus->rx_urb);
usb_kill_urb(pegasus->intr_urb); usb_kill_urb(pegasus->intr_urb);
} }
...@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf) ...@@ -1400,10 +1411,9 @@ static int pegasus_resume (struct usb_interface *intf)
pegasus->intr_urb->status = 0; pegasus->intr_urb->status = 0;
pegasus->intr_urb->actual_length = 0; pegasus->intr_urb->actual_length = 0;
intr_callback(pegasus->intr_urb, NULL); intr_callback(pegasus->intr_urb, NULL);
}
queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,
CARRIER_CHECK_DELAY); CARRIER_CHECK_DELAY);
}
return 0; return 0;
} }
......
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