diff options
author | Joe Perches <joe@perches.com> | 2016-02-25 18:25:20 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-03-20 21:36:05 +0100 |
commit | 58d303def2a1fbfb5c794bafe7da54b900d9694e (patch) | |
tree | bc37bae8e9f784bd9f47375e474ff3c6c750cfbf /drivers/mtd/ubi/misc.c | |
parent | ubifs: Add logging functions for ubifs_msg, ubifs_err and ubifs_warn (diff) | |
download | linux-58d303def2a1fbfb5c794bafe7da54b900d9694e.tar.xz linux-58d303def2a1fbfb5c794bafe7da54b900d9694e.zip |
mtd: ubi: Add logging functions ubi_msg, ubi_warn and ubi_err
Using logging functions instead of macros can reduce overall object size.
$ size drivers/mtd/ubi/built-in.o*
text data bss dec hex filename
271620 163364 73696 508680 7c308 drivers/mtd/ubi/built-in.o.allyesconfig.new
287638 165380 73504 526522 808ba drivers/mtd/ubi/built-in.o.allyesconfig.old
87728 3780 504 92012 1676c drivers/mtd/ubi/built-in.o.defconfig.new
97084 3780 504 101368 18bf8 drivers/mtd/ubi/built-in.o.defconfig.old
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/misc.c')
-rw-r--r-- | drivers/mtd/ubi/misc.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c index 2a45ac210b16..989036c681b8 100644 --- a/drivers/mtd/ubi/misc.c +++ b/drivers/mtd/ubi/misc.c @@ -153,3 +153,52 @@ int ubi_check_pattern(const void *buf, uint8_t patt, int size) return 0; return 1; } + +/* Normal UBI messages */ +void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + pr_notice(UBI_NAME_STR "%d: %pV\n", ubi->ubi_num, &vaf); + + va_end(args); +} + +/* UBI warning messages */ +void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + pr_warn(UBI_NAME_STR "%d warning: %ps: %pV\n", + ubi->ubi_num, __builtin_return_address(0), &vaf); + + va_end(args); +} + +/* UBI error messages */ +void ubi_err(const struct ubi_device *ubi, const char *fmt, ...) +{ + struct va_format vaf; + va_list args; + + va_start(args, fmt); + + vaf.fmt = fmt; + vaf.va = &args; + + pr_err(UBI_NAME_STR "%d error: %ps: %pV\n", + ubi->ubi_num, __builtin_return_address(0), &vaf); + va_end(args); +} |