mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RFC: get rid of #ifdef CONFIG_OF's around of match tables
@ 2019-05-31 11:54 Enrico Weigelt, metux IT consult
  2019-05-31 11:54 ` [PATCH 1/3] mod_devicetable: helper macro for declaring oftree module device table Enrico Weigelt, metux IT consult
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2019-05-31 11:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe, herbert, davem, linux-block, linux-crypto

Hi folks,


we've got many places where code declaring oftree match tables is
enclodes by #ifdef CONFIG_OF, so it can also be built w/o oftree
support.

To make this easier to read, I'm proposing a new helper macro
MODULE_OF_TABLE(foo) which just calls MODULE_DEVICE_TABLE(of, foo)
when CONFIG_OF enabled, otherwise just noop. Along w/ of_match_ptr(),
we can get rid most of these #ifdef CONFIG_OF cases. I believe, the
compiler can automatically optimize-away the unused tables.
(correct me if I'm wrong)

This queue just introduces the macro and converts two random examples.
I'll post more patches for the rest of the tree, if you folks aggree
to this approach. And also I'd like to do the same w/ ACPI, PCI, etc.

Another idea I'm currently thinking about is moving the whole table
definition into a macro call, so the tables won't even get defined
when CONFIG_OF isn't defined, and we've got even less to type. It
then would look like this:

    MODULE_DECLARE_OF_MATCH(foo_of_match,
        { .compatible = "acme,foo" },
        { .compatible = "acme,bar" })

(note that the macro also defines the sentinel on its own).


What do you think about this idea ?


--mtx



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-05-31 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 11:54 RFC: get rid of #ifdef CONFIG_OF's around of match tables Enrico Weigelt, metux IT consult
2019-05-31 11:54 ` [PATCH 1/3] mod_devicetable: helper macro for declaring oftree module device table Enrico Weigelt, metux IT consult
2019-05-31 11:54 ` [PATCH 2/3] drivers: block: xsysace: use MODULE_OF_TABLE() and of_match_ptr() Enrico Weigelt, metux IT consult
2019-05-31 11:54 ` [PATCH 3/3] drivers: crypto: picoxcell_crypto: use MODULE_OF_TABLE() Enrico Weigelt, metux IT consult

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®