devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: "Gupta, Pekon" <pekon@ti.com>
Cc: "mark.rutland@arm.com" <mark.rutland@arm.com>,
	"robherring2@gmail.com" <robherring2@gmail.com>,
	"olof@lixom.net" <olof@lixom.net>,
	"dedekind1@gmail.com" <dedekind1@gmail.com>,
	"Pawel.Moll@arm.com" <Pawel.Moll@arm.com>,
	"ijc+devicetree@hellion.org.uk" <ijc+devicetree@hellion.org.uk>,
	"swarren@wwwdotorg.org" <swarren@wwwdotorg.org>,
	"dwmw2@infradead.org" <dwmw2@infradead.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"tony@atomide.com" <tony@atomide.com>,
	"bcousson@baylibre.com" <bcousson@baylibre.com>,
	"avinashphilipk@gmail.com" <avinashphilipk@gmail.com>,
	"Balbi, Felipe" <balbi@ti.com>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v8 3/6] mtd:nand:omap2: clean-up BCHx_HW and BCHx_SW ECC configurations in device_probe
Date: Sat, 12 Oct 2013 18:40:54 -0700	[thread overview]
Message-ID: <5259FA26.8090805@gmail.com> (raw)
In-Reply-To: <20980858CB6D3A4BAE95CA194937D5E73EA218B5@DBDE04.ent.ti.com>

Hi Pekon,

On 10/12/2013 04:58 PM, Gupta, Pekon wrote:
>> From: Brian Norris [mailto:computersforpeace@gmail.com]
>>> On Fri, Oct 11, 2013 at 07:06:40PM +0530, Pekon Gupta wrote:
> [...]
>> Why do you even need the #ifdef's for the #include's? It is not harmful
>> to include headers for stuff that is only conditionally used. In fact,
>> this creates a problem later when you try to use nand_bch_free(), and
>> you have to surround it with extra #ifdef's.
>>
>> In short: these #ifdef's just breed more #ifdef's and cause the code to
>> become harder to read and less maintainable.

First off, I should clarify this: the above comment was speaking *only* 
about surrounding the #include's with #ifdef's. Such #ifdef's only make 
everything else harder.

Now, I recognize that there are still many cases where you may need 
#ifdef's in the body of the code. I was only trying to hit the easiest ones.

> There are 2 problems here:
> (1)
> I have removed #ifdef across headers in next version. But I cannot remove
> #ifdef across some callbacks for  cc.hwctl(), ecc.calculate(), ecc.correct(),
> because then compilation would throw warnings for un-used functions.

The __maybe_unused attribute can be given to functions that will compile 
but are unused, and the compiler will just remove unused ones from the 
binary without warning. That is probably (weakly) preferable to 
#ifdef's, if you can manage it. But I understand some #ifdef's are 
necessary.

> (2)
> OMAP driver uses generic lib/bch.c which is compiled only when
> CONFIG_MTD_NAND_ECC_BCH is enabled. So to avoid compilation
> issues, I had to put #ifdefs on all wrapper functions which use lib/bch.c
> or nand_bch.c

nand_bch.c (and its corresponding nand_bch.h) has stub implementations 
so that extra #ifdef's often aren't needed. But include/linux/bch.h does 
not, so you are correct.

> I myself have tried in previous versions to avoid #ifdefs, but I ended
> up in one or the other problem like (1) |  (2) above.
> And this is where randconfig test failed earlier when Arnd Bergmann
> commented, so some #ifdef would hv to be carried till be deprecate
> some legacy ecc-schemes.
> However, with patch split many redundant #ifdefs are now removed.

Great, thanks for the effort.

Regards,
Brian

  reply	other threads:[~2013-10-13  1:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 13:36 [PATCH v8 0/6] mtd:nand:omap2: clean-up of supported ECC schemes Pekon Gupta
2013-10-11 13:36 ` [PATCH v8 1/6] mtd: nand: omap: combine different flavours of 1-bit hamming ecc schemes Pekon Gupta
2013-10-11 15:55   ` Felipe Balbi
2013-10-11 18:33     ` Tony Lindgren
2013-10-11 13:36 ` [PATCH v8 2/6] ARM: OMAP2+: cleaned-up DT support of various ECC schemes Pekon Gupta
2013-10-11 15:55   ` Felipe Balbi
2013-10-11 18:32     ` Tony Lindgren
2013-10-11 13:36 ` [PATCH v8 3/6] mtd:nand:omap2: clean-up BCHx_HW and BCHx_SW ECC configurations in device_probe Pekon Gupta
2013-10-11 15:55   ` Felipe Balbi
2013-10-11 19:28   ` Brian Norris
2013-10-12 23:58     ` Gupta, Pekon
2013-10-13  1:40       ` Brian Norris [this message]
2013-10-11 13:36 ` [PATCH v8 4/6] mtd:nand:omap2: updated support for BCH4 ECC scheme Pekon Gupta
2013-10-11 15:55   ` Felipe Balbi
2013-10-11 20:28   ` Brian Norris
2013-10-11 13:36 ` [PATCH v8 5/6] ARM: dts: AM33xx: updated default ECC scheme in nand-ecc-opt Pekon Gupta
2013-10-11 15:56   ` Felipe Balbi
2013-10-11 13:36 ` [PATCH v8 6/6] mtd: nand: omap: updated devm_xx for all resource allocation and free calls Pekon Gupta
2013-10-11 15:56   ` Felipe Balbi
2013-10-11 18:15   ` Brian Norris
2013-10-11 18:28     ` Tony Lindgren
2013-10-11 19:27       ` Brian Norris
2013-10-11 21:46         ` Tony Lindgren
2013-10-11 22:14           ` Brian Norris
2013-10-11 21:09 ` [PATCH v8 0/6] mtd:nand:omap2: clean-up of supported ECC schemes Brian Norris
2013-10-12 22:26   ` Gupta, Pekon
2013-10-13  1:40     ` 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=5259FA26.8090805@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=Pawel.Moll@arm.com \
    --cc=arnd@arndb.de \
    --cc=avinashphilipk@gmail.com \
    --cc=balbi@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=dedekind1@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=olof@lixom.net \
    --cc=pekon@ti.com \
    --cc=robherring2@gmail.com \
    --cc=swarren@wwwdotorg.org \
    --cc=tony@atomide.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 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).