From: David S. Miller Date: Tue, 16 Aug 2011 06:10:39 +0000 (-0700) Subject: net: Fix sungem_phy sharing. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=19e2f6fe9601ca5c846b7163e6d6d00f87b34760;p=linux-beck.git net: Fix sungem_phy sharing. Since sungem_phy is used by multiple, unrelated, drivers make it build as a real module under drivers/net. depmod will pick up the symbol dependency and make sure sungem_phy.ko gets loaded any time sungem.ko or spider_net.ko is loaded. Tested-by: Stephen Rothwell Signed-off-by: David S. Miller --- diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 31d87929c1ad..ef6b6bee11da 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -186,6 +186,9 @@ config MII source "drivers/net/phy/Kconfig" +config SUNGEM_PHY + tristate + # # Ethernet # diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 9cb47bb3a816..c33009b49608 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -75,3 +75,5 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_CAIF) += caif/ + +obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o diff --git a/drivers/net/ethernet/sun/Makefile b/drivers/net/ethernet/sun/Makefile index 6e25dad6070e..1e620ff88eba 100644 --- a/drivers/net/ethernet/sun/Makefile +++ b/drivers/net/ethernet/sun/Makefile @@ -6,7 +6,6 @@ obj-$(CONFIG_HAPPYMEAL) += sunhme.o obj-$(CONFIG_SUNQE) += sunqe.o obj-$(CONFIG_SUNBMAC) += sunbmac.o obj-$(CONFIG_SUNGEM) += sungem.o -obj-$(CONFIG_SUNGEM_PHY) += sungem_phy.o obj-$(CONFIG_CASSINI) += cassini.o obj-$(CONFIG_SUNVNET) += sunvnet.o obj-$(CONFIG_NIU) += niu.o diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 0f13c5daf3fb..fb9885dd36da 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c @@ -1721,7 +1721,7 @@ static void gem_init_phy(struct gem *gp) if (gp->phy_type == phy_mii_mdio0 || gp->phy_type == phy_mii_mdio1) { /* Reset and detect MII PHY */ - mii_phy_probe(&gp->phy_mii, gp->mii_phy_addr); + sungem_phy_probe(&gp->phy_mii, gp->mii_phy_addr); /* Init PHY */ if (gp->phy_mii.def && gp->phy_mii.def->ops->init) diff --git a/drivers/net/ethernet/toshiba/Makefile b/drivers/net/ethernet/toshiba/Makefile index 71d861f55add..a5069008435b 100644 --- a/drivers/net/ethernet/toshiba/Makefile +++ b/drivers/net/ethernet/toshiba/Makefile @@ -6,5 +6,5 @@ obj-$(CONFIG_GELIC_NET) += ps3_gelic.o gelic_wireless-$(CONFIG_GELIC_WIRELESS) += ps3_gelic_wireless.o ps3_gelic-objs += ps3_gelic_net.o $(gelic_wireless-y) spidernet-y += spider_net.o spider_net_ethtool.o -obj-$(CONFIG_SPIDER_NET) += spidernet.o ethernet/sun/sungem_phy.o +obj-$(CONFIG_SPIDER_NET) += spidernet.o obj-$(CONFIG_TC35815) += tc35815.o diff --git a/drivers/net/ethernet/toshiba/spider_net.c b/drivers/net/ethernet/toshiba/spider_net.c index 1ff3491c8240..af345dbd1210 100644 --- a/drivers/net/ethernet/toshiba/spider_net.c +++ b/drivers/net/ethernet/toshiba/spider_net.c @@ -196,7 +196,7 @@ spider_net_setup_aneg(struct spider_net_card *card) if ((bmsr & BMSR_ESTATEN) && (estat & ESTATUS_1000_THALF)) advertise |= SUPPORTED_1000baseT_Half; - mii_phy_probe(phy, phy->mii_id); + sungem_phy_probe(phy, phy->mii_id); phy->def->ops->setup_aneg(phy, advertise); } @@ -2120,7 +2120,7 @@ spider_net_setup_phy(struct spider_net_card *card) unsigned short id; id = spider_net_read_phy(card->netdev, phy->mii_id, MII_BMSR); if (id != 0x0000 && id != 0xffff) { - if (!mii_phy_probe(phy, phy->mii_id)) { + if (!sungem_phy_probe(phy, phy->mii_id)) { pr_info("Found %s.\n", phy->def->name); break; } diff --git a/drivers/net/ethernet/sun/sungem_phy.c b/drivers/net/sungem_phy.c similarity index 99% rename from drivers/net/ethernet/sun/sungem_phy.c rename to drivers/net/sungem_phy.c index db99c229aa91..58f13adaa549 100644 --- a/drivers/net/ethernet/sun/sungem_phy.c +++ b/drivers/net/sungem_phy.c @@ -1156,7 +1156,7 @@ static struct mii_phy_def* mii_phy_table[] = { NULL }; -int mii_phy_probe(struct mii_phy *phy, int mii_id) +int sungem_phy_probe(struct mii_phy *phy, int mii_id) { int rc; u32 id; @@ -1195,6 +1195,5 @@ fail: return -ENODEV; } -EXPORT_SYMBOL(mii_phy_probe); +EXPORT_SYMBOL(sungem_phy_probe); MODULE_LICENSE("GPL"); - diff --git a/include/linux/sungem_phy.h b/include/linux/sungem_phy.h index af02f9479cbb..bd9be9f59d3a 100644 --- a/include/linux/sungem_phy.h +++ b/include/linux/sungem_phy.h @@ -61,7 +61,7 @@ struct mii_phy /* Pass in a struct mii_phy with dev, mdio_read and mdio_write * filled, the remaining fields will be filled on return */ -extern int mii_phy_probe(struct mii_phy *phy, int mii_id); +extern int sungem_phy_probe(struct mii_phy *phy, int mii_id); /* MII definitions missing from mii.h */