RFC: get rid of #ifdef CONFIG_OF's around of match tables

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

 



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





[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux