Skip to content

Commit 477c1c2

Browse files
btw616jmberg-intel
authored andcommitted
um: vector: Clean up and modernize log messages
Use pr_*() and netdev_*() to print log messages. While at it, join split messages for easier grepping. Suggested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Tiwei Bie <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent 10eabec commit 477c1c2

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

arch/um/drivers/vector_kern.c

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
* Copyright (C) 2001 by various other people who didn't put their name here.
99
*/
1010

11+
#define pr_fmt(fmt) "uml-vector: " fmt
12+
1113
#include <linux/memblock.h>
1214
#include <linux/etherdevice.h>
1315
#include <linux/ethtool.h>
@@ -1551,41 +1553,33 @@ static void vector_setup_etheraddr(struct net_device *dev, char *str)
15511553
addr[i] = simple_strtoul(str, &end, 16);
15521554
if ((end == str) ||
15531555
((*end != ':') && (*end != ',') && (*end != '\0'))) {
1554-
printk(KERN_ERR
1555-
"setup_etheraddr: failed to parse '%s' "
1556-
"as an ethernet address\n", str);
1556+
netdev_err(dev,
1557+
"Failed to parse '%s' as an ethernet address\n", str);
15571558
goto random;
15581559
}
15591560
str = end + 1;
15601561
}
15611562
if (is_multicast_ether_addr(addr)) {
1562-
printk(KERN_ERR
1563-
"Attempt to assign a multicast ethernet address to a "
1564-
"device disallowed\n");
1563+
netdev_err(dev,
1564+
"Attempt to assign a multicast ethernet address to a device disallowed\n");
15651565
goto random;
15661566
}
15671567
if (!is_valid_ether_addr(addr)) {
1568-
printk(KERN_ERR
1569-
"Attempt to assign an invalid ethernet address to a "
1570-
"device disallowed\n");
1568+
netdev_err(dev,
1569+
"Attempt to assign an invalid ethernet address to a device disallowed\n");
15711570
goto random;
15721571
}
15731572
if (!is_local_ether_addr(addr)) {
1574-
printk(KERN_WARNING
1575-
"Warning: Assigning a globally valid ethernet "
1576-
"address to a device\n");
1577-
printk(KERN_WARNING "You should set the 2nd rightmost bit in "
1578-
"the first byte of the MAC,\n");
1579-
printk(KERN_WARNING "i.e. %02x:%02x:%02x:%02x:%02x:%02x\n",
1580-
addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4],
1581-
addr[5]);
1573+
netdev_warn(dev, "Warning: Assigning a globally valid ethernet address to a device\n");
1574+
netdev_warn(dev, "You should set the 2nd rightmost bit in the first byte of the MAC,\n");
1575+
netdev_warn(dev, "i.e. %02x:%02x:%02x:%02x:%02x:%02x\n",
1576+
addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4], addr[5]);
15821577
}
15831578
eth_hw_addr_set(dev, addr);
15841579
return;
15851580

15861581
random:
1587-
printk(KERN_INFO
1588-
"Choosing a random ethernet address for device %s\n", dev->name);
1582+
netdev_info(dev, "Choosing a random ethernet address\n");
15891583
eth_hw_addr_random(dev);
15901584
}
15911585

@@ -1601,14 +1595,12 @@ static void vector_eth_configure(
16011595

16021596
device = kzalloc(sizeof(*device), GFP_KERNEL);
16031597
if (device == NULL) {
1604-
printk(KERN_ERR "eth_configure failed to allocate struct "
1605-
"vector_device\n");
1598+
pr_err("Failed to allocate struct vector_device for vec%d\n", n);
16061599
return;
16071600
}
16081601
dev = alloc_etherdev(sizeof(struct vector_private));
16091602
if (dev == NULL) {
1610-
printk(KERN_ERR "eth_configure: failed to allocate struct "
1611-
"net_device for vec%d\n", n);
1603+
pr_err("Failed to allocate struct net_device for vec%d\n", n);
16121604
goto out_free_device;
16131605
}
16141606

@@ -1738,8 +1730,7 @@ static int __init vector_setup(char *str)
17381730

17391731
err = vector_parse(str, &n, &str, &error);
17401732
if (err) {
1741-
printk(KERN_ERR "vector_setup - Couldn't parse '%s' : %s\n",
1742-
str, error);
1733+
pr_err("Couldn't parse '%s': %s\n", str, error);
17431734
return 1;
17441735
}
17451736
new = memblock_alloc_or_panic(sizeof(*new), SMP_CACHE_BYTES);

0 commit comments

Comments
 (0)