device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
authorJoe Perches <joe@perches.com>
Thu, 13 Sep 2012 03:14:11 +0000 (20:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Sep 2012 13:10:05 +0000 (06:10 -0700)
Convert direct calls of vprintk_emit and printk_emit to the
dev_ equivalents.

Make create_syslog_header static.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/core.c
include/linux/device.h
lib/dynamic_debug.c
net/core/dev.c

index dff94c8fb35093851be42bc3a18275698cb4b1e8..abea76c36a4b96a10201bb4eeef5c0650e6644ae 100644 (file)
@@ -1865,7 +1865,8 @@ void device_shutdown(void)
  */
 
 #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;
        size_t pos = 0;
@@ -1943,17 +1944,12 @@ EXPORT_SYMBOL(dev_printk_emit);
 static int __dev_printk(const char *level, const struct device *dev,
                        struct va_format *vaf)
 {
-       char hdr[128];
-       size_t hdrlen;
-
        if (!dev)
                return printk("%s(NULL device *): %pV", level, vaf);
 
-       hdrlen = create_syslog_header(dev, hdr, sizeof(hdr));
-
-       return printk_emit(0, level[1] - '0', hdrlen ? hdr : NULL, hdrlen,
-                          "%s %s: %pV",
-                          dev_driver_string(dev), dev_name(dev), vaf);
+       return dev_printk_emit(level[1] - '0', dev,
+                              "%s %s: %pV",
+                              dev_driver_string(dev), dev_name(dev), vaf);
 }
 
 int dev_printk(const char *level, const struct device *dev,
index 0d9ba0c09791238fde3fe05720f230e962b4583e..6d37e59db57198ef6afc13a3f82e6aa1dd53105d 100644 (file)
@@ -895,8 +895,6 @@ extern const char *dev_driver_string(const struct device *dev);
 
 #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,
                            const char *fmt, va_list args);
 extern __printf(3, 4)
index 6b3ebabacfa850daecf01a28ad1167f6252ad154..e7f7d993357a57985169ecbfc36ca793798c1a60 100644 (file)
@@ -591,15 +591,11 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
                res = printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
        } else {
                char buf[PREFIX_SIZE];
-               char dict[128];
-               size_t dictlen;
 
-               dictlen = create_syslog_header(dev, dict, sizeof(dict));
-
-               res = printk_emit(0, 7, dictlen ? dict : NULL, dictlen,
-                                 "%s%s %s: %pV",
-                                 dynamic_emit_prefix(descriptor, buf),
-                                 dev_driver_string(dev), dev_name(dev), &vaf);
+               res = dev_printk_emit(7, dev, "%s%s %s: %pV",
+                                     dynamic_emit_prefix(descriptor, buf),
+                                     dev_driver_string(dev), dev_name(dev),
+                                     &vaf);
        }
 
        va_end(args);
@@ -627,18 +623,13 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
 
        if (dev && dev->dev.parent) {
                char buf[PREFIX_SIZE];
-               char dict[128];
-               size_t dictlen;
-
-               dictlen = create_syslog_header(dev->dev.parent,
-                                              dict, sizeof(dict));
-
-               res = printk_emit(0, 7, dictlen ? dict : NULL, dictlen,
-                                 "%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);
+
+               res = dev_printk_emit(7, dev->dev.parent,
+                                     "%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) {
                res = printk(KERN_DEBUG "%s: %pV", netdev_name(dev), &vaf);
        } else {
index cb9d43be07e7ee7e998c743cbf37ad9200b14c32..76c0fe66fdc05e0900e9a9f8a818b1873e9cbf77 100644 (file)
@@ -6429,16 +6429,12 @@ static int __netdev_printk(const char *level, const struct net_device *dev,
        int r;
 
        if (dev && dev->dev.parent) {
-               char dict[128];
-               size_t dictlen = create_syslog_header(dev->dev.parent,
-                                                     dict, sizeof(dict));
-
-               r = printk_emit(0, level[1] - '0',
-                               dictlen ? dict : NULL, dictlen,
-                               "%s %s %s: %pV",
-                               dev_driver_string(dev->dev.parent),
-                               dev_name(dev->dev.parent),
-                               netdev_name(dev), vaf);
+               r = dev_printk_emit(level[1] - '0',
+                                   dev->dev.parent,
+                                   "%s %s %s: %pV",
+                                   dev_driver_string(dev->dev.parent),
+                                   dev_name(dev->dev.parent),
+                                   netdev_name(dev), vaf);
        } else if (dev) {
                r = printk("%s%s: %pV", level, netdev_name(dev), vaf);
        } else {