[PATCH 4/7] lib/vsprintf: Add support for generic FOURCCs by extending %p4cc

Hector Martin marcan at marcan.st
Sun Oct 23 21:53:50 PDT 2022


On 19/10/2022 20.48, Russell King (Oracle) wrote:
> On Wed, Oct 19, 2022 at 12:00:23PM +0200, Petr Mladek wrote:
>> On Tue 2022-09-06 14:19:44, Russell King wrote:
>>> From: Hector Martin <marcan at marcan.st>
>>>
> ... 
>>> +Generic FourCC code
>>> +-------------------
>>> +
>>> +::
>>> +	%p4c[hnbl]	gP00 (0x67503030)
>>> +
>>> +Print a generic FourCC code, as both ASCII characters and its numerical
>>> +value as hexadecimal.
>>> +
>>> +The additional ``h``, ``r``, ``b``, and ``l`` specifiers are used to specify
>>> +host, reversed, big or little endian order data respectively. Host endian
>>> +order means the data is interpreted as a 32-bit integer and the most
>>> +significant byte is printed first; that is, the character code as printed
>>> +matches the byte order stored in memory on big-endian systems, and is reversed
>>> +on little-endian systems.
>>> +
>>> +Passed by reference.
>>> +
>>> +Examples for a little-endian machine, given &(u32)0x67503030::
>>> +
>>> +	%p4ch	gP00 (0x67503030)
>>> +	%p4cl	gP00 (0x67503030)
>>> +	%p4cb	00Pg (0x30305067)
>>> +	%p4cr	00Pg (0x30305067)
>>
>> Nit: I would prefer to keep the same order (h,r,b,l) everywhere.
>>
>>      I guess that you wanted to show exactly the same results next
>>      to each other. But it is not the case on big-endian anyway.
> 
> This is straight from the Asahi kernel tree, and is unmodified. I'm
> guessing you're use of "you" here refers to Hector rather than me.
> 
> So, Hector, any opinions on Petr's comments please?

Fine with me, feel free to make the changes :)

- Hector



More information about the linux-arm-kernel mailing list