Commit e08f53f5 authored by David S. Miller's avatar David S. Miller

Merge branch 'r8152'

Hayes Wang says:

====================
r8152: cleanups

Deal with some empty lines and spaces, replace some tp->netdev with netdev,
and remove the unnecessary function.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 67ddc87f 05e0f1aa
...@@ -593,6 +593,7 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) ...@@ -593,6 +593,7 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
value, index, tmp, size, 500); value, index, tmp, size, 500);
kfree(tmp); kfree(tmp);
return ret; return ret;
} }
...@@ -959,11 +960,6 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p) ...@@ -959,11 +960,6 @@ static int rtl8152_set_mac_address(struct net_device *netdev, void *p)
return 0; return 0;
} }
static struct net_device_stats *rtl8152_get_stats(struct net_device *dev)
{
return &dev->stats;
}
static void read_bulk_callback(struct urb *urb) static void read_bulk_callback(struct urb *urb)
{ {
struct net_device *netdev; struct net_device *netdev;
...@@ -1036,6 +1032,7 @@ static void read_bulk_callback(struct urb *urb) ...@@ -1036,6 +1032,7 @@ static void read_bulk_callback(struct urb *urb)
static void write_bulk_callback(struct urb *urb) static void write_bulk_callback(struct urb *urb)
{ {
struct net_device_stats *stats; struct net_device_stats *stats;
struct net_device *netdev;
unsigned long flags; unsigned long flags;
struct tx_agg *agg; struct tx_agg *agg;
struct r8152 *tp; struct r8152 *tp;
...@@ -1049,10 +1046,11 @@ static void write_bulk_callback(struct urb *urb) ...@@ -1049,10 +1046,11 @@ static void write_bulk_callback(struct urb *urb)
if (!tp) if (!tp)
return; return;
stats = rtl8152_get_stats(tp->netdev); netdev = tp->netdev;
stats = &netdev->stats;
if (status) { if (status) {
if (net_ratelimit()) if (net_ratelimit())
netdev_warn(tp->netdev, "Tx status %d\n", status); netdev_warn(netdev, "Tx status %d\n", status);
stats->tx_errors += agg->skb_num; stats->tx_errors += agg->skb_num;
} else { } else {
stats->tx_packets += agg->skb_num; stats->tx_packets += agg->skb_num;
...@@ -1065,7 +1063,7 @@ static void write_bulk_callback(struct urb *urb) ...@@ -1065,7 +1063,7 @@ static void write_bulk_callback(struct urb *urb)
usb_autopm_put_interface_async(tp->intf); usb_autopm_put_interface_async(tp->intf);
if (!netif_carrier_ok(tp->netdev)) if (!netif_carrier_ok(netdev))
return; return;
if (!test_bit(WORK_ENABLE, &tp->flags)) if (!test_bit(WORK_ENABLE, &tp->flags))
...@@ -1439,7 +1437,7 @@ static void rx_bottom(struct r8152 *tp) ...@@ -1439,7 +1437,7 @@ static void rx_bottom(struct r8152 *tp)
while (urb->actual_length > len_used) { while (urb->actual_length > len_used) {
struct net_device *netdev = tp->netdev; struct net_device *netdev = tp->netdev;
struct net_device_stats *stats; struct net_device_stats *stats = &netdev->stats;
unsigned int pkt_len; unsigned int pkt_len;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -1451,8 +1449,6 @@ static void rx_bottom(struct r8152 *tp) ...@@ -1451,8 +1449,6 @@ static void rx_bottom(struct r8152 *tp)
if (urb->actual_length < len_used) if (urb->actual_length < len_used)
break; break;
stats = rtl8152_get_stats(netdev);
pkt_len -= CRC_SIZE; pkt_len -= CRC_SIZE;
rx_data += sizeof(struct rx_desc); rx_data += sizeof(struct rx_desc);
...@@ -1501,19 +1497,18 @@ static void tx_bottom(struct r8152 *tp) ...@@ -1501,19 +1497,18 @@ static void tx_bottom(struct r8152 *tp)
res = r8152_tx_agg_fill(tp, agg); res = r8152_tx_agg_fill(tp, agg);
if (res) { if (res) {
struct net_device_stats *stats; struct net_device *netdev = tp->netdev;
struct net_device *netdev;
unsigned long flags;
netdev = tp->netdev;
stats = rtl8152_get_stats(netdev);
if (res == -ENODEV) { if (res == -ENODEV) {
netif_device_detach(netdev); netif_device_detach(netdev);
} else { } else {
struct net_device_stats *stats = &netdev->stats;
unsigned long flags;
netif_warn(tp, tx_err, netdev, netif_warn(tp, tx_err, netdev,
"failed tx_urb %d\n", res); "failed tx_urb %d\n", res);
stats->tx_dropped += agg->skb_num; stats->tx_dropped += agg->skb_num;
spin_lock_irqsave(&tp->tx_lock, flags); spin_lock_irqsave(&tp->tx_lock, flags);
list_add_tail(&agg->list, &tp->tx_free); list_add_tail(&agg->list, &tp->tx_free);
spin_unlock_irqrestore(&tp->tx_lock, flags); spin_unlock_irqrestore(&tp->tx_lock, flags);
...@@ -1833,7 +1828,6 @@ static void r8152_power_cut_en(struct r8152 *tp, bool enable) ...@@ -1833,7 +1828,6 @@ static void r8152_power_cut_en(struct r8152 *tp, bool enable)
ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS); ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS);
ocp_data &= ~RESUME_INDICATE; ocp_data &= ~RESUME_INDICATE;
ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data); ocp_write_word(tp, MCU_TYPE_USB, USB_PM_CTRL_STATUS, ocp_data);
} }
#define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST)
...@@ -2013,8 +2007,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) ...@@ -2013,8 +2007,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp)
static void r8152b_exit_oob(struct r8152 *tp) static void r8152b_exit_oob(struct r8152 *tp)
{ {
u32 ocp_data; u32 ocp_data;
int i; int i;
ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
ocp_data &= ~RCR_ACPT_ALL; ocp_data &= ~RCR_ACPT_ALL;
...@@ -2573,6 +2567,7 @@ static int rtl8152_open(struct net_device *netdev) ...@@ -2573,6 +2567,7 @@ static int rtl8152_open(struct net_device *netdev)
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_start_queue(netdev); netif_start_queue(netdev);
set_bit(WORK_ENABLE, &tp->flags); set_bit(WORK_ENABLE, &tp->flags);
res = usb_submit_urb(tp->intr_urb, GFP_KERNEL); res = usb_submit_urb(tp->intr_urb, GFP_KERNEL);
if (res) { if (res) {
if (res == -ENODEV) if (res == -ENODEV)
...@@ -3101,6 +3096,7 @@ static int rtl8152_probe(struct usb_interface *intf, ...@@ -3101,6 +3096,7 @@ static int rtl8152_probe(struct usb_interface *intf,
netdev->features |= NETIF_F_IP_CSUM; netdev->features |= NETIF_F_IP_CSUM;
netdev->hw_features = NETIF_F_IP_CSUM; netdev->hw_features = NETIF_F_IP_CSUM;
SET_ETHTOOL_OPS(netdev, &ops); SET_ETHTOOL_OPS(netdev, &ops);
tp->mii.dev = netdev; tp->mii.dev = netdev;
......
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