mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
To: linux-kernel@vger.kernel.org
Cc: axboe@kernel.dk, herbert@gondor.apana.org.au,
	davem@davemloft.net, linux-block@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: RFC: get rid of #ifdef CONFIG_OF's around of match tables
Date: Fri, 31 May 2019 13:54:47 +0200	[thread overview]
Message-ID: <1559303690-8108-1-git-send-email-info@metux.net> (raw)

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



             reply	other threads:[~2019-05-31 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 11:54 Enrico Weigelt, metux IT consult [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559303690-8108-1-git-send-email-info@metux.net \
    --to=info@metux.net \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®