diff options
| -rw-r--r-- | drivers/net/phy/fixed.c | 16 | ||||
| -rw-r--r-- | drivers/of/of_mdio.c | 7 | ||||
| -rw-r--r-- | include/linux/phy_fixed.h | 14 |
3 files changed, 20 insertions, 17 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) |
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index a85d80012993..1bd43053b8c7 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
| @@ -286,6 +286,7 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
| 286 | struct device_node *fixed_link_node; | 286 | struct device_node *fixed_link_node; |
| 287 | const __be32 *fixed_link_prop; | 287 | const __be32 *fixed_link_prop; |
| 288 | int len; | 288 | int len; |
| 289 | struct phy_device *phy; | ||
| 289 | 290 | ||
| 290 | /* New binding */ | 291 | /* New binding */ |
| 291 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); | 292 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); |
| @@ -299,7 +300,8 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
| 299 | status.asym_pause = of_property_read_bool(fixed_link_node, | 300 | status.asym_pause = of_property_read_bool(fixed_link_node, |
| 300 | "asym-pause"); | 301 | "asym-pause"); |
| 301 | of_node_put(fixed_link_node); | 302 | of_node_put(fixed_link_node); |
| 302 | return fixed_phy_register(PHY_POLL, &status, np); | 303 | phy = fixed_phy_register(PHY_POLL, &status, np); |
| 304 | return IS_ERR(phy) ? PTR_ERR(phy) : 0; | ||
| 303 | } | 305 | } |
| 304 | 306 | ||
| 305 | /* Old binding */ | 307 | /* Old binding */ |
| @@ -310,7 +312,8 @@ int of_phy_register_fixed_link(struct device_node *np) | |||
| 310 | status.speed = be32_to_cpu(fixed_link_prop[2]); | 312 | status.speed = be32_to_cpu(fixed_link_prop[2]); |
| 311 | status.pause = be32_to_cpu(fixed_link_prop[3]); | 313 | status.pause = be32_to_cpu(fixed_link_prop[3]); |
| 312 | status.asym_pause = be32_to_cpu(fixed_link_prop[4]); | 314 | status.asym_pause = be32_to_cpu(fixed_link_prop[4]); |
| 313 | return fixed_phy_register(PHY_POLL, &status, np); | 315 | phy = fixed_phy_register(PHY_POLL, &status, np); |
| 316 | return IS_ERR(phy) ? PTR_ERR(phy) : 0; | ||
| 314 | } | 317 | } |
| 315 | 318 | ||
| 316 | return -ENODEV; | 319 | return -ENODEV; |
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h index 941138664c1d..f2ca1b459377 100644 --- a/include/linux/phy_fixed.h +++ b/include/linux/phy_fixed.h | |||
| @@ -14,9 +14,9 @@ struct device_node; | |||
| 14 | #ifdef CONFIG_FIXED_PHY | 14 | #ifdef CONFIG_FIXED_PHY |
| 15 | extern int fixed_phy_add(unsigned int irq, int phy_id, | 15 | extern int fixed_phy_add(unsigned int irq, int phy_id, |
| 16 | struct fixed_phy_status *status); | 16 | struct fixed_phy_status *status); |
| 17 | extern int fixed_phy_register(unsigned int irq, | 17 | extern struct phy_device *fixed_phy_register(unsigned int irq, |
| 18 | struct fixed_phy_status *status, | 18 | struct fixed_phy_status *status, |
| 19 | struct device_node *np); | 19 | struct device_node *np); |
| 20 | extern void fixed_phy_del(int phy_addr); | 20 | extern void fixed_phy_del(int phy_addr); |
| 21 | extern int fixed_phy_set_link_update(struct phy_device *phydev, | 21 | extern int fixed_phy_set_link_update(struct phy_device *phydev, |
| 22 | int (*link_update)(struct net_device *, | 22 | int (*link_update)(struct net_device *, |
| @@ -27,11 +27,11 @@ static inline int fixed_phy_add(unsigned int irq, int phy_id, | |||
| 27 | { | 27 | { |
| 28 | return -ENODEV; | 28 | return -ENODEV; |
| 29 | } | 29 | } |
| 30 | static inline int fixed_phy_register(unsigned int irq, | 30 | static inline struct phy_device *fixed_phy_register(unsigned int irq, |
| 31 | struct fixed_phy_status *status, | 31 | struct fixed_phy_status *status, |
| 32 | struct device_node *np) | 32 | struct device_node *np) |
| 33 | { | 33 | { |
| 34 | return -ENODEV; | 34 | return ERR_PTR(-ENODEV); |
| 35 | } | 35 | } |
| 36 | static inline int fixed_phy_del(int phy_addr) | 36 | static inline int fixed_phy_del(int phy_addr) |
| 37 | { | 37 | { |
