-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32ebbc9
commit 2e57382
Showing
1 changed file
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From cd53144b42b51db948af0f642903c1eec619d1eb Mon Sep 17 00:00:00 2001 | ||
From f693fd4fbcbfd907cfa93598c66e0267dc201f41 Mon Sep 17 00:00:00 2001 | ||
From: Hector Martin <[email protected]> | ||
Date: Tue, 8 Nov 2022 16:33:22 +0000 | ||
Subject: [PATCH 2/3] lib/vsprintf: Add support for generic FOURCCs by | ||
|
@@ -24,11 +24,11 @@ value). | |
Signed-off-by: Hector Martin <[email protected]> | ||
Signed-off-by: Aditya Garg <[email protected]> | ||
--- | ||
Documentation/core-api/printk-formats.rst | 32 +++++++++++++++++++ | ||
lib/test_printf.c | 39 +++++++++++++++++++---- | ||
lib/vsprintf.c | 38 ++++++++++++++++++---- | ||
Documentation/core-api/printk-formats.rst | 32 ++++++++++++++++ | ||
lib/test_printf.c | 39 ++++++++++++++++---- | ||
lib/vsprintf.c | 45 +++++++++++++++++++---- | ||
scripts/checkpatch.pl | 2 +- | ||
4 files changed, 97 insertions(+), 14 deletions(-) | ||
4 files changed, 103 insertions(+), 15 deletions(-) | ||
|
||
diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst | ||
index ecccc0473..9982861fa 100644 | ||
|
@@ -74,7 +74,7 @@ index ecccc0473..9982861fa 100644 | |
---- | ||
|
||
diff --git a/lib/test_printf.c b/lib/test_printf.c | ||
index 59dbe4f9a..4bde40822 100644 | ||
index 59dbe4f9a..056929c06 100644 | ||
--- a/lib/test_printf.c | ||
+++ b/lib/test_printf.c | ||
@@ -776,21 +776,46 @@ static void __init fwnode_pointer(void) | ||
|
@@ -132,15 +132,16 @@ index 59dbe4f9a..4bde40822 100644 | |
|
||
static void __init | ||
diff --git a/lib/vsprintf.c b/lib/vsprintf.c | ||
index 56fe96319..13733a4da 100644 | ||
index 56fe96319..e47213a25 100644 | ||
--- a/lib/vsprintf.c | ||
+++ b/lib/vsprintf.c | ||
@@ -1781,27 +1781,53 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc, | ||
@@ -1781,27 +1781,58 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc, | ||
char output[sizeof("0123 little-endian (0x01234567)")]; | ||
char *p = output; | ||
unsigned int i; | ||
- u32 orig, val; | ||
+ bool pixel_fmt = false; | ||
u32 orig, val; | ||
+ u32 orig; | ||
|
||
- if (fmt[1] != 'c' || fmt[2] != 'c') | ||
+ if (fmt[1] != 'c') | ||
|
@@ -153,21 +154,26 @@ index 56fe96319..13733a4da 100644 | |
- val = orig & ~BIT(31); | ||
+ switch (fmt[2]) { | ||
+ case 'h': | ||
+ u32 val; | ||
+ val = orig; | ||
+ break; | ||
+ case 'r': | ||
+ u32 val; | ||
+ orig = swab32(orig); | ||
+ val = orig; | ||
+ break; | ||
+ case 'l': | ||
+ __le32 val; | ||
+ orig = le32_to_cpu(orig); | ||
+ val = orig; | ||
+ break; | ||
+ case 'b': | ||
+ __be32 val; | ||
+ orig = be32_to_cpu(orig); | ||
+ val = orig; | ||
+ break; | ||
+ case 'c': | ||
+ u32 val; | ||
+ /* Pixel formats are printed LSB-first */ | ||
+ val = swab32(orig & ~BIT(31)); | ||
+ pixel_fmt = true; | ||
|