[PATCH v1 1/3] string: Consolidate yesno() helpers under string.h hood
Jani Nikula
jani.nikula at linux.intel.com
Wed Feb 17 17:13:03 UTC 2021
On Wed, 17 Feb 2021, Petr Mladek <pmladek at suse.com> wrote:
> On Mon 2021-02-15 16:39:26, Andy Shevchenko wrote:
>> +Cc: Sakari and printk people
>>
>> On Mon, Feb 15, 2021 at 4:28 PM Christian König
>> <christian.koenig at amd.com> wrote:
>> > Am 15.02.21 um 15:21 schrieb Andy Shevchenko:
>> > > We have already few similar implementation and a lot of code that can benefit
>> > > of the yesno() helper. Consolidate yesno() helpers under string.h hood.
>> > >
>> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
>> >
>> > Looks like a good idea to me, feel free to add an Acked-by: Christian
>> > König <christian.koenig at amd.com> to the series.
>>
>> Thanks.
>>
>> > But looking at the use cases for this, wouldn't it make more sense to
>> > teach kprintf some new format modifier for this?
>>
>> As a next step? IIRC Sakari has at some point the series converted
>> yesno and Co. to something which I don't remember the details of.
>>
>> Guys, what do you think?
>
> Honestly, I think that yesno() is much easier to understand than %py.
> And %py[DOY] looks really scary. It has been suggested at
> https://lore.kernel.org/lkml/YCqaNnr7ynRydczE@smile.fi.intel.com/#t
>
> Yes, enabledisable() is hard to parse but it is still self-explaining
> and can be found easily by cscope. On the contrary, %pyD will likely
> print some python code and it is not clear if it would be compatible
> with v3. I am just kidding but you get the picture.
Personally I prefer %s and the functions.
I think the format specifiers have become unwieldy. I don't remember any
of the kernel specific ones by heart, I always look them up or just
cargo-cult. I think the fourcc format specifiers are a nice cleanup, but
I don't remember them either. I'd like something like %foo{yesno} where,
if you remember the %foo part, you could actually also remember the
rest.
But really if you get *any* version accepted, I'm not going to argue
against it, and you can disregard this as meaningless bikeshedding.
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
More information about the amd-gfx
mailing list