diff options
author | françois romieu <romieu@fr.zoreil.com> | 2011-09-29 20:38:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-03 14:09:10 -0400 |
commit | 141b9e665427aaaefaf76445dbc41fcd0311bbfb (patch) | |
tree | 181986d922f1bef913df3055c3823043c6c097c5 /drivers/net/usb/rtl8150.c | |
parent | 3235de1684ae88e5e380de254a2a674dcd558acc (diff) |
rtl8150: removal of forward declarations.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
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 | 111 |
1 files changed, 50 insertions, 61 deletions
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index b00d692587a2..bf8c84d0adf2 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -169,26 +169,8 @@ struct rtl8150 { | |||
169 | 169 | ||
170 | typedef struct rtl8150 rtl8150_t; | 170 | typedef struct rtl8150 rtl8150_t; |
171 | 171 | ||
172 | static void fill_skb_pool(rtl8150_t *); | ||
173 | static void free_skb_pool(rtl8150_t *); | ||
174 | static inline struct sk_buff *pull_skb(rtl8150_t *); | ||
175 | static void rtl8150_disconnect(struct usb_interface *intf); | ||
176 | static int rtl8150_probe(struct usb_interface *intf, | ||
177 | const struct usb_device_id *id); | ||
178 | static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message); | ||
179 | static int rtl8150_resume(struct usb_interface *intf); | ||
180 | |||
181 | static const char driver_name [] = "rtl8150"; | 172 | static const char driver_name [] = "rtl8150"; |
182 | 173 | ||
183 | static struct usb_driver rtl8150_driver = { | ||
184 | .name = driver_name, | ||
185 | .probe = rtl8150_probe, | ||
186 | .disconnect = rtl8150_disconnect, | ||
187 | .id_table = rtl8150_table, | ||
188 | .suspend = rtl8150_suspend, | ||
189 | .resume = rtl8150_resume | ||
190 | }; | ||
191 | |||
192 | /* | 174 | /* |
193 | ** | 175 | ** |
194 | ** device related part of the code | 176 | ** device related part of the code |
@@ -333,7 +315,7 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p) | |||
333 | /* Write the MAC address into eeprom. Eeprom writes must be word-sized, | 315 | /* Write the MAC address into eeprom. Eeprom writes must be word-sized, |
334 | so we need to split them up. */ | 316 | so we need to split them up. */ |
335 | for (i = 0; i * 2 < netdev->addr_len; i++) { | 317 | for (i = 0; i * 2 < netdev->addr_len; i++) { |
336 | set_registers(dev, IDR_EEPROM + (i * 2), 2, | 318 | set_registers(dev, IDR_EEPROM + (i * 2), 2, |
337 | netdev->dev_addr + (i * 2)); | 319 | netdev->dev_addr + (i * 2)); |
338 | } | 320 | } |
339 | /* Clear the WEPROM bit (preventing accidental eeprom writes). */ | 321 | /* Clear the WEPROM bit (preventing accidental eeprom writes). */ |
@@ -490,44 +472,6 @@ resched: | |||
490 | tasklet_schedule(&dev->tl); | 472 | tasklet_schedule(&dev->tl); |
491 | } | 473 | } |
492 | 474 | ||
493 | static void rx_fixup(unsigned long data) | ||
494 | { | ||
495 | rtl8150_t *dev; | ||
496 | struct sk_buff *skb; | ||
497 | int status; | ||
498 | |||
499 | dev = (rtl8150_t *)data; | ||
500 | |||
501 | spin_lock_irq(&dev->rx_pool_lock); | ||
502 | fill_skb_pool(dev); | ||
503 | spin_unlock_irq(&dev->rx_pool_lock); | ||
504 | if (test_bit(RX_URB_FAIL, &dev->flags)) | ||
505 | if (dev->rx_skb) | ||
506 | goto try_again; | ||
507 | spin_lock_irq(&dev->rx_pool_lock); | ||
508 | skb = pull_skb(dev); | ||
509 | spin_unlock_irq(&dev->rx_pool_lock); | ||
510 | if (skb == NULL) | ||
511 | goto tlsched; | ||
512 | dev->rx_skb = skb; | ||
513 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | ||
514 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | ||
515 | try_again: | ||
516 | status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); | ||
517 | if (status == -ENODEV) { | ||
518 | netif_device_detach(dev->netdev); | ||
519 | } else if (status) { | ||
520 | set_bit(RX_URB_FAIL, &dev->flags); | ||
521 | goto tlsched; | ||
522 | } else { | ||
523 | clear_bit(RX_URB_FAIL, &dev->flags); | ||
524 | } | ||
525 | |||
526 | return; | ||
527 | tlsched: | ||
528 | tasklet_schedule(&dev->tl); | ||
529 | } | ||
530 | |||
531 | static void write_bulk_callback(struct urb *urb) | 475 | static void write_bulk_callback(struct urb *urb) |
532 | { | 476 | { |
533 | rtl8150_t *dev; | 477 | rtl8150_t *dev; |
@@ -665,6 +609,42 @@ static void free_skb_pool(rtl8150_t *dev) | |||
665 | dev_kfree_skb(dev->rx_skb_pool[i]); | 609 | dev_kfree_skb(dev->rx_skb_pool[i]); |
666 | } | 610 | } |
667 | 611 | ||
612 | static void rx_fixup(unsigned long data) | ||
613 | { | ||
614 | struct rtl8150 *dev = (struct rtl8150 *)data; | ||
615 | struct sk_buff *skb; | ||
616 | int status; | ||
617 | |||
618 | spin_lock_irq(&dev->rx_pool_lock); | ||
619 | fill_skb_pool(dev); | ||
620 | spin_unlock_irq(&dev->rx_pool_lock); | ||
621 | if (test_bit(RX_URB_FAIL, &dev->flags)) | ||
622 | if (dev->rx_skb) | ||
623 | goto try_again; | ||
624 | spin_lock_irq(&dev->rx_pool_lock); | ||
625 | skb = pull_skb(dev); | ||
626 | spin_unlock_irq(&dev->rx_pool_lock); | ||
627 | if (skb == NULL) | ||
628 | goto tlsched; | ||
629 | dev->rx_skb = skb; | ||
630 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | ||
631 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | ||
632 | try_again: | ||
633 | status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC); | ||
634 | if (status == -ENODEV) { | ||
635 | netif_device_detach(dev->netdev); | ||
636 | } else if (status) { | ||
637 | set_bit(RX_URB_FAIL, &dev->flags); | ||
638 | goto tlsched; | ||
639 | } else { | ||
640 | clear_bit(RX_URB_FAIL, &dev->flags); | ||
641 | } | ||
642 | |||
643 | return; | ||
644 | tlsched: | ||
645 | tasklet_schedule(&dev->tl); | ||
646 | } | ||
647 | |||
668 | static int enable_net_traffic(rtl8150_t * dev) | 648 | static int enable_net_traffic(rtl8150_t * dev) |
669 | { | 649 | { |
670 | u8 cr, tcr, rcr, msr; | 650 | u8 cr, tcr, rcr, msr; |
@@ -778,7 +758,7 @@ static int rtl8150_open(struct net_device *netdev) | |||
778 | return -ENOMEM; | 758 | return -ENOMEM; |
779 | 759 | ||
780 | set_registers(dev, IDR, 6, netdev->dev_addr); | 760 | set_registers(dev, IDR, 6, netdev->dev_addr); |
781 | 761 | ||
782 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), | 762 | usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), |
783 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); | 763 | dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); |
784 | if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) { | 764 | if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) { |
@@ -898,7 +878,7 @@ static const struct net_device_ops rtl8150_netdev_ops = { | |||
898 | .ndo_stop = rtl8150_close, | 878 | .ndo_stop = rtl8150_close, |
899 | .ndo_do_ioctl = rtl8150_ioctl, | 879 | .ndo_do_ioctl = rtl8150_ioctl, |
900 | .ndo_start_xmit = rtl8150_start_xmit, | 880 | .ndo_start_xmit = rtl8150_start_xmit, |
901 | .ndo_tx_timeout = rtl8150_tx_timeout, | 881 | .ndo_tx_timeout = rtl8150_tx_timeout, |
902 | .ndo_set_rx_mode = rtl8150_set_multicast, | 882 | .ndo_set_rx_mode = rtl8150_set_multicast, |
903 | .ndo_set_mac_address = rtl8150_set_mac_address, | 883 | .ndo_set_mac_address = rtl8150_set_mac_address, |
904 | 884 | ||
@@ -929,7 +909,7 @@ static int rtl8150_probe(struct usb_interface *intf, | |||
929 | 909 | ||
930 | tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev); | 910 | tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev); |
931 | spin_lock_init(&dev->rx_pool_lock); | 911 | spin_lock_init(&dev->rx_pool_lock); |
932 | 912 | ||
933 | dev->udev = udev; | 913 | dev->udev = udev; |
934 | dev->netdev = netdev; | 914 | dev->netdev = netdev; |
935 | netdev->netdev_ops = &rtl8150_netdev_ops; | 915 | netdev->netdev_ops = &rtl8150_netdev_ops; |
@@ -947,7 +927,7 @@ static int rtl8150_probe(struct usb_interface *intf, | |||
947 | } | 927 | } |
948 | fill_skb_pool(dev); | 928 | fill_skb_pool(dev); |
949 | set_ethernet_addr(dev); | 929 | set_ethernet_addr(dev); |
950 | 930 | ||
951 | usb_set_intfdata(intf, dev); | 931 | usb_set_intfdata(intf, dev); |
952 | SET_NETDEV_DEV(netdev, &intf->dev); | 932 | SET_NETDEV_DEV(netdev, &intf->dev); |
953 | if (register_netdev(netdev) != 0) { | 933 | if (register_netdev(netdev) != 0) { |
@@ -989,6 +969,15 @@ static void rtl8150_disconnect(struct usb_interface *intf) | |||
989 | } | 969 | } |
990 | } | 970 | } |
991 | 971 | ||
972 | static struct usb_driver rtl8150_driver = { | ||
973 | .name = driver_name, | ||
974 | .probe = rtl8150_probe, | ||
975 | .disconnect = rtl8150_disconnect, | ||
976 | .id_table = rtl8150_table, | ||
977 | .suspend = rtl8150_suspend, | ||
978 | .resume = rtl8150_resume | ||
979 | }; | ||
980 | |||
992 | static int __init usb_rtl8150_init(void) | 981 | static int __init usb_rtl8150_init(void) |
993 | { | 982 | { |
994 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" | 983 | printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" |