Re: [PATCH] irqchip/qcom-irq-combiner: Rename driver struct to end in _driver

From: Thomas Gleixner
Date: Tue Jul 01 2025 - 10:26:38 EST


On Tue, Jul 01 2025 at 15:58, Uwe Kleine-König wrote:
> On Tue, Jul 01, 2025 at 11:01:18AM +0200, Thomas Gleixner wrote:
>> > Anyhow, I agree that depending on the name is unfortunate, maybe we can
>> > come up with something more clever?
>>
>> That's what I was referring to. Doing checks based on struct names is a
>> bad idea. Having distinct '...driver_probe(name)' and ...driver(name)'
>> macros to distinguish the functionality is the proper thing to do and
>> way simpler to analyse than names.
>
> A driver struct should have no reference to .init.text (i.e. no callback
> to a function marked with __init) no matter if it is registered using
> module_platform_driver_probe() or module_platform_driver().

I came from this wording in your change log:

"The modpost section mismatch checks are more lax for objects that have a
name that ends in "_probe". This is not justified here...."

That's the underlying problem. Using object names for deciding which
check rule to use is error prone and wrong to begin with. That what I
was referring to and there are obviously different rules for these
section checks, otherwise with your rename there would be no
difference, no?

I'm not talking about what this driver should do or not in it's
callbacks, that's a different problem, independent of this discussion.

I'm just horrified by the idea that such issues go unnoticed
because of a object name ending in _foo.

> But even if the requirements for those were different, how do you
> signal in the binary if the driver was registered using the normal
> (i.e platform_driver_register()) or the platform_driver_probe() way?
> Or do you want to check the source file?

No. We have a lot of magic already which puts annotations into sections
so that tools of all sorts can extract them for post processsing and not
make magic assumptions about names or their endings.

It's clearly simpler to do analyis based on:

magic_driver_allowed_to_do_stupid_stuff($name);

than on

default_driver_whatever($name);

both for tools when the magic macros emits section data and for humans
to grep, no?

Thanks,

tglx