From 4f655dd24a718f86cc2517a887b9c0fd01511ba3 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Thu, 15 Nov 2012 10:31:43 +0100 Subject: [PATCH] phy: add phy_drivers_register to allow to register an array of drivers Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Signed-off-by: Sascha Hauer --- drivers/net/phy/phy.c | 12 ++++++++++++ include/linux/phy.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 88c3ff772..e1ecc27ae 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -581,3 +581,15 @@ int phy_driver_register(struct phy_driver *phydrv) return register_driver(&phydrv->drv); } + +int phy_drivers_register(struct phy_driver *new_driver, int n) +{ + int i, ret = 0; + + for (i = 0; i < n; i++) { + ret = phy_driver_register(new_driver + i); + if (ret) + return ret; + } + return ret; +} diff --git a/include/linux/phy.h b/include/linux/phy.h index 76f9edb23..4f14daef6 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -226,6 +226,7 @@ struct phy_driver { #define PHY_ANY_UID 0xffffffff int phy_driver_register(struct phy_driver *drv); +int phy_drivers_register(struct phy_driver *new_driver, int n); struct phy_device *get_phy_device(struct mii_bus *bus, int addr); int phy_init(void);