diff options
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r-- | drivers/net/phy/phy_device.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 16ddc77313cb..ff109fe5af6b 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -57,6 +57,9 @@ extern void mdio_bus_exit(void); | |||
57 | static LIST_HEAD(phy_fixup_list); | 57 | static LIST_HEAD(phy_fixup_list); |
58 | static DEFINE_MUTEX(phy_fixup_lock); | 58 | static DEFINE_MUTEX(phy_fixup_lock); |
59 | 59 | ||
60 | static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | ||
61 | u32 flags, phy_interface_t interface); | ||
62 | |||
60 | /* | 63 | /* |
61 | * Creates a new phy_fixup and adds it to the list | 64 | * Creates a new phy_fixup and adds it to the list |
62 | * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) | 65 | * @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID) |
@@ -146,7 +149,8 @@ int phy_scan_fixups(struct phy_device *phydev) | |||
146 | } | 149 | } |
147 | EXPORT_SYMBOL(phy_scan_fixups); | 150 | EXPORT_SYMBOL(phy_scan_fixups); |
148 | 151 | ||
149 | struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | 152 | static struct phy_device* phy_device_create(struct mii_bus *bus, |
153 | int addr, int phy_id) | ||
150 | { | 154 | { |
151 | struct phy_device *dev; | 155 | struct phy_device *dev; |
152 | 156 | ||
@@ -193,7 +197,6 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id) | |||
193 | 197 | ||
194 | return dev; | 198 | return dev; |
195 | } | 199 | } |
196 | EXPORT_SYMBOL(phy_device_create); | ||
197 | 200 | ||
198 | /** | 201 | /** |
199 | * get_phy_id - reads the specified addr for its ID. | 202 | * get_phy_id - reads the specified addr for its ID. |
@@ -316,7 +319,7 @@ EXPORT_SYMBOL(phy_find_first); | |||
316 | * If you want to monitor your own link state, don't call | 319 | * If you want to monitor your own link state, don't call |
317 | * this function. | 320 | * this function. |
318 | */ | 321 | */ |
319 | void phy_prepare_link(struct phy_device *phydev, | 322 | static void phy_prepare_link(struct phy_device *phydev, |
320 | void (*handler)(struct net_device *)) | 323 | void (*handler)(struct net_device *)) |
321 | { | 324 | { |
322 | phydev->adjust_link = handler; | 325 | phydev->adjust_link = handler; |
@@ -435,15 +438,15 @@ int phy_init_hw(struct phy_device *phydev) | |||
435 | * the attaching device, and given a callback for link status | 438 | * the attaching device, and given a callback for link status |
436 | * change. The phy_device is returned to the attaching driver. | 439 | * change. The phy_device is returned to the attaching driver. |
437 | */ | 440 | */ |
438 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | 441 | static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
439 | u32 flags, phy_interface_t interface) | 442 | u32 flags, phy_interface_t interface) |
440 | { | 443 | { |
441 | struct device *d = &phydev->dev; | 444 | struct device *d = &phydev->dev; |
445 | int err; | ||
442 | 446 | ||
443 | /* Assume that if there is no driver, that it doesn't | 447 | /* Assume that if there is no driver, that it doesn't |
444 | * exist, and we should use the genphy driver. */ | 448 | * exist, and we should use the genphy driver. */ |
445 | if (NULL == d->driver) { | 449 | if (NULL == d->driver) { |
446 | int err; | ||
447 | d->driver = &genphy_driver.driver; | 450 | d->driver = &genphy_driver.driver; |
448 | 451 | ||
449 | err = d->driver->probe(d); | 452 | err = d->driver->probe(d); |
@@ -471,9 +474,12 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
471 | /* Do initial configuration here, now that | 474 | /* Do initial configuration here, now that |
472 | * we have certain key parameters | 475 | * we have certain key parameters |
473 | * (dev_flags and interface) */ | 476 | * (dev_flags and interface) */ |
474 | return phy_init_hw(phydev); | 477 | err = phy_init_hw(phydev); |
478 | if (err) | ||
479 | phy_detach(phydev); | ||
480 | |||
481 | return err; | ||
475 | } | 482 | } |
476 | EXPORT_SYMBOL(phy_attach_direct); | ||
477 | 483 | ||
478 | /** | 484 | /** |
479 | * phy_attach - attach a network device to a particular PHY device | 485 | * phy_attach - attach a network device to a particular PHY device |
@@ -532,7 +538,7 @@ EXPORT_SYMBOL(phy_detach); | |||
532 | /* Generic PHY support and helper functions */ | 538 | /* Generic PHY support and helper functions */ |
533 | 539 | ||
534 | /** | 540 | /** |
535 | * genphy_config_advert - sanitize and advertise auto-negotation parameters | 541 | * genphy_config_advert - sanitize and advertise auto-negotiation parameters |
536 | * @phydev: target phy_device struct | 542 | * @phydev: target phy_device struct |
537 | * | 543 | * |
538 | * Description: Writes MII_ADVERTISE with the appropriate values, | 544 | * Description: Writes MII_ADVERTISE with the appropriate values, |
@@ -540,7 +546,7 @@ EXPORT_SYMBOL(phy_detach); | |||
540 | * what is supported. Returns < 0 on error, 0 if the PHY's advertisement | 546 | * what is supported. Returns < 0 on error, 0 if the PHY's advertisement |
541 | * hasn't changed, and > 0 if it has changed. | 547 | * hasn't changed, and > 0 if it has changed. |
542 | */ | 548 | */ |
543 | int genphy_config_advert(struct phy_device *phydev) | 549 | static int genphy_config_advert(struct phy_device *phydev) |
544 | { | 550 | { |
545 | u32 advertise; | 551 | u32 advertise; |
546 | int oldadv, adv; | 552 | int oldadv, adv; |
@@ -605,7 +611,6 @@ int genphy_config_advert(struct phy_device *phydev) | |||
605 | 611 | ||
606 | return changed; | 612 | return changed; |
607 | } | 613 | } |
608 | EXPORT_SYMBOL(genphy_config_advert); | ||
609 | 614 | ||
610 | /** | 615 | /** |
611 | * genphy_setup_forced - configures/forces speed/duplex from @phydev | 616 | * genphy_setup_forced - configures/forces speed/duplex from @phydev |
@@ -615,7 +620,7 @@ EXPORT_SYMBOL(genphy_config_advert); | |||
615 | * to the values in phydev. Assumes that the values are valid. | 620 | * to the values in phydev. Assumes that the values are valid. |
616 | * Please see phy_sanitize_settings(). | 621 | * Please see phy_sanitize_settings(). |
617 | */ | 622 | */ |
618 | int genphy_setup_forced(struct phy_device *phydev) | 623 | static int genphy_setup_forced(struct phy_device *phydev) |
619 | { | 624 | { |
620 | int err; | 625 | int err; |
621 | int ctl = 0; | 626 | int ctl = 0; |
@@ -682,7 +687,7 @@ int genphy_config_aneg(struct phy_device *phydev) | |||
682 | return result; | 687 | return result; |
683 | 688 | ||
684 | if (result == 0) { | 689 | if (result == 0) { |
685 | /* Advertisment hasn't changed, but maybe aneg was never on to | 690 | /* Advertisement hasn't changed, but maybe aneg was never on to |
686 | * begin with? Or maybe phy was isolated? */ | 691 | * begin with? Or maybe phy was isolated? */ |
687 | int ctl = phy_read(phydev, MII_BMCR); | 692 | int ctl = phy_read(phydev, MII_BMCR); |
688 | 693 | ||