Commit 666f355f authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit

Convert direct calls of vprintk_emit and printk_emit to the
dev_ equivalents.

Make create_syslog_header static.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Tested-by: default avatarJim Cromie <jim.cromie@gmail.com>
Acked-by: default avatarJason Baron <jbaron@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 05e4e5b8
...@@ -1865,7 +1865,8 @@ void device_shutdown(void) ...@@ -1865,7 +1865,8 @@ void device_shutdown(void)
*/ */
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
int create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen) static int
create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)
{ {
const char *subsys; const char *subsys;
size_t pos = 0; size_t pos = 0;
...@@ -1943,17 +1944,12 @@ EXPORT_SYMBOL(dev_printk_emit); ...@@ -1943,17 +1944,12 @@ EXPORT_SYMBOL(dev_printk_emit);
static int __dev_printk(const char *level, const struct device *dev, static int __dev_printk(const char *level, const struct device *dev,
struct va_format *vaf) struct va_format *vaf)
{ {
char hdr[128];
size_t hdrlen;
if (!dev) if (!dev)
return printk("%s(NULL device *): %pV", level, vaf); return printk("%s(NULL device *): %pV", level, vaf);
hdrlen = create_syslog_header(dev, hdr, sizeof(hdr)); return dev_printk_emit(level[1] - '0', dev,
"%s %s: %pV",
return printk_emit(0, level[1] - '0', hdrlen ? hdr : NULL, hdrlen, dev_driver_string(dev), dev_name(dev), vaf);
"%s %s: %pV",
dev_driver_string(dev), dev_name(dev), vaf);
} }
int dev_printk(const char *level, const struct device *dev, int dev_printk(const char *level, const struct device *dev,
......
...@@ -895,8 +895,6 @@ extern const char *dev_driver_string(const struct device *dev); ...@@ -895,8 +895,6 @@ extern const char *dev_driver_string(const struct device *dev);
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
extern int create_syslog_header(const struct device *dev,
char *hdr, size_t hdrlen);
extern int dev_vprintk_emit(int level, const struct device *dev, extern int dev_vprintk_emit(int level, const struct device *dev,
const char *fmt, va_list args); const char *fmt, va_list args);
extern __printf(3, 4) extern __printf(3, 4)
......
...@@ -591,15 +591,11 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor, ...@@ -591,15 +591,11 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
res = printk(KERN_DEBUG "(NULL device *): %pV", &vaf); res = printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
} else { } else {
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE];
char dict[128];
size_t dictlen;
dictlen = create_syslog_header(dev, dict, sizeof(dict)); res = dev_printk_emit(7, dev, "%s%s %s: %pV",
dynamic_emit_prefix(descriptor, buf),
res = printk_emit(0, 7, dictlen ? dict : NULL, dictlen, dev_driver_string(dev), dev_name(dev),
"%s%s %s: %pV", &vaf);
dynamic_emit_prefix(descriptor, buf),
dev_driver_string(dev), dev_name(dev), &vaf);
} }
va_end(args); va_end(args);
...@@ -627,18 +623,13 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor, ...@@ -627,18 +623,13 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
if (dev && dev->dev.parent) { if (dev && dev->dev.parent) {
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE];
char dict[128];
size_t dictlen; res = dev_printk_emit(7, dev->dev.parent,
"%s%s %s %s: %pV",
dictlen = create_syslog_header(dev->dev.parent, dynamic_emit_prefix(descriptor, buf),
dict, sizeof(dict)); dev_driver_string(dev->dev.parent),
dev_name(dev->dev.parent),
res = printk_emit(0, 7, dictlen ? dict : NULL, dictlen, netdev_name(dev), &vaf);
"%s%s %s %s: %pV",
dynamic_emit_prefix(descriptor, buf),
dev_driver_string(dev->dev.parent),
dev_name(dev->dev.parent),
netdev_name(dev), &vaf);
} else if (dev) { } else if (dev) {
res = printk(KERN_DEBUG "%s: %pV", netdev_name(dev), &vaf); res = printk(KERN_DEBUG "%s: %pV", netdev_name(dev), &vaf);
} else { } else {
......
...@@ -6429,16 +6429,12 @@ static int __netdev_printk(const char *level, const struct net_device *dev, ...@@ -6429,16 +6429,12 @@ static int __netdev_printk(const char *level, const struct net_device *dev,
int r; int r;
if (dev && dev->dev.parent) { if (dev && dev->dev.parent) {
char dict[128]; r = dev_printk_emit(level[1] - '0',
size_t dictlen = create_syslog_header(dev->dev.parent, dev->dev.parent,
dict, sizeof(dict)); "%s %s %s: %pV",
dev_driver_string(dev->dev.parent),
r = printk_emit(0, level[1] - '0', dev_name(dev->dev.parent),
dictlen ? dict : NULL, dictlen, netdev_name(dev), vaf);
"%s %s %s: %pV",
dev_driver_string(dev->dev.parent),
dev_name(dev->dev.parent),
netdev_name(dev), vaf);
} else if (dev) { } else if (dev) {
r = printk("%s%s: %pV", level, netdev_name(dev), vaf); r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment