From: Brian Norris <computersforpeace@gmail.com>
To: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: devicetree@vger.kernel.org, Josh Wu <josh.wu@atmel.com>,
linux-mtd@lists.infradead.org,
David Woodhouse <dwmw2@infradead.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [PATCH] of_mtd: Add no-op stubs to support CONFIG_OF=n
Date: Mon, 2 Sep 2013 22:36:58 -0700 [thread overview]
Message-ID: <20130903053642.GA364@norris.computersforpeace.net> (raw)
In-Reply-To: <1378175873-2763-1-git-send-email-ezequiel.garcia@free-electrons.com>
On Mon, Sep 02, 2013 at 11:37:53PM -0300, Ezequiel Garcia wrote:
> Just like the rest of the subsystems, let's add the required no-op
> functions to implement stubs when CONFIG_OF=n.
>
> This prevents MTD drivers from having ugly ifdefs in their code,
> and instead hide the ifdef monster in the header closet (far away
> from people's sight).
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> include/linux/of_mtd.h | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h
> index ed7f267..66f173e 100644
> --- a/include/linux/of_mtd.h
> +++ b/include/linux/of_mtd.h
> @@ -14,6 +14,21 @@
> int of_get_nand_ecc_mode(struct device_node *np);
> int of_get_nand_bus_width(struct device_node *np);
> bool of_get_nand_on_flash_bbt(struct device_node *np);
> +#else
I would include an extra line on either side of #else.
> +static inline int of_get_nand_ecc_mode(struct device_node *np)
> +{
> + return -ENOSYS;
> +}
> +
> +static inline int of_get_nand_bus_width(struct device_node *np)
> +{
> + return -ENOSYS;
> +}
> +
> +static inline bool of_get_nand_on_flash_bbt(struct device_node *np)
> +{
> + return false;
> +}
> #endif
Although we are "hiding" the #ifdef's here in the header, we can still
help to make them extra clear; I think the typical style is to include
/* CONFIG_OF_MTD */ markers to show which #ifdef/#else/#endif block it
belongs to.
>
> #endif /* __LINUX_OF_MTD_H */
With this trivial changes, I amended your patch and pushed to
l2-mtd.git. Thanks! I look forward to the following patches to remove
some of the driver #ifdef's.
Thanks,
Brian
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2013-09-03 5:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 2:37 [PATCH] of_mtd: Add no-op stubs to support CONFIG_OF=n Ezequiel Garcia
2013-09-03 5:36 ` Brian Norris [this message]
2013-09-03 10:53 ` Ezequiel Garcia
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=20130903053642.GA364@norris.computersforpeace.net \
--to=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=ezequiel.garcia@free-electrons.com \
--cc=josh.wu@atmel.com \
--cc=linux-mtd@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).