Skip to contentSkip to conversation

net: Drop unnecessary device_set_name

PATCH In review Peng Fan (OSS) 2 participants 2 messages Jul 3 – Jul 7 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Drop unnecessary device_set_name

From: Peng Fan <[email protected]>

When device was created, it already has a name assigned. There is no need to alloc space for name and set it with same device name.

Cleanup the code to avoid unnecessary device_set_name.

---
 drivers/net/dm9000x.c    | 6 ------
 drivers/net/ftmac100.c   | 6 ------
 drivers/net/ks8851_mll.c | 6 ------
 drivers/net/smc911x.c    | 6 ------
 4 files changed, 24 deletions(-)
drivers/net/dm9000x.c +0 -6
index 9e17f0b9c28..53225979b66 100644
@@ -638,11 +638,6 @@ static int dm9000_read_rom_hwaddr(struct udevice *dev)
 	return !is_valid_ethaddr(pdata->enetaddr);
 }
 
-static int dm9000_bind(struct udevice *dev)
-{
-	return device_set_name(dev, dev->name);
-}
-
 static int dm9000_of_to_plat(struct udevice *dev)
 {
 	struct dm9000_priv *db = dev_get_priv(dev);
@@ -673,7 +668,6 @@ U_BOOT_DRIVER(dm9000) = {
 	.name		= "eth_dm9000",
 	.id		= UCLASS_ETH,
 	.of_match	= dm9000_ids,
-	.bind		= dm9000_bind,
 	.of_to_plat = dm9000_of_to_plat,
 	.ops		= &dm9000_ops,
 	.priv_auto	= sizeof(struct dm9000_priv),
drivers/net/ftmac100.c +0 -6
index fa0b3dbb6d1..d9826178e82 100644
@@ -429,11 +429,6 @@ static int ftmac100_remove(struct udevice *dev)
 	return 0;
 }
 
-static int ftmac100_bind(struct udevice *dev)
-{
-	return device_set_name(dev, dev->name);
-}
-
 static const struct eth_ops ftmac100_ops = {
 	.start	= ftmac100_start,
 	.send	= ftmac100_send,
@@ -451,7 +446,6 @@ U_BOOT_DRIVER(ftmac100) = {
 	.name	= "ftmac100",
 	.id	= UCLASS_ETH,
 	.of_match = ftmac100_ids,
-	.bind	= ftmac100_bind,
 	.of_to_plat = ftmac100_of_to_plat,
 	.probe	= ftmac100_probe,
 	.remove = ftmac100_remove,
drivers/net/ks8851_mll.c +0 -6
index 2c956154d09..c2f87d4222b 100644
@@ -571,11 +571,6 @@ static int ks8851_read_rom_hwaddr(struct udevice *dev)
 	return !is_valid_ethaddr(pdata->enetaddr);
 }
 
-static int ks8851_bind(struct udevice *dev)
-{
-	return device_set_name(dev, dev->name);
-}
-
 static int ks8851_probe(struct udevice *dev)
 {
 	struct ks_net *ks = dev_get_priv(dev);
@@ -615,7 +610,6 @@ U_BOOT_DRIVER(ks8851) = {
 	.name		= "eth_ks8851",
 	.id		= UCLASS_ETH,
 	.of_match	= ks8851_ids,
-	.bind		= ks8851_bind,
 	.of_to_plat = ks8851_of_to_plat,
 	.probe		= ks8851_probe,
 	.ops		= &ks8851_ops,
drivers/net/smc911x.c +0 -6
index f39ba40944f..2835eb45856 100644
@@ -431,11 +431,6 @@ static int smc911x_read_rom_hwaddr(struct udevice *dev)
 	return 0;
 }
 
-static int smc911x_bind(struct udevice *dev)
-{
-	return device_set_name(dev, dev->name);
-}
-
 static int smc911x_probe(struct udevice *dev)
 {
 	struct smc911x_priv *priv = dev_get_priv(dev);
@@ -487,7 +482,6 @@ U_BOOT_DRIVER(smc911x) = {
 	.name		= "eth_smc911x",
 	.id		= UCLASS_ETH,
 	.of_match	= smc911x_ids,
-	.bind		= smc911x_bind,
 	.of_to_plat = smc911x_of_to_plat,
 	.probe		= smc911x_probe,
 	.ops		= &smc911x_ops,

---
base-commit: e800cc67f5b6cb50a20f37c993ec1cd4063bdbd3
change-id: 20260703-net-a994f2cb348f

Best regards,

Signature · 1 line
Peng Fan <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

When device was created, it already has a name assigned. There is no need to alloc space for name and set it with same device name.

Cleanup the code to avoid unnecessary device_set_name.

Quoted 7 lines
---
 drivers/net/dm9000x.c    | 6 ------
 drivers/net/ftmac100.c   | 6 ------
 drivers/net/ks8851_mll.c | 6 ------
 drivers/net/smc911x.c    | 6 ------
 4 files changed, 24 deletions(-)

Thanks,

Signature · 1 line
Jerome