Re: [PATCH 1/2] lib/vsprintf: Add support for generic FourCCs by extending %p4cc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On 13 Mar 2025, at 12:58 AM, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> 
> On Wed, Mar 12, 2025 at 07:14:36PM +0000, Aditya Garg wrote:
>>> On 12 Mar 2025, at 9:05 PM, Sven Peter <sven@xxxxxxxxxxxxx> wrote:
>>> On Wed, Mar 12, 2025, at 13:03, Aditya Garg wrote:
> 
> ...
> 
>>> I don't have a strong opinion either way: for SMC I just need to print
>>> FourCC keys for debugging / information in a few places.
>>> 
>>> I'm preparing the SMC driver for upstreaming again (after a two year delay :-()
>>> and was just going to use macros to print the SMC FourCC keys similar to
>>> DRM_MODE_FMT/DRM_MODE_ARG for now to keep the series smaller and revisit
>>> the topic later.
>>> 
>>> Right now I have these in my local tree (only compile tested so far):
>>> 
>>> #define SMC_KEY_FMT "%c%c%c%c (0x%08x)"
>>> #define SMC_KEY_ARG(k) (k)>>24, (k)>>16, (k)>>8, (k), (k)
>> 
>> That seems to be a nice alternative, which I guess Thomas was also suggesting.
> 
> I don't think it's "nice". Each of the approaches has pros and cons.
> You can start from bloat-o-meter here and compare it with your %p extension.
> 
> Also, can you show the bloat-o-meter output for the vsprintf.c?

Here are your outputs:

---------------------------------------------------------------------
For appletbdrm:

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $P4 $MACRO
add/remove: 0/0 grow/shrink: 1/1 up/down: 64/-19 (45)
Function                                     old     new   delta
appletbdrm_read_response                     395     459     +64
appletbdrm_probe                            1786    1767     -19
Total: Before=13418, After=13463, chg +0.34%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $P4 $MACRO -c
add/remove: 0/0 grow/shrink: 1/1 up/down: 64/-19 (45)
Function                                     old     new   delta
appletbdrm_read_response                     395     459     +64
appletbdrm_probe                            1786    1767     -19
Total: Before=5217, After=5262, chg +0.86%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data                                         old     new   delta
Total: Before=1560, After=1560, chg +0.00%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
RO Data                                      old     new   delta
Total: Before=6641, After=6641, chg +0.00%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $P4 $MACRO -d
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data                                         old     new   delta
Total: Before=8201, After=8201, chg +0.00%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $P4 $MACRO -t
add/remove: 0/0 grow/shrink: 1/1 up/down: 64/-19 (45)
Function                                     old     new   delta
appletbdrm_read_response                     395     459     +64
appletbdrm_probe                            1786    1767     -19
Total: Before=5217, After=5262, chg +0.86%

---------------------------------------------------------------------
For vsprintf:

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $OLD $NEW
add/remove: 0/0 grow/shrink: 1/0 up/down: 220/0 (220)
Function                                     old     new   delta
fourcc_string                                479     699    +220
Total: Before=26454, After=26674, chg +0.83%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $OLD $NEW -c
add/remove: 0/0 grow/shrink: 1/0 up/down: 220/0 (220)
Function                                     old     new   delta
fourcc_string                                479     699    +220
Total: Before=24718, After=24938, chg +0.89%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data                                         old     new   delta
Total: Before=229, After=229, chg +0.00%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
RO Data                                      old     new   delta
Total: Before=1507, After=1507, chg +0.00%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $OLD $NEW -d
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data                                         old     new   delta
Total: Before=1736, After=1736, chg +0.00%

aditya@MacBook:~/linux$ ./scripts/bloat-o-meter $OLD $NEW -t
add/remove: 0/0 grow/shrink: 1/0 up/down: 220/0 (220)
Function                                     old     new   delta
fourcc_string                                479     699    +220
Total: Before=24718, After=24938, chg +0.89%


> 
>>> which are then used like this:
>>> 
>>>  dev_info(dev,
>>>      "Initialized (%d keys " SMC_KEY_FMT " .. " SMC_KEY_FMT ")\n",
>>>       smc->key_count, SMC_KEY_ARG(smc->first_key),
>>>       SMC_KEY_ARG(smc->last_key));
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux