From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: "Gupta, Pekon" <pekon@ti.com>
Cc: Huang Shijie <b32955@freescale.com>,
"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: gpmi: add gpmi_devdata{} to simplify the code
Date: Fri, 21 Mar 2014 11:51:15 -0300 [thread overview]
Message-ID: <20140321145115.GA628@arch.cereza> (raw)
In-Reply-To: <20980858CB6D3A4BAE95CA194937D5E73EAB4F02@DBDE04.ent.ti.com>
On Mar 21, Gupta, Pekon wrote:
> >From: Huang Shijie [mailto:b32955@freescale.com]
[..[
> >> Can you use "compatible" string in DT for this ?
> >>
> >>
> >sorry, could you please give me an example?
> >
> >I do not know what's your meaning. :(
> >
>
> Can you use something like this, instead of populating static for each chip.
>
> if (of_device_is_compatible(of_node, "imx23") || of_device_is_compatible(child, "imx28")) {
> bch_max_ecc_strength = 20;
> max_chain_delay = 16;
> } elseif (of_device_is_compatible(of_node, "imx6q") {
> bch_max_ecc_strength = 40;
> max_chain_delay = 12;
> } elseif (of_device_is_compatible(of_node, "imx6sx") {
> bch_max_ecc_strength = 40;
> max_chain_delay = 0; /* whatever is here */
> } else {
> bch_max_ecc_strength = 1; /* whatever is default */
> max_chain_delay = 0; /* whatever is default */
> }
>
IMHO, this is much more expensive, harder to maintain and less readable.
Using the compatible string to match a compatible data, and putting IP-specific
data in there (just like this patch is doing), seems like a much nicer approach.
FWIW, we are using the same trick on a few mvebu drivers.
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-03-21 14:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-21 10:19 [PATCH] mtd: gpmi: add gpmi_devdata{} to simplify the code Huang Shijie
2014-03-21 10:29 ` Gupta, Pekon
2014-03-21 10:35 ` Huang Shijie
2014-03-21 11:15 ` Gupta, Pekon
2014-03-21 14:51 ` Ezequiel Garcia [this message]
2014-03-24 2:28 ` Huang Shijie
2014-04-16 7:53 ` Brian Norris
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=20140321145115.GA628@arch.cereza \
--to=ezequiel.garcia@free-electrons.com \
--cc=b32955@freescale.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=pekon@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.