diff mbox series

[v2,4/4] net: txgbe: Utilize i2c-designware.h

Message ID 20240425002642.2053657-5-florian.fainelli@broadcom.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Define i2c_designware in a header file | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Florian Fainelli April 25, 2024, 12:26 a.m. UTC
Rather than open code the i2c_designware string, utilize the newly
defined constant in i2c-designware.h.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko April 25, 2024, 9:44 a.m. UTC | #1
On Wed, Apr 24, 2024 at 05:26:42PM -0700, Florian Fainelli wrote:
> Rather than open code the i2c_designware string, utilize the newly
> defined constant in i2c-designware.h.

...

> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
> @@ -8,6 +8,7 @@
>  #include <linux/clkdev.h>
>  #include <linux/i2c.h>
>  #include <linux/pci.h>
> +#include <linux/platform_data/i2c-designware.h>

Same comment, make this a separate group, it will be easier to see the quite
specific niche headers, that are not related to the generic libraries / or
subsystem-level ones.

>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
>  #include <linux/pcs/pcs-xpcs.h>

...

> -	snprintf(clk_name, sizeof(clk_name), "i2c_designware.%d",
> -		 pci_dev_id(pdev));
> +	snprintf(clk_name, sizeof(clk_name), "%s.%d",
> +		 I2C_DESIGNWARE_NAME, pci_dev_id(pdev));

Why do you make it %s? It was constant literal and is, no need to use %s.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index 93295916b1d2..7545aacc9c19 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -8,6 +8,7 @@ 
 #include <linux/clkdev.h>
 #include <linux/i2c.h>
 #include <linux/pci.h>
+#include <linux/platform_data/i2c-designware.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/pcs/pcs-xpcs.h>
@@ -571,8 +572,8 @@  static int txgbe_clock_register(struct txgbe *txgbe)
 	char clk_name[32];
 	struct clk *clk;
 
-	snprintf(clk_name, sizeof(clk_name), "i2c_designware.%d",
-		 pci_dev_id(pdev));
+	snprintf(clk_name, sizeof(clk_name), "%s.%d",
+		 I2C_DESIGNWARE_NAME, pci_dev_id(pdev));
 
 	clk = clk_register_fixed_rate(NULL, clk_name, NULL, 0, 156250000);
 	if (IS_ERR(clk))
@@ -634,7 +635,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 = I2C_DESIGNWARE_NAME;
 	info.id = pci_dev_id(pdev);
 
 	info.res = &DEFINE_RES_IRQ(pdev->irq);