gpio: mockup: implement gpio_mockup_err()

Visually shrink the pr_err() calls by encapsulating adding the module
name prefix to the message in a macro.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Bartosz Golaszewski 2017-11-27 11:48:41 +01:00 committed by Linus Walleij
parent 8a39f597bc
commit f1bec99ae4

View File

@ -34,6 +34,8 @@
*/ */
#define GPIO_MOCKUP_MAX_RANGES (GPIO_MOCKUP_MAX_GC * 2) #define GPIO_MOCKUP_MAX_RANGES (GPIO_MOCKUP_MAX_GC * 2)
#define gpio_mockup_err(...) pr_err(GPIO_MOCKUP_NAME ": " __VA_ARGS__)
enum { enum {
GPIO_MOCKUP_DIR_OUT = 0, GPIO_MOCKUP_DIR_OUT = 0,
GPIO_MOCKUP_DIR_IN = 1, GPIO_MOCKUP_DIR_IN = 1,
@ -344,13 +346,11 @@ static int __init gpio_mockup_init(void)
gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL); gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL);
if (!gpio_mockup_dbg_dir) if (!gpio_mockup_dbg_dir)
pr_err("%s: error creating debugfs directory\n", gpio_mockup_err("error creating debugfs directory\n");
GPIO_MOCKUP_NAME);
err = platform_driver_register(&gpio_mockup_driver); err = platform_driver_register(&gpio_mockup_driver);
if (err) { if (err) {
pr_err("%s: error registering platform driver\n", gpio_mockup_err("error registering platform driver\n");
GPIO_MOCKUP_NAME);
return err; return err;
} }
@ -366,8 +366,7 @@ static int __init gpio_mockup_init(void)
i, NULL, 0, &pdata, i, NULL, 0, &pdata,
sizeof(pdata)); sizeof(pdata));
if (!pdev) { if (!pdev) {
pr_err("%s: error registering device", gpio_mockup_err("error registering device");
GPIO_MOCKUP_NAME);
platform_driver_unregister(&gpio_mockup_driver); platform_driver_unregister(&gpio_mockup_driver);
gpio_mockup_unregister_pdevs(); gpio_mockup_unregister_pdevs();
return -ENOMEM; return -ENOMEM;