From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161331AbbBEC3p (ORCPT ); Wed, 4 Feb 2015 21:29:45 -0500 Received: from us2.outbound.mailhostbox.com ([162.210.70.52]:37816 "EHLO us2.outbound.mailhostbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753982AbbBEC3n (ORCPT ); Wed, 4 Feb 2015 21:29:43 -0500 X-Greylist: delayed 532 seconds by postgrey-1.27 at vger.kernel.org; Wed, 04 Feb 2015 21:29:43 EST Message-ID: <54D2D36A.4030800@pek-sem.com> Date: Thu, 05 Feb 2015 07:50:26 +0530 From: pekon User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Nicholas Mc Guire , David Woodhouse CC: Roger Quadros , Tony Lindgren , linux-kernel@vger.kernel.org, Rostislav Lisovy , linux-mtd@lists.infradead.org, Ezequiel Garcia , Brian Norris , pekon gupta Subject: Re: [PATCH v2] mtd: nand: omap: drop condition with no effect References: <1423070646-12906-1-git-send-email-hofrat@osadl.org> In-Reply-To: <1423070646-12906-1-git-send-email-hofrat@osadl.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-CTCH-RefID: str=0001.0A020205.54D2D381.00D7,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.001 X-CTCH-Rules: C_4847, X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CTCH-SenderID: pekon@pek-sem.com X-CTCH-SenderID-TotalMessages: 1 X-CTCH-SenderID-TotalSpam: 0 X-CTCH-SenderID-TotalSuspected: 0 X-CTCH-SenderID-TotalBulk: 0 X-CTCH-SenderID-TotalConfirmed: 0 X-CTCH-SenderID-TotalRecipients: 0 X-CTCH-SenderID-TotalVirus: 0 X-CTCH-SenderID-BlueWhiteFlag: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 04 February 2015 10:54 PM, Nicholas Mc Guire wrote: > The if and the else branch code are identical - so the condition has no > effect on the effective code. This patch removes the condition and the > duplicated code and updates the documentation as suggested by > Roger Quadros . > > Acked-by: Roger Quadros > Signed-off-by: Nicholas Mc Guire > --- > > v2: Confirmation of proposed patch and update of the related documentation > as provided by Roger Quadros > > The conditions in the OMAP_ECC_BCH8_CODE_HW_DETECTION_SW and > OMAP_ECC_BCH4_CODE_HW_DETECTION_SW case have no effect and can > be removed. > > Patch was only compile tested with arm-linux-gnueabi-4.7-, current > crosstool-ng did not seem to build omap2 properly. > Config is omap2plus_defconfig which implies CONFIG_MTD_NAND_OMAP2=y. > > Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) > > drivers/mtd/nand/omap2.c | 31 +++++++++---------------------- > 1 file changed, 9 insertions(+), 22 deletions(-) > > diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c > index 63f858e..60fa899 100644 > --- a/drivers/mtd/nand/omap2.c > +++ b/drivers/mtd/nand/omap2.c > @@ -1048,10 +1048,9 @@ static int omap_dev_ready(struct mtd_info *mtd) > * @mtd: MTD device structure > * @mode: Read/Write mode > * > - * When using BCH, sector size is hardcoded to 512 bytes. > - * Using wrapping mode 6 both for reading and writing if ELM module not uses > - * for error correction. > - * On writing, > + * When using BCH with SW correction (i.e. no ELM), sector size is set > + * to 512 bytes and we use BCH_WRAPMODE_6 wrapping mode > + * for both reading and writing with: > * eccsize0 = 0 (no additional protected byte in spare area) > * eccsize1 = 32 (skip 32 nibbles = 16 bytes per sector in spare area) > */ > @@ -1071,15 +1070,9 @@ static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode) > case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: > bch_type = 0; > nsectors = 1; > - if (mode == NAND_ECC_READ) { > - wr_mode = BCH_WRAPMODE_6; > - ecc_size0 = BCH_ECC_SIZE0; > - ecc_size1 = BCH_ECC_SIZE1; > - } else { > - wr_mode = BCH_WRAPMODE_6; > - ecc_size0 = BCH_ECC_SIZE0; > - ecc_size1 = BCH_ECC_SIZE1; > - } > + wr_mode = BCH_WRAPMODE_6; > + ecc_size0 = BCH_ECC_SIZE0; > + ecc_size1 = BCH_ECC_SIZE1; > break; > case OMAP_ECC_BCH4_CODE_HW: > bch_type = 0; > @@ -1097,15 +1090,9 @@ static void __maybe_unused omap_enable_hwecc_bch(struct mtd_info *mtd, int mode) > case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW: > bch_type = 1; > nsectors = 1; > - if (mode == NAND_ECC_READ) { > - wr_mode = BCH_WRAPMODE_6; > - ecc_size0 = BCH_ECC_SIZE0; > - ecc_size1 = BCH_ECC_SIZE1; > - } else { > - wr_mode = BCH_WRAPMODE_6; > - ecc_size0 = BCH_ECC_SIZE0; > - ecc_size1 = BCH_ECC_SIZE1; > - } > + wr_mode = BCH_WRAPMODE_6; > + ecc_size0 = BCH_ECC_SIZE0; > + ecc_size1 = BCH_ECC_SIZE1; > break; > case OMAP_ECC_BCH8_CODE_HW: > bch_type = 1; > Thanks for the clean-up .. Reviewed-by: Pekon Gupta with regards, pekon ------------------------ Powered by BigRock.com