diff mbox series

[01/10] net: rtl8139: Factor out device name assignment

Message ID 20200509203444.821733-1-marek.vasut+renesas@gmail.com
State Accepted
Commit 9962dd25b1e228c5c8f0b33ef89c48093ca2a311
Headers show
Series [01/10] net: rtl8139: Factor out device name assignment | expand

Commit Message

Marek Vasut May 9, 2020, 8:34 p.m. UTC
Pull the device name setting into a separate function, as this
will be shared between DM/non-DM variants.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
Cc: Joe Hershberger <joe.hershberger at ni.com>
---
 drivers/net/rtl8139.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 1f08397291..adee618543 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -521,6 +521,11 @@  static int rtl8139_bcast_addr(struct eth_device *dev, const u8 *bcast_mac,
 	return 0;
 }
 
+static void rtl8139_name(char *str, int card_number)
+{
+	sprintf(str, "RTL8139#%u", card_number);
+}
+
 static struct pci_device_id supported[] = {
 	{ PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8139 },
 	{ PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_8139 },
@@ -553,7 +558,7 @@  int rtl8139_initialize(bd_t *bis)
 		}
 		memset(dev, 0, sizeof(*dev));
 
-		sprintf(dev->name, "RTL8139#%d", card_number);
+		rtl8139_name(dev->name, card_number);
 
 		dev->priv = (void *)devno;
 		dev->iobase = (int)bus_to_phys(iobase);