aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2014-01-04 19:21:52 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-04 19:27:58 -0500
commite62a768f55ce8df1d092b5d93357dcc0894d8060 (patch)
tree87814ce767cf08427044f2a48b0ce1ad04632877 /drivers/net/phy/phy.c
parent4017b4d3212b7b9d979d7174cbe340c9acbb4666 (diff)
phy: kill useless local variables
A number of functions (especially in phy.c) has local variables that were hardly needed in the first place -- remove them. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c55
1 files changed, 16 insertions, 39 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 056706aa9fbc..8ea5b0d13316 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -67,12 +67,10 @@ EXPORT_SYMBOL(phy_print_status);
67 */ 67 */
68static int phy_clear_interrupt(struct phy_device *phydev) 68static int phy_clear_interrupt(struct phy_device *phydev)
69{ 69{
70 int err = 0;
71
72 if (phydev->drv->ack_interrupt) 70 if (phydev->drv->ack_interrupt)
73 err = phydev->drv->ack_interrupt(phydev); 71 return phydev->drv->ack_interrupt(phydev);
74 72
75 return err; 73 return 0;
76} 74}
77 75
78/** 76/**
@@ -84,13 +82,11 @@ static int phy_clear_interrupt(struct phy_device *phydev)
84 */ 82 */
85static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts) 83static int phy_config_interrupt(struct phy_device *phydev, u32 interrupts)
86{ 84{
87 int err = 0;
88
89 phydev->interrupts = interrupts; 85 phydev->interrupts = interrupts;
90 if (phydev->drv->config_intr) 86 if (phydev->drv->config_intr)
91 err = phydev->drv->config_intr(phydev); 87 return phydev->drv->config_intr(phydev);
92 88
93 return err; 89 return 0;
94} 90}
95 91
96 92
@@ -314,7 +310,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
314{ 310{
315 struct mii_ioctl_data *mii_data = if_mii(ifr); 311 struct mii_ioctl_data *mii_data = if_mii(ifr);
316 u16 val = mii_data->val_in; 312 u16 val = mii_data->val_in;
317 int ret = 0;
318 313
319 switch (cmd) { 314 switch (cmd) {
320 case SIOCGMIIPHY: 315 case SIOCGMIIPHY:
@@ -324,7 +319,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
324 case SIOCGMIIREG: 319 case SIOCGMIIREG:
325 mii_data->val_out = mdiobus_read(phydev->bus, mii_data->phy_id, 320 mii_data->val_out = mdiobus_read(phydev->bus, mii_data->phy_id,
326 mii_data->reg_num); 321 mii_data->reg_num);
327 break; 322 return 0;
328 323
329 case SIOCSMIIREG: 324 case SIOCSMIIREG:
330 if (mii_data->phy_id == phydev->addr) { 325 if (mii_data->phy_id == phydev->addr) {
@@ -358,8 +353,8 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
358 353
359 if (mii_data->reg_num == MII_BMCR && 354 if (mii_data->reg_num == MII_BMCR &&
360 val & BMCR_RESET) 355 val & BMCR_RESET)
361 ret = phy_init_hw(phydev); 356 return phy_init_hw(phydev);
362 break; 357 return 0;
363 358
364 case SIOCSHWTSTAMP: 359 case SIOCSHWTSTAMP:
365 if (phydev->drv->hwtstamp) 360 if (phydev->drv->hwtstamp)
@@ -369,8 +364,6 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
369 default: 364 default:
370 return -EOPNOTSUPP; 365 return -EOPNOTSUPP;
371 } 366 }
372
373 return ret;
374} 367}
375EXPORT_SYMBOL(phy_mii_ioctl); 368EXPORT_SYMBOL(phy_mii_ioctl);
376 369
@@ -557,8 +550,6 @@ phy_err:
557 */ 550 */
558int phy_start_interrupts(struct phy_device *phydev) 551int phy_start_interrupts(struct phy_device *phydev)
559{ 552{
560 int err = 0;
561
562 atomic_set(&phydev->irq_disable, 0); 553 atomic_set(&phydev->irq_disable, 0);
563 if (request_irq(phydev->irq, phy_interrupt, 554 if (request_irq(phydev->irq, phy_interrupt,
564 IRQF_SHARED, 555 IRQF_SHARED,
@@ -570,9 +561,7 @@ int phy_start_interrupts(struct phy_device *phydev)
570 return 0; 561 return 0;
571 } 562 }
572 563
573 err = phy_enable_interrupts(phydev); 564 return phy_enable_interrupts(phydev);
574
575 return err;
576} 565}
577EXPORT_SYMBOL(phy_start_interrupts); 566EXPORT_SYMBOL(phy_start_interrupts);
578 567
@@ -615,7 +604,6 @@ EXPORT_SYMBOL(phy_stop_interrupts);
615 */ 604 */
616void phy_change(struct work_struct *work) 605void phy_change(struct work_struct *work)
617{ 606{
618 int err;
619 struct phy_device *phydev = 607 struct phy_device *phydev =
620 container_of(work, struct phy_device, phy_queue); 608 container_of(work, struct phy_device, phy_queue);
621 609
@@ -623,9 +611,7 @@ void phy_change(struct work_struct *work)
623 !phydev->drv->did_interrupt(phydev)) 611 !phydev->drv->did_interrupt(phydev))
624 goto ignore; 612 goto ignore;
625 613
626 err = phy_disable_interrupts(phydev); 614 if (phy_disable_interrupts(phydev))
627
628 if (err)
629 goto phy_err; 615 goto phy_err;
630 616
631 mutex_lock(&phydev->lock); 617 mutex_lock(&phydev->lock);
@@ -637,10 +623,8 @@ void phy_change(struct work_struct *work)
637 enable_irq(phydev->irq); 623 enable_irq(phydev->irq);
638 624
639 /* Reenable interrupts */ 625 /* Reenable interrupts */
640 if (PHY_HALTED != phydev->state) 626 if (PHY_HALTED != phydev->state &&
641 err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED); 627 phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED))
642
643 if (err)
644 goto irq_enable_err; 628 goto irq_enable_err;
645 629
646 /* reschedule state queue work to run as soon as possible */ 630 /* reschedule state queue work to run as soon as possible */
@@ -953,14 +937,10 @@ static inline void mmd_phy_indirect(struct mii_bus *bus, int prtad, int devad,
953static int phy_read_mmd_indirect(struct mii_bus *bus, int prtad, int devad, 937static int phy_read_mmd_indirect(struct mii_bus *bus, int prtad, int devad,
954 int addr) 938 int addr)
955{ 939{
956 u32 ret;
957
958 mmd_phy_indirect(bus, prtad, devad, addr); 940 mmd_phy_indirect(bus, prtad, devad, addr);
959 941
960 /* Read the content of the MMD's selected register */ 942 /* Read the content of the MMD's selected register */
961 ret = bus->read(bus, addr, MII_MMD_DATA); 943 return bus->read(bus, addr, MII_MMD_DATA);
962
963 return ret;
964} 944}
965 945
966/** 946/**
@@ -1000,8 +980,6 @@ static void phy_write_mmd_indirect(struct mii_bus *bus, int prtad, int devad,
1000 */ 980 */
1001int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) 981int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1002{ 982{
1003 int ret = -EPROTONOSUPPORT;
1004
1005 /* According to 802.3az,the EEE is supported only in full duplex-mode. 983 /* According to 802.3az,the EEE is supported only in full duplex-mode.
1006 * Also EEE feature is active when core is operating with MII, GMII 984 * Also EEE feature is active when core is operating with MII, GMII
1007 * or RGMII. 985 * or RGMII.
@@ -1027,7 +1005,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1027 1005
1028 cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); 1006 cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap);
1029 if (!cap) 1007 if (!cap)
1030 goto eee_exit; 1008 return -EPROTONOSUPPORT;
1031 1009
1032 /* Check which link settings negotiated and verify it in 1010 /* Check which link settings negotiated and verify it in
1033 * the EEE advertising registers. 1011 * the EEE advertising registers.
@@ -1046,7 +1024,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1046 lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); 1024 lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp);
1047 idx = phy_find_setting(phydev->speed, phydev->duplex); 1025 idx = phy_find_setting(phydev->speed, phydev->duplex);
1048 if (!(lp & adv & settings[idx].setting)) 1026 if (!(lp & adv & settings[idx].setting))
1049 goto eee_exit; 1027 return -EPROTONOSUPPORT;
1050 1028
1051 if (clk_stop_enable) { 1029 if (clk_stop_enable) {
1052 /* Configure the PHY to stop receiving xMII 1030 /* Configure the PHY to stop receiving xMII
@@ -1063,11 +1041,10 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
1063 MDIO_MMD_PCS, phydev->addr, val); 1041 MDIO_MMD_PCS, phydev->addr, val);
1064 } 1042 }
1065 1043
1066 ret = 0; /* EEE supported */ 1044 return 0; /* EEE supported */
1067 } 1045 }
1068 1046
1069eee_exit: 1047 return -EPROTONOSUPPORT;
1070 return ret;
1071} 1048}
1072EXPORT_SYMBOL(phy_init_eee); 1049EXPORT_SYMBOL(phy_init_eee);
1073 1050