diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-12-05 04:26:23 -0500 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2013-12-09 08:14:26 -0500 |
| commit | 7589e59fc0be799fed069591b83d0e57f11058cc (patch) | |
| tree | 4d6c401fe3ae711948bf24afe818b95a1c946e0a | |
| parent | ad824783fb23bbc8295cffb6214b3b82d25f7d4a (diff) | |
gpiolib: unify pr_* messages format
This patch includes the following amendments:
1) use "?" as a label when the last one is not defined in gpiod_*;
2) whenever it's possible gpiod_* are used;
3) print a function name, if it's already used in other messages.
Additionally it fixes an indentation in few places.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| -rw-r--r-- | drivers/gpio/gpiolib.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4eb262a31777..2dc3657e99ba 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -85,36 +85,36 @@ static int gpiod_request(struct gpio_desc *desc, const char *label); | |||
| 85 | static void gpiod_free(struct gpio_desc *desc); | 85 | static void gpiod_free(struct gpio_desc *desc); |
| 86 | 86 | ||
| 87 | #ifdef CONFIG_DEBUG_FS | 87 | #ifdef CONFIG_DEBUG_FS |
| 88 | #define gpiod_emerg(desc, fmt, ...) \ | 88 | #define gpiod_emerg(desc, fmt, ...) \ |
| 89 | pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 89 | pr_emerg("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ |
| 90 | ##__VA_ARGS__) | 90 | ##__VA_ARGS__) |
| 91 | #define gpiod_crit(desc, fmt, ...) \ | 91 | #define gpiod_crit(desc, fmt, ...) \ |
| 92 | pr_crit("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 92 | pr_crit("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?", \ |
| 93 | ##__VA_ARGS__) | 93 | ##__VA_ARGS__) |
| 94 | #define gpiod_err(desc, fmt, ...) \ | 94 | #define gpiod_err(desc, fmt, ...) \ |
| 95 | pr_err("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 95 | pr_err("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?", \ |
| 96 | ##__VA_ARGS__) | 96 | ##__VA_ARGS__) |
| 97 | #define gpiod_warn(desc, fmt, ...) \ | 97 | #define gpiod_warn(desc, fmt, ...) \ |
| 98 | pr_warn("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 98 | pr_warn("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?", \ |
| 99 | ##__VA_ARGS__) | 99 | ##__VA_ARGS__) |
| 100 | #define gpiod_info(desc, fmt, ...) \ | 100 | #define gpiod_info(desc, fmt, ...) \ |
| 101 | pr_info("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 101 | pr_info("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?", \ |
| 102 | ##__VA_ARGS__) | 102 | ##__VA_ARGS__) |
| 103 | #define gpiod_dbg(desc, fmt, ...) \ | 103 | #define gpiod_dbg(desc, fmt, ...) \ |
| 104 | pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label, \ | 104 | pr_debug("gpio-%d (%s): " fmt, desc_to_gpio(desc), desc->label ? : "?",\ |
| 105 | ##__VA_ARGS__) | 105 | ##__VA_ARGS__) |
| 106 | #else | 106 | #else |
| 107 | #define gpiod_emerg(desc, fmt, ...) \ | 107 | #define gpiod_emerg(desc, fmt, ...) \ |
| 108 | pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 108 | pr_emerg("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 109 | #define gpiod_crit(desc, fmt, ...) \ | 109 | #define gpiod_crit(desc, fmt, ...) \ |
| 110 | pr_crit("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 110 | pr_crit("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 111 | #define gpiod_err(desc, fmt, ...) \ | 111 | #define gpiod_err(desc, fmt, ...) \ |
| 112 | pr_err("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 112 | pr_err("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 113 | #define gpiod_warn(desc, fmt, ...) \ | 113 | #define gpiod_warn(desc, fmt, ...) \ |
| 114 | pr_warn("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 114 | pr_warn("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 115 | #define gpiod_info(desc, fmt, ...) \ | 115 | #define gpiod_info(desc, fmt, ...) \ |
| 116 | pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 116 | pr_info("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 117 | #define gpiod_dbg(desc, fmt, ...) \ | 117 | #define gpiod_dbg(desc, fmt, ...) \ |
| 118 | pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) | 118 | pr_debug("gpio-%d: " fmt, desc_to_gpio(desc), ##__VA_ARGS__) |
| 119 | #endif | 119 | #endif |
| 120 | 120 | ||
| @@ -188,7 +188,8 @@ static int gpio_ensure_requested(struct gpio_desc *desc) | |||
| 188 | if (WARN(test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0, | 188 | if (WARN(test_and_set_bit(FLAG_REQUESTED, &desc->flags) == 0, |
| 189 | "autorequest GPIO-%d\n", gpio)) { | 189 | "autorequest GPIO-%d\n", gpio)) { |
| 190 | if (!try_module_get(chip->owner)) { | 190 | if (!try_module_get(chip->owner)) { |
| 191 | pr_err("GPIO-%d: module can't be gotten \n", gpio); | 191 | gpiod_err(desc, "%s: module can't be gotten\n", |
| 192 | __func__); | ||
| 192 | clear_bit(FLAG_REQUESTED, &desc->flags); | 193 | clear_bit(FLAG_REQUESTED, &desc->flags); |
| 193 | /* lose */ | 194 | /* lose */ |
| 194 | return -EIO; | 195 | return -EIO; |
| @@ -809,8 +810,8 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change) | |||
| 809 | if (!test_bit(FLAG_REQUESTED, &desc->flags) || | 810 | if (!test_bit(FLAG_REQUESTED, &desc->flags) || |
| 810 | test_bit(FLAG_EXPORT, &desc->flags)) { | 811 | test_bit(FLAG_EXPORT, &desc->flags)) { |
| 811 | spin_unlock_irqrestore(&gpio_lock, flags); | 812 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 812 | pr_debug("%s: gpio %d unavailable (requested=%d, exported=%d)\n", | 813 | gpiod_dbg(desc, "%s: unavailable (requested=%d, exported=%d)\n", |
| 813 | __func__, desc_to_gpio(desc), | 814 | __func__, |
| 814 | test_bit(FLAG_REQUESTED, &desc->flags), | 815 | test_bit(FLAG_REQUESTED, &desc->flags), |
| 815 | test_bit(FLAG_EXPORT, &desc->flags)); | 816 | test_bit(FLAG_EXPORT, &desc->flags)); |
| 816 | status = -EPERM; | 817 | status = -EPERM; |
| @@ -858,8 +859,7 @@ fail_unregister_device: | |||
| 858 | device_unregister(dev); | 859 | device_unregister(dev); |
| 859 | fail_unlock: | 860 | fail_unlock: |
| 860 | mutex_unlock(&sysfs_lock); | 861 | mutex_unlock(&sysfs_lock); |
| 861 | pr_debug("%s: gpio%d status %d\n", __func__, desc_to_gpio(desc), | 862 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
| 862 | status); | ||
| 863 | return status; | 863 | return status; |
| 864 | } | 864 | } |
| 865 | EXPORT_SYMBOL_GPL(gpiod_export); | 865 | EXPORT_SYMBOL_GPL(gpiod_export); |
| @@ -907,8 +907,7 @@ int gpiod_export_link(struct device *dev, const char *name, | |||
| 907 | mutex_unlock(&sysfs_lock); | 907 | mutex_unlock(&sysfs_lock); |
| 908 | 908 | ||
| 909 | if (status) | 909 | if (status) |
| 910 | pr_debug("%s: gpio%d status %d\n", __func__, desc_to_gpio(desc), | 910 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
| 911 | status); | ||
| 912 | 911 | ||
| 913 | return status; | 912 | return status; |
| 914 | } | 913 | } |
| @@ -952,8 +951,7 @@ unlock: | |||
| 952 | mutex_unlock(&sysfs_lock); | 951 | mutex_unlock(&sysfs_lock); |
| 953 | 952 | ||
| 954 | if (status) | 953 | if (status) |
| 955 | pr_debug("%s: gpio%d status %d\n", __func__, desc_to_gpio(desc), | 954 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
| 956 | status); | ||
| 957 | 955 | ||
| 958 | return status; | 956 | return status; |
| 959 | } | 957 | } |
| @@ -995,8 +993,7 @@ void gpiod_unexport(struct gpio_desc *desc) | |||
| 995 | } | 993 | } |
| 996 | 994 | ||
| 997 | if (status) | 995 | if (status) |
| 998 | pr_debug("%s: gpio%d status %d\n", __func__, desc_to_gpio(desc), | 996 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
| 999 | status); | ||
| 1000 | } | 997 | } |
| 1001 | EXPORT_SYMBOL_GPL(gpiod_unexport); | 998 | EXPORT_SYMBOL_GPL(gpiod_unexport); |
| 1002 | 999 | ||
| @@ -1222,7 +1219,7 @@ int gpiochip_add(struct gpio_chip *chip) | |||
| 1222 | if (status) | 1219 | if (status) |
| 1223 | goto fail; | 1220 | goto fail; |
| 1224 | 1221 | ||
| 1225 | pr_debug("gpiochip_add: registered GPIOs %d to %d on device: %s\n", | 1222 | pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, |
| 1226 | chip->base, chip->base + chip->ngpio - 1, | 1223 | chip->base, chip->base + chip->ngpio - 1, |
| 1227 | chip->label ? : "generic"); | 1224 | chip->label ? : "generic"); |
| 1228 | 1225 | ||
| @@ -1232,7 +1229,7 @@ unlock: | |||
| 1232 | spin_unlock_irqrestore(&gpio_lock, flags); | 1229 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 1233 | fail: | 1230 | fail: |
| 1234 | /* failures here can mean systems won't boot... */ | 1231 | /* failures here can mean systems won't boot... */ |
| 1235 | pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n", | 1232 | pr_err("%s: GPIOs %d..%d (%s) failed to register\n", __func__, |
| 1236 | chip->base, chip->base + chip->ngpio - 1, | 1233 | chip->base, chip->base + chip->ngpio - 1, |
| 1237 | chip->label ? : "generic"); | 1234 | chip->label ? : "generic"); |
| 1238 | return status; | 1235 | return status; |
| @@ -1500,8 +1497,7 @@ static int gpiod_request(struct gpio_desc *desc, const char *label) | |||
| 1500 | } | 1497 | } |
| 1501 | done: | 1498 | done: |
| 1502 | if (status) | 1499 | if (status) |
| 1503 | pr_debug("_gpio_request: gpio-%d (%s) status %d\n", | 1500 | gpiod_dbg(desc, "%s: status %d\n", __func__, status); |
| 1504 | desc_to_gpio(desc), label ? : "?", status); | ||
| 1505 | spin_unlock_irqrestore(&gpio_lock, flags); | 1501 | spin_unlock_irqrestore(&gpio_lock, flags); |
| 1506 | return status; | 1502 | return status; |
| 1507 | } | 1503 | } |
| @@ -1702,7 +1698,7 @@ int gpiod_direction_input(struct gpio_desc *desc) | |||
| 1702 | if (!chip->get || !chip->direction_input) { | 1698 | if (!chip->get || !chip->direction_input) { |
| 1703 | gpiod_warn(desc, | 1699 | gpiod_warn(desc, |
| 1704 | "%s: missing get() or direction_input() operations\n", | 1700 | "%s: missing get() or direction_input() operations\n", |
| 1705 | __func__); | 1701 | __func__); |
| 1706 | return -EIO; | 1702 | return -EIO; |
| 1707 | } | 1703 | } |
| 1708 | 1704 | ||
| @@ -1722,7 +1718,8 @@ int gpiod_direction_input(struct gpio_desc *desc) | |||
| 1722 | if (status) { | 1718 | if (status) { |
| 1723 | status = chip->request(chip, offset); | 1719 | status = chip->request(chip, offset); |
| 1724 | if (status < 0) { | 1720 | if (status < 0) { |
| 1725 | gpiod_dbg(desc, "chip request fail, %d\n", status); | ||
