aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/net
diff options
context:
space:
mode:
authorPetko Manolov <petkan@nucleusys.com>2005-11-15 02:48:23 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 16:48:30 -0500
commit4a1728a28a193aa388900714bbb1f375e08a6d8e (patch)
tree52b5728b5377ef4be8aacabd1ae64a66770603e0 /drivers/usb/net
parent87c4252a35310fdbb2aabb880a39b83f83cadf62 (diff)
[PATCH] USB: usb-net: removes redundant return
removes all redundant collecting of the return value from get/set_registers() and suchlike. can't remember who put all of those some time ago, but they doesn't make any sense to me. where needed only a few references remained; Signed-off-by: Petko Manolov <petkan@nucleusys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/net')
-rw-r--r--drivers/usb/net/pegasus.c106
1 files changed, 51 insertions, 55 deletions
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
index 683e3df5d607..d8c7adabf201 100644
--- a/drivers/usb/net/pegasus.c
+++ b/drivers/usb/net/pegasus.c
@@ -45,7 +45,7 @@
45/* 45/*
46 * Version Information 46 * Version Information
47 */ 47 */
48#define DRIVER_VERSION "v0.6.12 (2005/01/13)" 48#define DRIVER_VERSION "v0.6.13 (2005/11/13)"
49#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>" 49#define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
50#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver" 50#define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
51 51
@@ -113,7 +113,7 @@ static void ctrl_callback(struct urb *urb, struct pt_regs *regs)
113 break; 113 break;
114 default: 114 default:
115 if (netif_msg_drv(pegasus)) 115 if (netif_msg_drv(pegasus))
116 dev_err(&pegasus->intf->dev, "%s, status %d\n", 116 dev_dbg(&pegasus->intf->dev, "%s, status %d\n",
117 __FUNCTION__, urb->status); 117 __FUNCTION__, urb->status);
118 } 118 }
119 pegasus->flags &= ~ETH_REGS_CHANGED; 119 pegasus->flags &= ~ETH_REGS_CHANGED;
@@ -308,9 +308,9 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
308 __le16 regdi; 308 __le16 regdi;
309 int ret; 309 int ret;
310 310
311 ret = set_register(pegasus, PhyCtrl, 0); 311 set_register(pegasus, PhyCtrl, 0);
312 ret = set_registers(pegasus, PhyAddr, sizeof (data), data); 312 set_registers(pegasus, PhyAddr, sizeof (data), data);
313 ret = set_register(pegasus, PhyCtrl, (indx | PHY_READ)); 313 set_register(pegasus, PhyCtrl, (indx | PHY_READ));
314 for (i = 0; i < REG_TIMEOUT; i++) { 314 for (i = 0; i < REG_TIMEOUT; i++) {
315 ret = get_registers(pegasus, PhyCtrl, 1, data); 315 ret = get_registers(pegasus, PhyCtrl, 1, data);
316 if (data[0] & PHY_DONE) 316 if (data[0] & PHY_DONE)
@@ -319,12 +319,12 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
319 if (i < REG_TIMEOUT) { 319 if (i < REG_TIMEOUT) {
320 ret = get_registers(pegasus, PhyData, 2, &regdi); 320 ret = get_registers(pegasus, PhyData, 2, &regdi);
321 *regd = le16_to_cpu(regdi); 321 *regd = le16_to_cpu(regdi);
322 return 1; 322 return ret;
323 } 323 }
324 if (netif_msg_drv(pegasus)) 324 if (netif_msg_drv(pegasus))
325 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 325 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
326 326
327 return 0; 327 return ret;
328} 328}
329 329
330static int mdio_read(struct net_device *dev, int phy_id, int loc) 330static int mdio_read(struct net_device *dev, int phy_id, int loc)
@@ -344,20 +344,20 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
344 344
345 data[1] = (u8) regd; 345 data[1] = (u8) regd;
346 data[2] = (u8) (regd >> 8); 346 data[2] = (u8) (regd >> 8);
347 ret = set_register(pegasus, PhyCtrl, 0); 347 set_register(pegasus, PhyCtrl, 0);
348 ret = set_registers(pegasus, PhyAddr, sizeof(data), data); 348 set_registers(pegasus, PhyAddr, sizeof(data), data);
349 ret = set_register(pegasus, PhyCtrl, (indx | PHY_WRITE)); 349 set_register(pegasus, PhyCtrl, (indx | PHY_WRITE));
350 for (i = 0; i < REG_TIMEOUT; i++) { 350 for (i = 0; i < REG_TIMEOUT; i++) {
351 ret = get_registers(pegasus, PhyCtrl, 1, data); 351 ret = get_registers(pegasus, PhyCtrl, 1, data);
352 if (data[0] & PHY_DONE) 352 if (data[0] & PHY_DONE)
353 break; 353 break;
354 } 354 }
355 if (i < REG_TIMEOUT) 355 if (i < REG_TIMEOUT)
356 return 0; 356 return ret;
357 357
358 if (netif_msg_drv(pegasus)) 358 if (netif_msg_drv(pegasus))
359 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 359 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
360 return 1; 360 return -ETIMEDOUT;
361} 361}
362 362
363static void mdio_write(struct net_device *dev, int phy_id, int loc, int val) 363static void mdio_write(struct net_device *dev, int phy_id, int loc, int val)
@@ -374,9 +374,9 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
374 __le16 retdatai; 374 __le16 retdatai;
375 int ret; 375 int ret;
376 376
377 ret = set_register(pegasus, EpromCtrl, 0); 377 set_register(pegasus, EpromCtrl, 0);
378 ret = set_register(pegasus, EpromOffset, index); 378 set_register(pegasus, EpromOffset, index);
379 ret = set_register(pegasus, EpromCtrl, EPROM_READ); 379 set_register(pegasus, EpromCtrl, EPROM_READ);
380 380
381 for (i = 0; i < REG_TIMEOUT; i++) { 381 for (i = 0; i < REG_TIMEOUT; i++) {
382 ret = get_registers(pegasus, EpromCtrl, 1, &tmp); 382 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
@@ -386,12 +386,12 @@ static int read_eprom_word(pegasus_t * pegasus, __u8 index, __u16 * retdata)
386 if (i < REG_TIMEOUT) { 386 if (i < REG_TIMEOUT) {
387 ret = get_registers(pegasus, EpromData, 2, &retdatai); 387 ret = get_registers(pegasus, EpromData, 2, &retdatai);
388 *retdata = le16_to_cpu(retdatai); 388 *retdata = le16_to_cpu(retdatai);
389 return 0; 389 return ret;
390 } 390 }
391 391
392 if (netif_msg_drv(pegasus)) 392 if (netif_msg_drv(pegasus))
393 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 393 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
394 return -1; 394 return -ETIMEDOUT;
395} 395}
396 396
397#ifdef PEGASUS_WRITE_EEPROM 397#ifdef PEGASUS_WRITE_EEPROM
@@ -400,8 +400,8 @@ static inline void enable_eprom_write(pegasus_t * pegasus)
400 __u8 tmp; 400 __u8 tmp;
401 int ret; 401 int ret;
402 402
403 ret = get_registers(pegasus, EthCtrl2, 1, &tmp); 403 get_registers(pegasus, EthCtrl2, 1, &tmp);
404 ret = set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE); 404 set_register(pegasus, EthCtrl2, tmp | EPROM_WR_ENABLE);
405} 405}
406 406
407static inline void disable_eprom_write(pegasus_t * pegasus) 407static inline void disable_eprom_write(pegasus_t * pegasus)
@@ -409,9 +409,9 @@ static inline void disable_eprom_write(pegasus_t * pegasus)
409 __u8 tmp; 409 __u8 tmp;
410 int ret; 410 int ret;
411 411
412 ret = get_registers(pegasus, EthCtrl2, 1, &tmp); 412 get_registers(pegasus, EthCtrl2, 1, &tmp);
413 ret = set_register(pegasus, EpromCtrl, 0); 413 set_register(pegasus, EpromCtrl, 0);
414 ret = set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE); 414 set_register(pegasus, EthCtrl2, tmp & ~EPROM_WR_ENABLE);
415} 415}
416 416
417static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data) 417static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
@@ -420,11 +420,11 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
420 __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE }; 420 __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
421 int ret; 421 int ret;
422 422
423 ret = set_registers(pegasus, EpromOffset, 4, d); 423 set_registers(pegasus, EpromOffset, 4, d);
424 enable_eprom_write(pegasus); 424 enable_eprom_write(pegasus);
425 ret = set_register(pegasus, EpromOffset, index); 425 set_register(pegasus, EpromOffset, index);
426 ret = set_registers(pegasus, EpromData, 2, &data); 426 set_registers(pegasus, EpromData, 2, &data);
427 ret = set_register(pegasus, EpromCtrl, EPROM_WRITE); 427 set_register(pegasus, EpromCtrl, EPROM_WRITE);
428 428
429 for (i = 0; i < REG_TIMEOUT; i++) { 429 for (i = 0; i < REG_TIMEOUT; i++) {
430 ret = get_registers(pegasus, EpromCtrl, 1, &tmp); 430 ret = get_registers(pegasus, EpromCtrl, 1, &tmp);
@@ -433,10 +433,10 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
433 } 433 }
434 disable_eprom_write(pegasus); 434 disable_eprom_write(pegasus);
435 if (i < REG_TIMEOUT) 435 if (i < REG_TIMEOUT)
436 return 0; 436 return ret;
437 if (netif_msg_drv(pegasus)) 437 if (netif_msg_drv(pegasus))
438 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__); 438 dev_warn(&pegasus->intf->dev, "fail %s\n", __FUNCTION__);
439 return -1; 439 return -ETIMEDOUT;
440} 440}
441#endif /* PEGASUS_WRITE_EEPROM */ 441#endif /* PEGASUS_WRITE_EEPROM */
442 442
@@ -454,10 +454,9 @@ static inline void get_node_id(pegasus_t * pegasus, __u8 * id)
454static void set_ethernet_addr(pegasus_t * pegasus) 454static void set_ethernet_addr(pegasus_t * pegasus)
455{ 455{
456 __u8 node_id[6]; 456 __u8 node_id[6];
457 int ret;
458 457
459 get_node_id(pegasus, node_id); 458 get_node_id(pegasus, node_id);
460 ret = set_registers(pegasus, EthID, sizeof (node_id), node_id); 459 set_registers(pegasus, EthID, sizeof (node_id), node_id);
461 memcpy(pegasus->net->dev_addr, node_id, sizeof (node_id)); 460 memcpy(pegasus->net->dev_addr, node_id, sizeof (node_id));
462} 461}
463 462
@@ -465,30 +464,29 @@ static inline int reset_mac(pegasus_t * pegasus)
465{ 464{
466 __u8 data = 0x8; 465 __u8 data = 0x8;
467 int i; 466 int i;
468 int ret;
469 467
470 ret = set_register(pegasus, EthCtrl1, data); 468 set_register(pegasus, EthCtrl1, data);
471 for (i = 0; i < REG_TIMEOUT; i++) { 469 for (i = 0; i < REG_TIMEOUT; i++) {
472 ret = get_registers(pegasus, EthCtrl1, 1, &data); 470 get_registers(pegasus, EthCtrl1, 1, &data);
473 if (~data & 0x08) { 471 if (~data & 0x08) {
474 if (loopback & 1) 472 if (loopback & 1)
475 break; 473 break;
476 if (mii_mode && (pegasus->features & HAS_HOME_PNA)) 474 if (mii_mode && (pegasus->features & HAS_HOME_PNA))
477 ret = set_register(pegasus, Gpio1, 0x34); 475 set_register(pegasus, Gpio1, 0x34);
478 else 476 else
479 ret = set_register(pegasus, Gpio1, 0x26); 477 set_register(pegasus, Gpio1, 0x26);
480 ret = set_register(pegasus, Gpio0, pegasus->features); 478 set_register(pegasus, Gpio0, pegasus->features);
481 ret = set_register(pegasus, Gpio0, DEFAULT_GPIO_SET); 479 set_register(pegasus, Gpio0, DEFAULT_GPIO_SET);
482 break; 480 break;
483 } 481 }
484 } 482 }
485 if (i == REG_TIMEOUT) 483 if (i == REG_TIMEOUT)
486 return 1; 484 return -ETIMEDOUT;
487 485
488 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS || 486 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
489 usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) { 487 usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
490 ret = set_register(pegasus, Gpio0, 0x24); 488 set_register(pegasus, Gpio0, 0x24);
491 ret = set_register(pegasus, Gpio0, 0x26); 489 set_register(pegasus, Gpio0, 0x26);
492 } 490 }
493 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_ELCON) { 491 if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_ELCON) {
494 __u16 auxmode; 492 __u16 auxmode;
@@ -527,7 +525,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
527 write_mii_word(pegasus, 0, 0x1b, auxmode | 4); 525 write_mii_word(pegasus, 0, 0x1b, auxmode | 4);
528 } 526 }
529 527
530 return 0; 528 return ret;
531} 529}
532 530
533static void fill_skb_pool(pegasus_t * pegasus) 531static void fill_skb_pool(pegasus_t * pegasus)
@@ -881,9 +879,8 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
881static inline void disable_net_traffic(pegasus_t * pegasus) 879static inline void disable_net_traffic(pegasus_t * pegasus)
882{ 880{
883 int tmp = 0; 881 int tmp = 0;
884 int ret;
885 882
886 ret = set_registers(pegasus, EthCtrl0, 2, &tmp); 883 set_registers(pegasus, EthCtrl0, 2, &tmp);
887} 884}
888 885
889static inline void get_interrupt_interval(pegasus_t * pegasus) 886static inline void get_interrupt_interval(pegasus_t * pegasus)
@@ -1206,18 +1203,17 @@ static __u8 mii_phy_probe(pegasus_t * pegasus)
1206static inline void setup_pegasus_II(pegasus_t * pegasus) 1203static inline void setup_pegasus_II(pegasus_t * pegasus)
1207{ 1204{
1208 __u8 data = 0xa5; 1205 __u8 data = 0xa5;
1209 int ret;
1210 1206
1211 ret = set_register(pegasus, Reg1d, 0); 1207 set_register(pegasus, Reg1d, 0);
1212 ret = set_register(pegasus, Reg7b, 1); 1208 set_register(pegasus, Reg7b, 1);
1213 mdelay(100); 1209 mdelay(100);
1214 if ((pegasus->features & HAS_HOME_PNA) && mii_mode) 1210 if ((pegasus->features & HAS_HOME_PNA) && mii_mode)
1215 ret = set_register(pegasus, Reg7b, 0); 1211 set_register(pegasus, Reg7b, 0);
1216 else 1212 else
1217 ret = set_register(pegasus, Reg7b, 2); 1213 set_register(pegasus, Reg7b, 2);
1218 1214
1219 ret = set_register(pegasus, 0x83, data); 1215 set_register(pegasus, 0x83, data);
1220 ret = get_registers(pegasus, 0x83, 1, &data); 1216 get_registers(pegasus, 0x83, 1, &data);
1221 1217
1222 if (data == 0xa5) { 1218 if (data == 0xa5) {
1223 pegasus->chip = 0x8513; 1219 pegasus->chip = 0x8513;
@@ -1225,14 +1221,14 @@ static inline void setup_pegasus_II(pegasus_t * pegasus)
1225 pegasus->chip = 0; 1221 pegasus->chip = 0;
1226 } 1222 }
1227 1223
1228 ret = set_register(pegasus, 0x80, 0xc0); 1224 set_register(pegasus, 0x80, 0xc0);
1229 ret = set_register(pegasus, 0x83, 0xff); 1225 set_register(pegasus, 0x83, 0xff);
1230 ret = set_register(pegasus, 0x84, 0x01); 1226 set_register(pegasus, 0x84, 0x01);
1231 1227
1232 if (pegasus->features & HAS_HOME_PNA && mii_mode) 1228 if (pegasus->features & HAS_HOME_PNA && mii_mode)
1233 ret = set_register(pegasus, Reg81, 6); 1229 set_register(pegasus, Reg81, 6);
1234 else 1230 else
1235 ret = set_register(pegasus, Reg81, 2); 1231 set_register(pegasus, Reg81, 2);
1236} 1232}
1237 1233
1238 1234