Skip to content

Commit 1a0df28

Browse files
zhaoxiaojgross1
authored andcommitted
x86: xen: platform-pci-unplug: use pr_err() and pr_warn() instead of raw printk()
Since we have the nice helpers pr_err() and pr_warn(), use them instead of raw printk(). [jgross@suse.com] Move the "#define pr_fmt" above the #includes in order to avoid build warnings due to redefinition. Signed-off-by: zhaoxiao <zhaoxiao@uniontech.com> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/20210825114111.29009-1-zhaoxiao@uniontech.com Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent bb70913 commit 1a0df28

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

arch/x86/xen/platform-pci-unplug.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* Copyright (c) 2010, Citrix
88
*/
99

10+
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11+
1012
#include <linux/init.h>
1113
#include <linux/io.h>
1214
#include <linux/export.h>
@@ -30,26 +32,26 @@ static int check_platform_magic(void)
3032

3133
magic = inw(XEN_IOPORT_MAGIC);
3234
if (magic != XEN_IOPORT_MAGIC_VAL) {
33-
printk(KERN_ERR "Xen Platform PCI: unrecognised magic value\n");
35+
pr_err("Xen Platform PCI: unrecognised magic value\n");
3436
return XEN_PLATFORM_ERR_MAGIC;
3537
}
3638

3739
protocol = inb(XEN_IOPORT_PROTOVER);
3840

39-
printk(KERN_DEBUG "Xen Platform PCI: I/O protocol version %d\n",
41+
pr_debug("Xen Platform PCI: I/O protocol version %d\n",
4042
protocol);
4143

4244
switch (protocol) {
4345
case 1:
4446
outw(XEN_IOPORT_LINUX_PRODNUM, XEN_IOPORT_PRODNUM);
4547
outl(XEN_IOPORT_LINUX_DRVVER, XEN_IOPORT_DRVVER);
4648
if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) {
47-
printk(KERN_ERR "Xen Platform: blacklisted by host\n");
49+
pr_err("Xen Platform: blacklisted by host\n");
4850
return XEN_PLATFORM_ERR_BLACKLIST;
4951
}
5052
break;
5153
default:
52-
printk(KERN_WARNING "Xen Platform PCI: unknown I/O protocol version\n");
54+
pr_warn("Xen Platform PCI: unknown I/O protocol version\n");
5355
return XEN_PLATFORM_ERR_PROTOCOL;
5456
}
5557

@@ -155,12 +157,12 @@ void xen_unplug_emulated_devices(void)
155157
* been compiled for this kernel (modules or built-in are both OK). */
156158
if (!xen_emul_unplug) {
157159
if (xen_must_unplug_nics()) {
158-
printk(KERN_INFO "Netfront and the Xen platform PCI driver have "
160+
pr_info("Netfront and the Xen platform PCI driver have "
159161
"been compiled for this kernel: unplug emulated NICs.\n");
160162
xen_emul_unplug |= XEN_UNPLUG_ALL_NICS;
161163
}
162164
if (xen_must_unplug_disks()) {
163-
printk(KERN_INFO "Blkfront and the Xen platform PCI driver have "
165+
pr_info("Blkfront and the Xen platform PCI driver have "
164166
"been compiled for this kernel: unplug emulated disks.\n"
165167
"You might have to change the root device\n"
166168
"from /dev/hd[a-d] to /dev/xvd[a-d]\n"
@@ -200,7 +202,7 @@ static int __init parse_xen_emul_unplug(char *arg)
200202
else if (!strncmp(p, "never", l))
201203
xen_emul_unplug |= XEN_UNPLUG_NEVER;
202204
else
203-
printk(KERN_WARNING "unrecognised option '%s' "
205+
pr_warn("unrecognised option '%s' "
204206
"in parameter 'xen_emul_unplug'\n", p);
205207
}
206208
return 0;

0 commit comments

Comments
 (0)