aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/pegasus.c
diff options
context:
space:
mode:
authorNicolas Kaiser <nikai@nikai.net>2010-06-26 02:58:54 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-30 13:26:16 -0400
commit5a9dbfe08ee17f0dc9ecff647eba3d04afa01200 (patch)
tree656ea2f5ab14d7f4a05230dc40fb37174b4aba38 /drivers/net/usb/pegasus.c
parentde847272149365363a6043a963a6f42fb91566e2 (diff)
usb: pegasus: fixed coding style issues
Fixed brace, static initialization, comment, whitespace and spacing coding style issues. Signed-off-by: Nicolas Kaiser <nikai@nikai.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/pegasus.c')
-rw-r--r--drivers/net/usb/pegasus.c125
1 files changed, 61 insertions, 64 deletions
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 974d17f0263e..6710f09346d6 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -21,11 +21,11 @@
21 * behaves. Pegasus II support added since this version. 21 * behaves. Pegasus II support added since this version.
22 * TODO: suppressing HCD warnings spewage on disconnect. 22 * TODO: suppressing HCD warnings spewage on disconnect.
23 * v0.4.13 Ethernet address is now set at probe(), not at open() 23 * v0.4.13 Ethernet address is now set at probe(), not at open()
24 * time as this seems to break dhcpd. 24 * time as this seems to break dhcpd.
25 * v0.5.0 branch to 2.5.x kernels 25 * v0.5.0 branch to 2.5.x kernels
26 * v0.5.1 ethtool support added 26 * v0.5.1 ethtool support added
27 * v0.5.5 rx socket buffers are in a pool and the their allocation 27 * v0.5.5 rx socket buffers are in a pool and the their allocation
28 * is out of the interrupt routine. 28 * is out of the interrupt routine.
29 */ 29 */
30 30
31#include <linux/sched.h> 31#include <linux/sched.h>
@@ -55,9 +55,9 @@ static const char driver_name[] = "pegasus";
55#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \ 55#define BMSR_MEDIA (BMSR_10HALF | BMSR_10FULL | BMSR_100HALF | \
56 BMSR_100FULL | BMSR_ANEGCAPABLE) 56 BMSR_100FULL | BMSR_ANEGCAPABLE)
57 57
58static int loopback = 0; 58static int loopback;
59static int mii_mode = 0; 59static int mii_mode;
60static char *devid=NULL; 60static char *devid;
61 61
62static struct usb_eth_dev usb_dev_id[] = { 62static struct usb_eth_dev usb_dev_id[] = {
63#define PEGASUS_DEV(pn, vid, pid, flags) \ 63#define PEGASUS_DEV(pn, vid, pid, flags) \
@@ -102,8 +102,8 @@ MODULE_PARM_DESC(devid, "The format is: 'DEV_name:VendorID:DeviceID:Flags'");
102 102
103/* use ethtool to change the level for any given device */ 103/* use ethtool to change the level for any given device */
104static int msg_level = -1; 104static int msg_level = -1;
105module_param (msg_level, int, 0); 105module_param(msg_level, int, 0);
106MODULE_PARM_DESC (msg_level, "Override default message level"); 106MODULE_PARM_DESC(msg_level, "Override default message level");
107 107
108MODULE_DEVICE_TABLE(usb, pegasus_ids); 108MODULE_DEVICE_TABLE(usb, pegasus_ids);
109static const struct net_device_ops pegasus_netdev_ops; 109static const struct net_device_ops pegasus_netdev_ops;
@@ -141,7 +141,7 @@ static void ctrl_callback(struct urb *urb)
141 wake_up(&pegasus->ctrl_wait); 141 wake_up(&pegasus->ctrl_wait);
142} 142}
143 143
144static int get_registers(pegasus_t * pegasus, __u16 indx, __u16 size, 144static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
145 void *data) 145 void *data)
146{ 146{
147 int ret; 147 int ret;
@@ -196,7 +196,7 @@ out:
196 return ret; 196 return ret;
197} 197}
198 198
199static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size, 199static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
200 void *data) 200 void *data)
201{ 201{
202 int ret; 202 int ret;
@@ -248,7 +248,7 @@ out:
248 return ret; 248 return ret;
249} 249}
250 250
251static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data) 251static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
252{ 252{
253 int ret; 253 int ret;
254 char *tmp; 254 char *tmp;
@@ -299,7 +299,7 @@ out:
299 return ret; 299 return ret;
300} 300}
301 301
302static int update_eth_regs_async(pegasus_t * pegasus) 302static int update_eth_regs_async(pegasus_t *pegasus)
303{ 303{
304 int ret; 304 int ret;
305 305
@@ -326,7 +326,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
326} 326}
327 327
328/* Returns 0 on success, error on failure */ 328/* Returns 0 on success, error on failure */
329static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) 329static int read_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 *regd)
330{ 330{
331 int i; 331 int i;
332 __u8 data[4] = { phy, 0, 0, indx }; 332 __u8 data[4] = { phy, 0, 0, indx };
@@ -334,7 +334,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
334 int ret; 334 int ret;
335 335
336 set_register(pegasus, PhyCtrl, 0); 336 set_register(pegasus, PhyCtrl, 0);
337 set_registers(pegasus, PhyAddr, sizeof (data), data); 337 set_registers(pegasus, PhyAddr, sizeof(data), data);
338 set_register(pegasus, PhyCtrl, (indx | PHY_READ)); 338 set_register(pegasus, PhyCtrl, (indx | PHY_READ));
339 for (i = 0; i < REG_TIMEOUT; i++) { 339 for (i = 0; i < REG_TIMEOUT; i++) {
340 ret = get_registers(pegasus, PhyCtrl, 1, data); 340 ret = get_registers(pegasus, PhyCtrl, 1, data);
@@ -366,7 +366,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int loc)
366 return (int)res; 366 return (int)res;
367} 367}
368 368
369static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd) 369static int write_mii_word(pegasus_t *pegasus, __u8 phy, __u8 indx, __u16 regd)
370{ 370{
371 int i; 371 int i;
372 __u8 data[4] = { phy, 0, 0, indx }; 372 __u8 data[4] = { phy, 0, 0, indx };
@@ -402,7 +402,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
402 write_mii_word(pegasus, phy_id, loc, val); 402 write_mii_word(pegasus, phy_id, loc, val);
403} 403}
404 404
405static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata) 405static int read_eprom_word(pegasus_t *pegasus, __u8 index, __u16 *retdata)
406{ 406{
407 int i; 407 int i;
408 __u8 tmp; 408 __u8 tmp;
@@ -433,7 +433,7 @@ fail:
433} 433}
434 434
435#ifdef PEGASUS_WRITE_EEPROM 435#ifdef PEGASUS_WRITE_EEPROM
436static inline void enable_eprom_write(pegasus_t * pegasus) 436static inline void enable_eprom_write(pegasus_t *pegasus)
437{ 437{
438 __u8 tmp; 438 __u8 tmp;
439 int ret; 439 int ret;
@@ -442,7 +442,7 @@ static inline void enable_eprom_write(pegasus_t * pegasus)
442 set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE); 442 set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
443} 443}
444 444
445static inline void disable_eprom_write(pegasus_t * pegasus) 445static inline void disable_eprom_write(pegasus_t *pegasus)
446{ 446{
447 __u8 tmp; 447 __u8 tmp;
448 int ret; 448 int ret;
@@ -452,7 +452,7 @@ static inline void disable_eprom_write(pegasus_t * pegasus)
452 set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE); 452 set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE);
453} 453}
454 454
455static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) 455static int write_eprom_word(pegasus_t *pegasus, __u8 index, __u16 data)
456{ 456{
457 int i; 457 int i;
458 __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE }; 458 __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
@@ -484,7 +484,7 @@ fail:
484} 484}
485#endif /* PEGASUS_WRITE_EEPROM */ 485#endif /* PEGASUS_WRITE_EEPROM */
486 486
487static inline void get_node_id(pegasus_t * pegasus, __u8 * id) 487static inline void get_node_id(pegasus_t *pegasus, __u8 *id)
488{ 488{
489 int i; 489 int i;
490 __u16 w16; 490 __u16 w16;
@@ -495,7 +495,7 @@ static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
495 } 495 }
496} 496}
497 497
498static void set_ethernet_addr(pegasus_t * pegasus) 498static void set_ethernet_addr(pegasus_t *pegasus)
499{ 499{
500 __u8 node_id[6]; 500 __u8 node_id[6];
501 501
@@ -503,12 +503,12 @@ static void set_ethernet_addr(pegasus_t * pegasus)
503 get_registers(pegasus, 0x10, sizeof(node_id), node_id); 503 get_registers(pegasus, 0x10, sizeof(node_id), node_id);
504 } else { 504 } else {
505 get_node_id(pegasus, node_id); 505 get_node_id(pegasus, node_id);
506 set_registers(pegasus, EthID, sizeof (node_id), node_id); 506 set_registers(pegasus, EthID, sizeof(node_id), node_id);
507 } 507 }
508 memcpy(pegasus->net->dev_addr, node_id, sizeof (node_id)); 508 memcpy(pegasus->net->dev_addr, node_id, sizeof(node_id));
509} 509}
510 510
511static inline int reset_mac(pegasus_t * pegasus) 511static inline int reset_mac(pegasus_t *pegasus)
512{ 512{
513 __u8 data = 0x8; 513 __u8 data = 0x8;
514 int i; 514 int i;
@@ -563,7 +563,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
563 data[1] = 0; 563 data[1] = 0;
564 data[2] = (loopback & 1) ? 0x09 : 0x01; 564 data[2] = (loopback & 1) ? 0x09 : 0x01;
565 565
566 memcpy(pegasus->eth_regs, data, sizeof (data)); 566 memcpy(pegasus->eth_regs, data, sizeof(data));
567 ret = set_registers(pegasus, EthCtrl0, 3, data); 567 ret = set_registers(pegasus, EthCtrl0, 3, data);
568 568
569 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS || 569 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
@@ -577,7 +577,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
577 return ret; 577 return ret;
578} 578}
579 579
580static void fill_skb_pool(pegasus_t * pegasus) 580static void fill_skb_pool(pegasus_t *pegasus)
581{ 581{
582 int i; 582 int i;
583 583
@@ -595,7 +595,7 @@ static void fill_skb_pool(pegasus_t * pegasus)
595 } 595 }
596} 596}
597 597
598static void free_skb_pool(pegasus_t * pegasus) 598static void free_skb_pool(pegasus_t *pegasus)
599{ 599{
600 int i; 600 int i;
601 601
@@ -667,11 +667,11 @@ static void read_bulk_callback(struct urb *urb)
667 netif_dbg(pegasus, rx_err, net, 667 netif_dbg(pegasus, rx_err, net,
668 "RX packet error %x\n", rx_status); 668 "RX packet error %x\n", rx_status);
669 pegasus->stats.rx_errors++; 669 pegasus->stats.rx_errors++;
670 if (rx_status & 0x06) // long or runt 670 if (rx_status & 0x06) /* long or runt */
671 pegasus->stats.rx_length_errors++; 671 pegasus->stats.rx_length_errors++;
672 if (rx_status & 0x08) 672 if (rx_status & 0x08)
673 pegasus->stats.rx_crc_errors++; 673 pegasus->stats.rx_crc_errors++;
674 if (rx_status & 0x10) // extra bits 674 if (rx_status & 0x10) /* extra bits */
675 pegasus->stats.rx_frame_errors++; 675 pegasus->stats.rx_frame_errors++;
676 goto goon; 676 goto goon;
677 } 677 }
@@ -748,9 +748,8 @@ static void rx_fixup(unsigned long data)
748 if (pegasus->flags & PEGASUS_RX_URB_FAIL) 748 if (pegasus->flags & PEGASUS_RX_URB_FAIL)
749 if (pegasus->rx_skb) 749 if (pegasus->rx_skb)
750 goto try_again; 750 goto try_again;
751 if (pegasus->rx_skb == NULL) { 751 if (pegasus->rx_skb == NULL)
752 pegasus->rx_skb = pull_skb(pegasus); 752 pegasus->rx_skb = pull_skb(pegasus);
753 }
754 if (pegasus->rx_skb == NULL) { 753 if (pegasus->rx_skb == NULL) {
755 netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n"); 754 netif_warn(pegasus, rx_err, pegasus->net, "low on memory\n");
756 tasklet_schedule(&pegasus->rx_tl); 755 tasklet_schedule(&pegasus->rx_tl);
@@ -835,7 +834,7 @@ static void intr_callback(struct urb *urb)
835 } 834 }
836 835
837 if (urb->actual_length >= 6) { 836 if (urb->actual_length >= 6) {
838 u8 * d = urb->transfer_buffer; 837 u8 *d = urb->transfer_buffer;
839 838
840 /* byte 0 == tx_status1, reg 2B */ 839 /* byte 0 == tx_status1, reg 2B */
841 if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL 840 if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
@@ -918,14 +917,14 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
918 return &((pegasus_t *) netdev_priv(dev))->stats; 917 return &((pegasus_t *) netdev_priv(dev))->stats;
919} 918}
920 919
921static inline void disable_net_traffic(pegasus_t * pegasus) 920static inline void disable_net_traffic(pegasus_t *pegasus)
922{ 921{
923 __le16 tmp = cpu_to_le16(0); 922 __le16 tmp = cpu_to_le16(0);
924 923
925 set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp); 924 set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
926} 925}
927 926
928static inline void get_interrupt_interval(pegasus_t * pegasus) 927static inline void get_interrupt_interval(pegasus_t *pegasus)
929{ 928{
930 u16 data; 929 u16 data;
931 u8 interval; 930 u8 interval;
@@ -961,7 +960,7 @@ static void set_carrier(struct net_device *net)
961 netif_carrier_off(net); 960 netif_carrier_off(net);
962} 961}
963 962
964static void free_all_urbs(pegasus_t * pegasus) 963static void free_all_urbs(pegasus_t *pegasus)
965{ 964{
966 usb_free_urb(pegasus->intr_urb); 965 usb_free_urb(pegasus->intr_urb);
967 usb_free_urb(pegasus->tx_urb); 966 usb_free_urb(pegasus->tx_urb);
@@ -969,7 +968,7 @@ static void free_all_urbs(pegasus_t * pegasus)
969 usb_free_urb(pegasus->ctrl_urb); 968 usb_free_urb(pegasus->ctrl_urb);
970} 969}
971 970
972static void unlink_all_urbs(pegasus_t * pegasus) 971static void unlink_all_urbs(pegasus_t *pegasus)
973{ 972{
974 usb_kill_urb(pegasus->intr_urb); 973 usb_kill_urb(pegasus->intr_urb);
975 usb_kill_urb(pegasus->tx_urb); 974 usb_kill_urb(pegasus->tx_urb);
@@ -977,12 +976,11 @@ static void unlink_all_urbs(pegasus_t * pegasus)
977 usb_kill_urb(pegasus->ctrl_urb); 976 usb_kill_urb(pegasus->ctrl_urb);
978} 977}
979 978
980static int alloc_urbs(pegasus_t * pegasus) 979static int alloc_urbs(pegasus_t *pegasus)
981{ 980{
982 pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); 981 pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
983 if (!pegasus->ctrl_urb) { 982 if (!pegasus->ctrl_urb)
984 return 0; 983 return 0;
985 }
986 pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL); 984 pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
987 if (!pegasus->rx_urb) { 985 if (!pegasus->rx_urb) {
988 usb_free_urb(pegasus->ctrl_urb); 986 usb_free_urb(pegasus->ctrl_urb);
@@ -1019,7 +1017,7 @@ static int pegasus_open(struct net_device *net)
1019 return -ENOMEM; 1017 return -ENOMEM;
1020 1018
1021 res = set_registers(pegasus, EthID, 6, net->dev_addr); 1019 res = set_registers(pegasus, EthID, 6, net->dev_addr);
1022 1020
1023 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb, 1021 usb_fill_bulk_urb(pegasus->rx_urb, pegasus->usb,
1024 usb_rcvbulkpipe(pegasus->usb, 1), 1022 usb_rcvbulkpipe(pegasus->usb, 1),
1025 pegasus->rx_skb->data, PEGASUS_MTU + 8, 1023 pegasus->rx_skb->data, PEGASUS_MTU + 8,
@@ -1033,7 +1031,7 @@ static int pegasus_open(struct net_device *net)
1033 1031
1034 usb_fill_int_urb(pegasus->intr_urb, pegasus->usb, 1032 usb_fill_int_urb(pegasus->intr_urb, pegasus->usb,
1035 usb_rcvintpipe(pegasus->usb, 3), 1033 usb_rcvintpipe(pegasus->usb, 3),
1036 pegasus->intr_buff, sizeof (pegasus->intr_buff), 1034 pegasus->intr_buff, sizeof(pegasus->intr_buff),
1037 intr_callback, pegasus, pegasus->intr_interval); 1035 intr_callback, pegasus, pegasus->intr_interval);
1038 if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) { 1036 if ((res = usb_submit_urb(pegasus->intr_urb, GFP_KERNEL))) {
1039 if (res == -ENODEV) 1037 if (res == -ENODEV)
@@ -1076,9 +1074,9 @@ static void pegasus_get_drvinfo(struct net_device *dev,
1076 struct ethtool_drvinfo *info) 1074 struct ethtool_drvinfo *info)
1077{ 1075{
1078 pegasus_t *pegasus = netdev_priv(dev); 1076 pegasus_t *pegasus = netdev_priv(dev);
1079 strncpy(info->driver, driver_name, sizeof (info->driver) - 1); 1077 strncpy(info->driver, driver_name, sizeof(info->driver) - 1);
1080 strncpy(info->version, DRIVER_VERSION, sizeof (info->version) - 1); 1078 strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
1081 usb_make_path(pegasus->usb, info->bus_info, sizeof (info->bus_info)); 1079 usb_make_path(pegasus->usb, info->bus_info, sizeof(info->bus_info));
1082} 1080}
1083 1081
1084/* also handles three patterns of some kind in hardware */ 1082/* also handles three patterns of some kind in hardware */
@@ -1098,7 +1096,7 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1098{ 1096{
1099 pegasus_t *pegasus = netdev_priv(dev); 1097 pegasus_t *pegasus = netdev_priv(dev);
1100 u8 reg78 = 0x04; 1098 u8 reg78 = 0x04;
1101 1099
1102 if (wol->wolopts & ~WOL_SUPPORTED) 1100 if (wol->wolopts & ~WOL_SUPPORTED)
1103 return -EINVAL; 1101 return -EINVAL;
1104 1102
@@ -1118,7 +1116,7 @@ pegasus_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
1118static inline void pegasus_reset_wol(struct net_device *dev) 1116static inline void pegasus_reset_wol(struct net_device *dev)
1119{ 1117{
1120 struct ethtool_wolinfo wol; 1118 struct ethtool_wolinfo wol;
1121 1119
1122 memset(&wol, 0, sizeof wol); 1120 memset(&wol, 0, sizeof wol);
1123 (void) pegasus_set_wol(dev, &wol); 1121 (void) pegasus_set_wol(dev, &wol);
1124} 1122}
@@ -1178,7 +1176,7 @@ static const struct ethtool_ops ops = {
1178 1176
1179static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd) 1177static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
1180{ 1178{
1181 __u16 *data = (__u16 *) & rq->ifr_ifru; 1179 __u16 *data = (__u16 *) &rq->ifr_ifru;
1182 pegasus_t *pegasus = netdev_priv(net); 1180 pegasus_t *pegasus = netdev_priv(net);
1183 int res; 1181 int res;
1184 1182
@@ -1223,7 +1221,7 @@ static void pegasus_set_multicast(struct net_device *net)
1223 ctrl_callback(pegasus->ctrl_urb); 1221 ctrl_callback(pegasus->ctrl_urb);
1224} 1222}
1225 1223
1226static __u8 mii_phy_probe(pegasus_t * pegasus) 1224static __u8 mii_phy_probe(pegasus_t *pegasus)
1227{ 1225{
1228 int i; 1226 int i;
1229 __u16 tmp; 1227 __u16 tmp;
@@ -1239,10 +1237,10 @@ static __u8 mii_phy_probe(pegasus_t * pegasus)
1239 return 0xff; 1237 return 0xff;
1240} 1238}
1241 1239
1242static inline void setup_pegasus_II(pegasus_t * pegasus) 1240static inline void setup_pegasus_II(pegasus_t *pegasus)
1243{ 1241{
1244 __u8 data = 0xa5; 1242 __u8 data = 0xa5;
1245 1243
1246 set_register(pegasus, Reg1d, 0); 1244 set_register(pegasus, Reg1d, 0);
1247 set_register(pegasus, Reg7b, 1); 1245 set_register(pegasus, Reg7b, 1);
1248 mdelay(100); 1246 mdelay(100);
@@ -1254,16 +1252,15 @@ static inline void setup_pegasus_II(pegasus_t * pegasus)
1254 set_register(pegasus, 0x83, data); 1252 set_register(pegasus, 0x83, data);
1255 get_registers(pegasus, 0x83, 1, &data); 1253 get_registers(pegasus, 0x83, 1, &data);
1256 1254
1257 if (data == 0xa5) { 1255 if (data == 0xa5)
1258 pegasus->chip = 0x8513; 1256 pegasus->chip = 0x8513;
1259 } else { 1257 else
1260 pegasus->chip = 0; 1258 pegasus->chip = 0;
1261 }
1262 1259
1263 set_register(pegasus, 0x80, 0xc0); 1260 set_register(pegasus, 0x80, 0xc0);
1264 set_register(pegasus, 0x83, 0xff); 1261 set_register(pegasus, 0x83, 0xff);
1265 set_register(pegasus, 0x84, 0x01); 1262 set_register(pegasus, 0x84, 0x01);
1266 1263
1267 if (pegasus->features & HAS_HOME_PNA && mii_mode) 1264 if (pegasus->features & HAS_HOME_PNA && mii_mode)
1268 set_register(pegasus, Reg81, 6); 1265 set_register(pegasus, Reg81, 6);
1269 else 1266 else
@@ -1272,7 +1269,7 @@ static inline void setup_pegasus_II(pegasus_t * pegasus)
1272 1269
1273 1270
1274static int pegasus_count; 1271static int pegasus_count;
1275static struct workqueue_struct *pegasus_workqueue = NULL; 1272static struct workqueue_struct *pegasus_workqueue;
1276#define CARRIER_CHECK_DELAY (2 * HZ) 1273#define CARRIER_CHECK_DELAY (2 * HZ)
1277 1274
1278static void check_carrier(struct work_struct *work) 1275static void check_carrier(struct work_struct *work)
@@ -1367,7 +1364,7 @@ static int pegasus_probe(struct usb_interface *intf,
1367 pegasus->mii.phy_id_mask = 0x1f; 1364 pegasus->mii.phy_id_mask = 0x1f;
1368 pegasus->mii.reg_num_mask = 0x1f; 1365 pegasus->mii.reg_num_mask = 0x1f;
1369 spin_lock_init(&pegasus->rx_pool_lock); 1366 spin_lock_init(&pegasus->rx_pool_lock);
1370 pegasus->msg_enable = netif_msg_init (msg_level, NETIF_MSG_DRV 1367 pegasus->msg_enable = netif_msg_init(msg_level, NETIF_MSG_DRV
1371 | NETIF_MSG_PROBE | NETIF_MSG_LINK); 1368 | NETIF_MSG_PROBE | NETIF_MSG_LINK);
1372 1369
1373 pegasus->features = usb_dev_id[dev_index].private; 1370 pegasus->features = usb_dev_id[dev_index].private;
@@ -1442,11 +1439,11 @@ static void pegasus_disconnect(struct usb_interface *intf)
1442 pegasus_dec_workqueue(); 1439 pegasus_dec_workqueue();
1443} 1440}
1444 1441
1445static int pegasus_suspend (struct usb_interface *intf, pm_message_t message) 1442static int pegasus_suspend(struct usb_interface *intf, pm_message_t message)
1446{ 1443{
1447 struct pegasus *pegasus = usb_get_intfdata(intf); 1444 struct pegasus *pegasus = usb_get_intfdata(intf);
1448 1445
1449 netif_device_detach (pegasus->net); 1446 netif_device_detach(pegasus->net);
1450 cancel_delayed_work(&pegasus->carrier_check); 1447 cancel_delayed_work(&pegasus->carrier_check);
1451 if (netif_running(pegasus->net)) { 1448 if (netif_running(pegasus->net)) {
1452 usb_kill_urb(pegasus->rx_urb); 1449 usb_kill_urb(pegasus->rx_urb);
@@ -1455,11 +1452,11 @@ static int pegasus_suspend (struct usb_interface *intf, pm_message_t message)
1455 return 0; 1452 return 0;
1456} 1453}
1457 1454
1458static int pegasus_resume (struct usb_interface *intf) 1455static int pegasus_resume(struct usb_interface *intf)
1459{ 1456{
1460 struct pegasus *pegasus = usb_get_intfdata(intf); 1457 struct pegasus *pegasus = usb_get_intfdata(intf);
1461 1458
1462 netif_device_attach (pegasus->net); 1459 netif_device_attach(pegasus->net);
1463 if (netif_running(pegasus->net)) { 1460 if (netif_running(pegasus->net)) {
1464 pegasus->rx_urb->status = 0; 1461 pegasus->rx_urb->status = 0;
1465 pegasus->rx_urb->actual_length = 0; 1462 pegasus->rx_urb->actual_length = 0;
@@ -1498,8 +1495,8 @@ static struct usb_driver pegasus_driver = {
1498 1495
1499static void __init parse_id(char *id) 1496static void __init parse_id(char *id)
1500{ 1497{
1501 unsigned int vendor_id=0, device_id=0, flags=0, i=0; 1498 unsigned int vendor_id = 0, device_id = 0, flags = 0, i = 0;
1502 char *token, *name=NULL; 1499 char *token, *name = NULL;
1503 1500
1504 if ((token = strsep(&id, ":")) != NULL) 1501 if ((token = strsep(&id, ":")) != NULL)
1505 name = token; 1502 name = token;
@@ -1510,14 +1507,14 @@ static void __init parse_id(char *id)
1510 device_id = simple_strtoul(token, NULL, 16); 1507 device_id = simple_strtoul(token, NULL, 16);
1511 flags = simple_strtoul(id, NULL, 16); 1508 flags = simple_strtoul(id, NULL, 16);
1512 pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n", 1509 pr_info("%s: new device %s, vendor ID 0x%04x, device ID 0x%04x, flags: 0x%x\n",
1513 driver_name, name, vendor_id, device_id, flags); 1510 driver_name, name, vendor_id, device_id, flags);
1514 1511
1515 if (vendor_id > 0x10000 || vendor_id == 0) 1512 if (vendor_id > 0x10000 || vendor_id == 0)
1516 return; 1513 return;
1517 if (device_id > 0x10000 || device_id == 0) 1514 if (device_id > 0x10000 || device_id == 0)
1518 return; 1515 return;
1519 1516
1520 for (i=0; usb_dev_id[i].name; i++); 1517 for (i = 0; usb_dev_id[i].name; i++);
1521 usb_dev_id[i].name = name; 1518 usb_dev_id[i].name = name;
1522 usb_dev_id[i].vendor = vendor_id; 1519 usb_dev_id[i].vendor = vendor_id;
1523 usb_dev_id[i].device = device_id; 1520 usb_dev_id[i].device = device_id;