[<prev] [next>] [day] [month] [year] [list]
Message-ID: <BD79186B4FD85F4B8E60E381CAEE19090200EC5C@mi8nycmail19.Mi8.com>
Date: Tue, 15 Dec 2009 21:19:38 -0500
From: "H Hartley Sweeten" <hartleys@...ionengravers.com>
To: "kernel list" <linux-kernel@...r.kernel.org>
Cc: "David Brownell" <dbrownell@...rs.sourceforge.net>
Subject: [PATCH] gpiolib.c: use pr_fmt()
Use pr_fmt() to add the __func__ prefix to all pr_<level> messages. In
addition, add the module name to the messages to help with debugging.
Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.com>
Cc: David Brownell <dbrownell@...rs.sourceforge.net>
---
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 50de0f5..2c84cc0 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1,3 +1,5 @@
+#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
@@ -100,7 +102,7 @@ static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset)
if (WARN(test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0,
"autorequest GPIO-%d\n", gpio)) {
if (!try_module_get(chip->owner)) {
- pr_err("GPIO-%d: module can't be gotten \n", gpio);
+ pr_err("GPIO-%d: module can't be gotten\n", gpio);
clear_bit(FLAG_REQUESTED, &desc->flags);
/* lose */
return -EIO;
@@ -144,7 +146,7 @@ static int gpiochip_find_base(int ngpio)
}
if (gpio_is_valid(base))
- pr_debug("%s: found new base at %d\n", __func__, base);
+ pr_debug("found new base at %d\n", base);
return base;
}
@@ -181,8 +183,7 @@ int __init gpiochip_reserve(int start, int ngpio)
set_bit(FLAG_RESERVED, &desc->flags);
}
- pr_debug("%s: reserved gpios from %d to %d\n",
- __func__, start, start + ngpio - 1);
+ pr_debug("reserved gpios from %d to %d\n", start, start + ngpio - 1);
err:
spin_unlock_irqrestore(&gpio_lock, flags);
@@ -562,7 +563,7 @@ static ssize_t export_store(struct class *class, const char *buf, size_t len)
done:
if (status)
- pr_debug("%s: status %d\n", __func__, status);
+ pr_debug("status %d\n", status);
return status ? : len;
}
@@ -591,7 +592,7 @@ static ssize_t unexport_store(struct class *class, const char *buf, size_t len)
}
done:
if (status)
- pr_debug("%s: status %d\n", __func__, status);
+ pr_debug("status %d\n", status);
return status ? : len;
}
@@ -633,7 +634,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
/* can't export until sysfs is available ... */
if (!gpio_class.p) {
- pr_debug("%s: called too early!\n", __func__);
+ pr_debug("called too early!\n");
return -ENOENT;
}
@@ -688,7 +689,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
done:
if (status)
- pr_debug("%s: gpio%d status %d\n", __func__, gpio, status);
+ pr_debug("gpio%d status %d\n", gpio, status);
return status;
}
@@ -738,7 +739,7 @@ int gpio_export_link(struct device *dev, const char *name, unsigned gpio)
done:
if (status)
- pr_debug("%s: gpio%d status %d\n", __func__, gpio, status);
+ pr_debug("gpio%d status %d\n", gpio, status);
return status;
}
@@ -779,7 +780,7 @@ void gpio_unexport(unsigned gpio)
mutex_unlock(&sysfs_lock);
done:
if (status)
- pr_debug("%s: gpio%d status %d\n", __func__, gpio, status);
+ pr_debug("gpio%d status %d\n", gpio, status);
}
EXPORT_SYMBOL_GPL(gpio_unexport);
@@ -818,8 +819,7 @@ static int gpiochip_export(struct gpio_chip *chip)
gpio_desc[gpio++].chip = NULL;
spin_unlock_irqrestore(&gpio_lock, flags);
- pr_debug("%s: chip %s status %d\n", __func__,
- chip->label, status);
+ pr_debug("chip %s status %d\n", chip->label, status);
}
return status;
@@ -842,8 +842,7 @@ static void gpiochip_unexport(struct gpio_chip *chip)
mutex_unlock(&sysfs_lock);
if (status)
- pr_debug("%s: chip %s status %d\n", __func__,
- chip->label, status);
+ pr_debug("chip %s status %d\n", chip->label, status);
}
static int __init gpiolib_sysfs_init(void)
@@ -966,7 +965,7 @@ unlock:
fail:
/* failures here can mean systems won't boot... */
if (status)
- pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n",
+ pr_err("gpios %d..%d (%s) not registered\n",
chip->base, chip->base + chip->ngpio - 1,
chip->label ? : "generic");
return status;
@@ -1059,7 +1058,7 @@ int gpio_request(unsigned gpio, const char *label)
done:
if (status)
- pr_debug("gpio_request: gpio-%d (%s) status %d\n",
+ pr_debug("gpio-%d (%s) status %d\n",
gpio, label ? : "?", status);
spin_unlock_irqrestore(&gpio_lock, flags);
return status;
@@ -1189,8 +1188,7 @@ lose:
fail:
spin_unlock_irqrestore(&gpio_lock, flags);
if (status)
- pr_debug("%s: gpio-%d status %d\n",
- __func__, gpio, status);
+ pr_debug("gpio-%d status %d\n", gpio, status);
return status;
}
EXPORT_SYMBOL_GPL(gpio_direction_input);
@@ -1242,8 +1240,7 @@ lose:
fail:
spin_unlock_irqrestore(&gpio_lock, flags);
if (status)
- pr_debug("%s: gpio-%d status %d\n",
- __func__, gpio, status);
+ pr_debug("gpio-%d status %d\n", gpio, status);
return status;
}
EXPORT_SYMBOL_GPL(gpio_direction_output);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists