Re: [PATCH v9 02/10] rockchip-mailbox: Fix typo

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

 



On Tue, Dec 20, 2022 at 12:19:49PM -0600, Allen Webb wrote:
> On Tue, Dec 20, 2022 at 12:12 PM Luis Chamberlain <mcgrof@xxxxxxxxxx> wrote:
> >
> > On Tue, Dec 20, 2022 at 08:58:36AM -0600, Allen Webb wrote:
> > > As mentioned in a different sub-thread this cannot be built as a
> > > module so I updated the commit message to:
> > >
> > > imx: Fix typo
> > >
> > > A one character difference in the name supplied to MODULE_DEVICE_TABLE
> > > breaks compilation for SOC_IMX8M after built-in modules can generate
> > > match-id based module aliases, so fix the typo.
> >
> > Are you saying that it is a typo *now* only, and fixing it does not fix
> > compilation now, but that fixing the typo will fix a future compilation
> > issue once your patches get merged for built-in module aliases?
> 
> It was always a typo, it just doesn't affect the build because
> MODULE_DEVICE_TABLE is not doing anything for built-in modules before
> this patch series.
> 
> >
> > > This was not caught earlier because SOC_IMX8M can not be built as a
> > > module and MODULE_DEVICE_TABLE is a no-op for built-in modules.
> >
> > Odd, so why did it use MODULE_DEVICE_TABLE then? What was the reason for
> > the driver having MODULE_DEVICE_TABLE if it was a no-op?
> 
> That is a good question. I can only speculate as to the answer

You can use git blame to trace back to the original commit that added
it, then  use git blame foo.c commit-id~1  on the file to keep going
back until you get to the first commit that added that entry, check out
that as a branch and see if the driver was still not a module then
(tristate). If so then your speculation is very likely accurate and
can be spelled out in the commit log message.

It begs the inverse question too though, you are finding uses of
built-in-always code (never tristate) which uses MODULE_DEVICE_TABLE().
Although today that's a no-op, after your changes this becomes useful
information, so do you need to scrape to see what built-in-aways code
*do* not use MODULE_DEVICE_TABLE() where after your patches it would
have become useful?

Determing if there is value to that endeavour should be easily grasped by
reading the description you are adding to MODULE_DEVICE_TABLE() --
in your patch 5 "module.h: MODULE_DEVICE_TABLE for built-in modules".
Driver developers for built-in-always code should read that description
and be able to decide if they should use it or not. But even your latest
replies to Greg do not make that clear, *I personally gather* rather that
this would in no way shape or form be useful. But is that true?

So why not just remove MODULE_DEVICE_TABLE() from code we know is
built-in-always code instead of fixing a typo just to fix a future
compile issue?

Then your commit log is not about "fix typo", but rather remove a no-op
macro as the driver is always built-in and keeping that macro would not
help built-in code.

> but it
> is plausible people copied a common pattern and since no breakage was
> noticed left it as is.

This level of clarity is important to spell out in the commit log
message, specially if you are suggesting it is just a typo fix. Because
I will take it for granted that it is just that.

If it fixes a future use case where the typo would be more of an issue,
you can mention that in a secondary paragraph or sentence.

> It also raises the question how many modules have device tables, but
> do not call MODULE_DEVICE_TABLE since they are only ever built-in.
> Maybe there should be some build time enforcement mechanism to make
> sure that these are consistent.

Definitely, Nick Alcock is doing some related work where the semantics
of built-in modules needs to be clearer, he for instance is now removing
a few MODULE_() macros for things which *are never* modules, and this is
because after commit 8b41fc4454e ("kbuild: create modules.builtin
without Makefile.modbuiltin or tristate.conf") we rely on the module
license tag to generate the modules.builtin file. Without that commit
we end up traversing the source tree twice. Nick's work builds on
that work and futher clarifies these semantics by adding tooling which
complains when something which is *never* capable of being a module
uses module macros. The macro you are extending, MODULE_DEVICE_TABLE(),
today is a no-op for built-in, but you are adding support to extend it
for built-in stuff. Nick's work will help with clarifying symbol locality
and so he may be interested in your association for the data in
MODULE_DEVICE_TABLE and how you associate to a respective would-be
module. His work is useful for making tracing more accurate with respect
to symbol associations, so the data in MODULE_DEVICE_TABLE() may be
useful as well to him.

You folks may want to Cc each other on your patches.

If we know for certain things *will never* be used or *should not be
used*, as in the case of the module license tag, we should certainly
have tooling to pick up on that crap to help us tidy it up. 

If you determine MODULE_DEVICE_TABLE() *should* not be used for built-in
always code (never tristate) then you and Nick likely have overlap of
macros to tidy up and tooling to share to spot these sort of issues.

  Luis



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux