Re: [PATCH RFC] modpost: Support I2C Aliases from OF tables

From: Enrico Weigelt, metux IT consult
Date: Thu Aug 08 2019 - 10:00:42 EST


On 08.08.19 15:24, Andy Shevchenko wrote:
On Thu, Aug 08, 2019 at 03:12:47PM +0200, Enrico Weigelt, metux IT consult wrote:
On 06.08.19 19:12, Javier Martinez Canillas wrote:

Right, we could add a macro for that. Although it should probably be called
I2C_OF_MODULE_DEVICE_TABLE() or something like that since is specific to OF.

At that point it should be completely noop when OF is disabled, so we
also can get rid of many ifdef's.

Why?

For cases where drivers work w/ or w/o oftree. Not sure whether it
applies to i2c specifically, but there're other places where we still
need nasty ifdef's (eg. gpio-keyboard).

I've got some patch somewhere for introducing a MODULE_OF_TABLE() macro
as replacement for many MODULE_DEVICE_TABLE(of, ...) cases, which noops
when CONFIG_OF is disabled. (and similar ones for other table types).

It's simple wrong to have #ifdef CONFIG_OF without counterpart of_match_ptr().

Of course, but that's just a part of the story. (actually I'd prefer
using it everywhere, even if the driver only supports oftree).

And taking into consideration that ID table itself doesn't depend to OF at all,
why not simple drop that #ifdef and of_match_ptr() all together?

Consumes less space. Yes, it isn't much, but in some scenarios one needs
to heavily reduce the kernel size. And I wouldn't like to use
of_match_ptr() inside a MODULE_DEVICE_TABLE() call :o


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@xxxxxxxxx -- +49-151-27565287