On Wed, Mar 12, 2025 at 07:35:54PM +0000, Aditya Garg wrote: > > 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. > > I would prefer vsprintf, but if it's not there, that remains as nice right? Nope, it remains us with the only approach (besides copy'n'paste everywhere which is error prone). > > 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? > > vsprintf isn't a kernel module, is it? I'll have to compile a new kernel I guess. You can just compile one file. We need an object out of it, we don't it to be linked. > >>> 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