diff options
author | Petri Gynther <pgynther@google.com> | 2014-10-06 14:38:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-07 13:06:45 -0400 |
commit | fd2ef0ba3071c92ac6272ab22ea3f2b16d88a4eb (patch) | |
tree | e9d32e03bc599e39fb55b1b79269cbc08ae3ba20 /drivers/net/phy/fixed.c | |
parent | 02c0fc1b8f41e6e895d6573615ba8ff549b685d2 (diff) |
net: phy: adjust fixed_phy_register() return value
Adjust fixed_phy_register() to return struct phy_device *, so that
it becomes easy to use fixed PHYs without device tree support:
phydev = fixed_phy_register(PHY_POLL, &fixed_phy_status, NULL);
fixed_phy_set_link_update(phydev, fixed_phy_link_update);
phy_connect_direct(netdev, phydev, handler_fn, phy_interface);
This change is a prerequisite for modifying bcmgenet driver to work
without a device tree on Broadcom's MIPS-based 7xxx platforms.
Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/fixed.c')
-rw-r--r-- | drivers/net/phy/fixed.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 5b19fbbda6d4..47872caa0081 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c | |||
@@ -233,9 +233,9 @@ EXPORT_SYMBOL_GPL(fixed_phy_del); | |||
233 | static int phy_fixed_addr; | 233 | static int phy_fixed_addr; |
234 | static DEFINE_SPINLOCK(phy_fixed_addr_lock); | 234 | static DEFINE_SPINLOCK(phy_fixed_addr_lock); |
235 | 235 | ||
236 | int fixed_phy_register(unsigned int irq, | 236 | struct phy_device *fixed_phy_register(unsigned int irq, |
237 | struct fixed_phy_status *status, | 237 | struct fixed_phy_status *status, |
238 | struct device_node *np) | 238 | struct device_node *np) |
239 | { | 239 | { |
240 | struct fixed_mdio_bus *fmb = &platform_fmb; | 240 | struct fixed_mdio_bus *fmb = &platform_fmb; |
241 | struct phy_device *phy; | 241 | struct phy_device *phy; |
@@ -246,19 +246,19 @@ int fixed_phy_register(unsigned int irq, | |||
246 | spin_lock(&phy_fixed_addr_lock); | 246 | spin_lock(&phy_fixed_addr_lock); |
247 | if (phy_fixed_addr == PHY_MAX_ADDR) { | 247 | if (phy_fixed_addr == PHY_MAX_ADDR) { |
248 | spin_unlock(&phy_fixed_addr_lock); | 248 | spin_unlock(&phy_fixed_addr_lock); |
249 | return -ENOSPC; | 249 | return ERR_PTR(-ENOSPC); |
250 | } | 250 | } |
251 | phy_addr = phy_fixed_addr++; | 251 | phy_addr = phy_fixed_addr++; |
252 | spin_unlock(&phy_fixed_addr_lock); | 252 | spin_unlock(&phy_fixed_addr_lock); |
253 | 253 | ||
254 | ret = fixed_phy_add(PHY_POLL, phy_addr, status); | 254 | ret = fixed_phy_add(PHY_POLL, phy_addr, status); |
255 | if (ret < 0) | 255 | if (ret < 0) |
256 | return ret; | 256 | return ERR_PTR(ret); |
257 | 257 | ||
258 | phy = get_phy_device(fmb->mii_bus, phy_addr, false); | 258 | phy = get_phy_device(fmb->mii_bus, phy_addr, false); |
259 | if (!phy || IS_ERR(phy)) { | 259 | if (!phy || IS_ERR(phy)) { |
260 | fixed_phy_del(phy_addr); | 260 | fixed_phy_del(phy_addr); |
261 | return -EINVAL; | 261 | return ERR_PTR(-EINVAL); |
262 | } | 262 | } |
263 | 263 | ||
264 | of_node_get(np); | 264 | of_node_get(np); |
@@ -269,10 +269,10 @@ int fixed_phy_register(unsigned int irq, | |||
269 | phy_device_free(phy); | 269 | phy_device_free(phy); |
270 | of_node_put(np); | 270 | of_node_put(np); |
271 | fixed_phy_del(phy_addr); | 271 | fixed_phy_del(phy_addr); |
272 | return ret; | 272 | return ERR_PTR(ret); |
273 | } | 273 | } |
274 | 274 | ||
275 | return 0; | 275 | return phy; |
276 | } | 276 | } |
277 | 277 | ||
278 | static int __init fixed_mdio_bus_init(void) | 278 | static int __init fixed_mdio_bus_init(void) |