]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: rtl8139: Factor out device name assignment
authorMarek Vasut <marek.vasut@gmail.com>
Sat, 9 May 2020 20:34:35 +0000 (22:34 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 12 Jun 2020 17:17:23 +0000 (13:17 -0400)
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@gmail.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/rtl8139.c

index 0daeefa489b1ae154bf82f652001464415cea720..cc7fcdfea40c7e39a6bb0655255f448b1fb92378 100644 (file)
@@ -524,6 +524,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 },
@@ -556,7 +561,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);