2024-03-21 05:50:31

by Duanqiang Wen

[permalink] [raw]
Subject: [PATCH net v4] net: txgbe: fix i2c dev name cannot match clkdev

txgbe clkdev shortened clk_name, so i2c_dev info_name
also need to shorten. Otherwise, i2c_dev cannot initialize
clock. And had "i2c_dw" string in a define.

Fixes: e30cef001da2 ("net: txgbe: fix clk_name exceed MAX_DEV_ID limits")
Signed-off-by: Duanqiang Wen <[email protected]>
---
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 6 +++---
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index 5b5d5e4310d1..3f61f161f1ed 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -571,8 +571,8 @@ static int txgbe_clock_register(struct txgbe *txgbe)
char clk_name[32];
struct clk *clk;

- snprintf(clk_name, sizeof(clk_name), "i2c_dw.%d",
- pci_dev_id(pdev));
+ snprintf(clk_name, sizeof(clk_name), "%s.%d",
+ TXGBE_I2C_CLK_DEV_NAME, pci_dev_id(pdev));

clk = clk_register_fixed_rate(NULL, clk_name, NULL, 0, 156250000);
if (IS_ERR(clk))
@@ -634,7 +634,7 @@ static int txgbe_i2c_register(struct txgbe *txgbe)

info.parent = &pdev->dev;
info.fwnode = software_node_fwnode(txgbe->nodes.group[SWNODE_I2C]);
- info.name = "i2c_designware";
+ info.name = TXGBE_I2C_CLK_DEV_NAME;
info.id = pci_dev_id(pdev);

info.res = &DEFINE_RES_IRQ(pdev->irq);
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
index 1b4ff50d5857..de33313c475f 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
@@ -129,6 +129,8 @@

#define TXGBE_MAX_EITR GENMASK(11, 3)

+#define TXGBE_I2C_CLK_DEV_NAME "i2c_dw"
+
extern char txgbe_driver_name[];

void txgbe_down(struct wx *wx);
--
2.27.0



2024-03-21 10:56:20

by Jiri Pirko

[permalink] [raw]
Subject: Re: [PATCH net v4] net: txgbe: fix i2c dev name cannot match clkdev

Thu, Mar 21, 2024 at 06:47:42AM CET, [email protected] wrote:
>txgbe clkdev shortened clk_name, so i2c_dev info_name
>also need to shorten. Otherwise, i2c_dev cannot initialize
>clock. And had "i2c_dw" string in a define.
>
>Fixes: e30cef001da2 ("net: txgbe: fix clk_name exceed MAX_DEV_ID limits")
>Signed-off-by: Duanqiang Wen <[email protected]>

As Jakub asked you, could you please take a break and read
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
?
Thanks!

2024-03-21 13:07:04

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH net v4] net: txgbe: fix i2c dev name cannot match clkdev



On 3/20/2024 10:47 PM, Duanqiang Wen wrote:
> txgbe clkdev shortened clk_name, so i2c_dev info_name
> also need to shorten. Otherwise, i2c_dev cannot initialize
> clock. And had "i2c_dw" string in a define.
>
> Fixes: e30cef001da2 ("net: txgbe: fix clk_name exceed MAX_DEV_ID limits")
> Signed-off-by: Duanqiang Wen <[email protected]>

When Jiri suggested to use a define, I did not read it as meaning a
define local within the driver, but rather a define that would span
beyond you driver that would match what is expected to be used by
drivers/i2c/busses/i2c-designware-pcidrv.c.

As a matter of fact, there are quite a few drivers that expect to use
this driver name:

git grep i2c_designware *
drivers/i2c/busses/i2c-designware-pcidrv.c:MODULE_ALIAS("i2c_designware-pci");
drivers/i2c/busses/i2c-designware-platdrv.c:MODULE_ALIAS("platform:i2c_designware");
drivers/i2c/busses/i2c-designware-platdrv.c: .name =
"i2c_designware",
drivers/mfd/intel-lpss.c: .name = "i2c_designware",
drivers/mfd/intel_quark_i2c_gpio.c:#define
INTEL_QUARK_I2C_CONTROLLER_CLK "i2c_designware.0"
drivers/mfd/intel_quark_i2c_gpio.c: .name = "i2c_designware",
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c: snprintf(clk_name,
sizeof(clk_name), "i2c_designware.%d",
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c: info.name =
"i2c_designware";

so they should all be covered by using a define under
include/linux/i2c-designware.h.

--
Florian