[PATCH] kernel: rename some b53 symbols to avoid conflict with upstream driver

Rafał Miłecki zajec5 at gmail.com
Thu Jul 29 22:47:38 PDT 2021


From: Rafał Miłecki <rafal at milecki.pl>

This fixes following error when trying to comppile both b53: swconfig
one and upstream one.

  LD      vmlinux.o
arm-openwrt-linux-muslgnueabi-ld: drivers/net/dsa/b53/b53_common.o: in function `b53_switch_alloc':
drivers/net/dsa/b53/b53_common.c:2598: multiple definition of `b53_switch_alloc'; drivers/net/phy/b53/b53_common.o:drivers/net/phy/b53/b53_common.c:1646: first defined here
arm-openwrt-linux-muslgnueabi-ld: drivers/net/dsa/b53/b53_common.o: in function `b53_switch_detect':
drivers/net/dsa/b53/b53_common.c:2638: multiple definition of `b53_switch_detect'; drivers/net/phy/b53/b53_common.o:drivers/net/phy/b53/b53_common.c:1663: first defined here
arm-openwrt-linux-muslgnueabi-ld: drivers/net/dsa/b53/b53_common.o: in function `b53_switch_register':
drivers/net/dsa/b53/b53_common.c:2705: multiple definition of `b53_switch_register'; drivers/net/phy/b53/b53_common.o:drivers/net/phy/b53/b53_common.c:1730: first defined here
make[5]: *** [Makefile:1178: vmlinux] Error 1

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../files/drivers/net/phy/b53/b53_common.c       | 16 ++++++++--------
 .../generic/files/drivers/net/phy/b53/b53_mdio.c |  6 +++---
 .../generic/files/drivers/net/phy/b53/b53_mmap.c |  4 ++--
 .../generic/files/drivers/net/phy/b53/b53_priv.h |  8 ++++----
 .../generic/files/drivers/net/phy/b53/b53_spi.c  |  4 ++--
 .../generic/files/drivers/net/phy/b53/b53_srab.c |  4 ++--
 6 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 030c5c86d6..b4898460bb 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -1617,8 +1617,8 @@ static int b53_switch_init(struct b53_device *dev)
 	return b53_switch_reset(dev);
 }
 
-struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
-				    void *priv)
+struct b53_device *b53sw_switch_alloc(struct device *base,
+				      struct b53_io_ops *ops, void *priv)
 {
 	struct b53_device *dev;
 
@@ -1633,9 +1633,9 @@ struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
 
 	return dev;
 }
-EXPORT_SYMBOL(b53_switch_alloc);
+EXPORT_SYMBOL(b53sw_switch_alloc);
 
-int b53_switch_detect(struct b53_device *dev)
+int b53sw_switch_detect(struct b53_device *dev)
 {
 	u32 id32;
 	u16 tmp;
@@ -1700,9 +1700,9 @@ int b53_switch_detect(struct b53_device *dev)
 		return b53_read8(dev, B53_MGMT_PAGE, B53_REV_ID,
 				 &dev->core_rev);
 }
-EXPORT_SYMBOL(b53_switch_detect);
+EXPORT_SYMBOL(b53sw_switch_detect);
 
-int b53_switch_register(struct b53_device *dev)
+int b53sw_switch_register(struct b53_device *dev)
 {
 	int ret;
 
@@ -1712,7 +1712,7 @@ int b53_switch_register(struct b53_device *dev)
 		dev->sw_dev.alias = dev->pdata->alias;
 	}
 
-	if (!dev->chip_id && b53_switch_detect(dev))
+	if (!dev->chip_id && b53sw_switch_detect(dev))
 		return -EINVAL;
 
 	ret = b53_switch_init(dev);
@@ -1723,7 +1723,7 @@ int b53_switch_register(struct b53_device *dev)
 
 	return register_switch(&dev->sw_dev, NULL);
 }
-EXPORT_SYMBOL(b53_switch_register);
+EXPORT_SYMBOL(b53sw_switch_register);
 
 MODULE_AUTHOR("Jonas Gorski <jogo at openwrt.org>");
 MODULE_DESCRIPTION("B53 switch library");
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
index 98cdbffe73..029c83f87c 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mdio.c
@@ -280,7 +280,7 @@ static int b53_phy_probe(struct phy_device *phydev)
 	if (phydev->mdio.addr != B53_PSEUDO_PHY && phydev->mdio.addr != 0)
 		return -ENODEV;
 
-	dev = b53_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus);
+	dev = b53sw_switch_alloc(&phydev->mdio.dev, &b53_mdio_ops, phydev->mdio.bus);
 	if (!dev)
 		return -ENOMEM;
 
@@ -290,7 +290,7 @@ static int b53_phy_probe(struct phy_device *phydev)
 	dev->pdata = NULL;
 	mutex_init(&dev->reg_mutex);
 
-	ret = b53_switch_detect(dev);
+	ret = b53sw_switch_detect(dev);
 	if (ret)
 		return ret;
 
@@ -302,7 +302,7 @@ static int b53_phy_probe(struct phy_device *phydev)
 
 	linkmode_copy(phydev->advertising, phydev->supported);
 
-	ret = b53_switch_register(dev);
+	ret = b53sw_switch_register(dev);
 	if (ret) {
 		dev_err(dev->dev, "failed to register switch: %i\n", ret);
 		return ret;
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
index ab1895e9b5..7bbe465b1c 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_mmap.c
@@ -205,7 +205,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
 	if (!pdata)
 		return -EINVAL;
 
-	dev = b53_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs);
+	dev = b53sw_switch_alloc(&pdev->dev, &b53_mmap_ops, pdata->regs);
 	if (!dev)
 		return -ENOMEM;
 
@@ -214,7 +214,7 @@ static int b53_mmap_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	return b53_switch_register(dev);
+	return b53sw_switch_register(dev);
 }
 
 static int b53_mmap_remove(struct platform_device *pdev)
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
index 37c17aeb25..40b6395c84 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_priv.h
@@ -183,12 +183,12 @@ static inline struct b53_device *sw_to_b53(struct switch_dev *sw)
 	return container_of(sw, struct b53_device, sw_dev);
 }
 
-struct b53_device *b53_switch_alloc(struct device *base, struct b53_io_ops *ops,
-				    void *priv);
+struct b53_device *b53sw_switch_alloc(struct device *base,
+				      struct b53_io_ops *ops, void *priv);
 
-int b53_switch_detect(struct b53_device *dev);
+int b53sw_switch_detect(struct b53_device *dev);
 
-int b53_switch_register(struct b53_device *dev);
+int b53sw_switch_register(struct b53_device *dev);
 
 static inline void b53_switch_remove(struct b53_device *dev)
 {
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
index efc8f7ee89..8c42dc6629 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_spi.c
@@ -288,14 +288,14 @@ static int b53_spi_probe(struct spi_device *spi)
 	struct b53_device *dev;
 	int ret;
 
-	dev = b53_switch_alloc(&spi->dev, &b53_spi_ops, spi);
+	dev = b53sw_switch_alloc(&spi->dev, &b53_spi_ops, spi);
 	if (!dev)
 		return -ENOMEM;
 
 	if (spi->dev.platform_data)
 		dev->pdata = spi->dev.platform_data;
 
-	ret = b53_switch_register(dev);
+	ret = b53sw_switch_register(dev);
 	if (ret)
 		return ret;
 
diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
index 012daa3a51..c6cb5e8e77 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_srab.c
@@ -342,7 +342,7 @@ static int b53_srab_probe(struct platform_device *pdev)
 	if (!pdata)
 		return -EINVAL;
 
-	dev = b53_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs);
+	dev = b53sw_switch_alloc(&pdev->dev, &b53_srab_ops, pdata->regs);
 	if (!dev)
 		return -ENOMEM;
 
@@ -351,7 +351,7 @@ static int b53_srab_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, dev);
 
-	return b53_switch_register(dev);
+	return b53sw_switch_register(dev);
 }
 
 static int b53_srab_remove(struct platform_device *pdev)
-- 
2.26.2




More information about the openwrt-devel mailing list