diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2021-02-16 17:57:20 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2021-02-17 12:52:20 +0100 |
commit | af612e43de6d27df51a7636229be7d33fe3ab7b5 (patch) | |
tree | a84a7181fd4374fbe5071b9c41dde8afc26c91e1 /lib/test_printf.c | |
parent | 4d36cf070249564546f07a3fe5456e29dbbc1593 (diff) | |
download | linux-af612e43de6d27df51a7636229be7d33fe3ab7b5.tar.gz linux-af612e43de6d27df51a7636229be7d33fe3ab7b5.tar.bz2 linux-af612e43de6d27df51a7636229be7d33fe3ab7b5.zip |
lib/vsprintf: Add support for printing V4L2 and DRM fourccs
Add a printk modifier %p4cc (for pixel format) for printing V4L2 and DRM
pixel formats denoted by fourccs. The fourcc encoding is the same for both
so the same implementation can be used.
Suggested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210216155723.17109-2-sakari.ailus@linux.intel.com
Diffstat (limited to 'lib/test_printf.c')
-rw-r--r-- | lib/test_printf.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c index 7ac87f18a10f..7ee0b4e17b21 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -649,6 +649,23 @@ static void __init fwnode_pointer(void) software_node_unregister(&softnodes[0]); } +static void __init fourcc_pointer(void) +{ + struct { + u32 code; + char *str; + } const try[] = { + { 0x3231564e, "NV12 little-endian (0x3231564e)", }, + { 0xb231564e, "NV12 big-endian (0xb231564e)", }, + { 0x10111213, ".... little-endian (0x10111213)", }, + { 0x20303159, "Y10 little-endian (0x20303159)", }, + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(try); i++) + test(try[i].str, "%p4cc", &try[i].code); +} + static void __init errptr(void) { @@ -694,6 +711,7 @@ test_pointer(void) flags(); errptr(); fwnode_pointer(); + fourcc_pointer(); } static void __init selftest(void) |