Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2050168imm; Mon, 28 May 2018 00:10:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpE9aM9oheRALXNqB0LcIBLQD1IZY/DNHzDPRQ+FrogGxQu4NUk8epgAPfrYIxiPp58hD7U X-Received: by 2002:a63:8ec8:: with SMTP id k191-v6mr9616514pge.435.1527491419630; Mon, 28 May 2018 00:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527491419; cv=none; d=google.com; s=arc-20160816; b=eZBP736enteq25p5kK6cgV7RfDETnrj5GM9ZEEC0FUpbgeHexadKsfBWsKPOP0l4Ie ClgI9F8eOrQhpo4+MChHmc/6o141c8g2F1DflTCb3IL/E+EXsoksVN/L+ctHl5CzEZij EqLafn7J7p4GPSTEuVwdiYVcLLWZ6EpcoC7CgGdGUK8hGpjiY9kTjDzVldrBtkLXyt4z VF8RZl2ZfW5FpW00dXT+K0sKZG9KoMPqNNq+qUkNX8hS2h/2SMG4p3hlETItpDfvQDW9 XRhSOWn/BudoGhhsVKO5eiKi16j/bI6BMO90oz0yUNIeO/tjrJxIY7vnRj69PiEWD+M8 HF8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=v/XLuPU/oQdwOwKV7UCnQToiNJDXU1qOHnyaICw6Sdg=; b=qkrdgNGu4SavBUdXJtU+hVgsOFRT5OEv8y0lGv5q1vujmiU2hNnX6GplUl2qwp9NUg QjtDrXX9BztKFaXywtyXTRROExnX822u3RbwdbRJ2r147vLUjxqjt9We+k+WmmRsYdJL e6JGcttYcFXW/zTrSsQCw58PmJWXWZ//9EXj78xpoUNi+Y67JodjMA6sdWCIRufXFC/p ex0cQhc4qv0CGqct57ypstmQfvzS/5EZ1kiIPhjyjWQNnc/MvOwRMz/fqZMxQkfq3tiM Q51iLAR8ELy21krNld8czh2upM4ZfQkPM65ugZa4yLUFuGNy/HrMBypaa3O8eZpRLZt0 EoCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1-v6si13565099pgs.623.2018.05.28.00.10.04; Mon, 28 May 2018 00:10:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753795AbeE1HJj convert rfc822-to-8bit (ORCPT + 99 others); Mon, 28 May 2018 03:09:39 -0400 Received: from mail.bootlin.com ([62.4.15.54]:35075 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753658AbeE1HJe (ORCPT ); Mon, 28 May 2018 03:09:34 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 71B8420750; Mon, 28 May 2018 09:09:32 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from xps13 (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 15A7720012; Mon, 28 May 2018 09:09:32 +0200 (CEST) Date: Mon, 28 May 2018 09:09:31 +0200 From: Miquel Raynal To: Abhishek Sahu Cc: Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Cyrille Pitchen , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Andy Gross , Archit Taneja Subject: Re: [PATCH v3 13/16] mtd: rawnand: qcom: minor code reorganization for bad block check Message-ID: <20180528090931.4a208c62@xps13> In-Reply-To: References: <1527250904-21988-1-git-send-email-absahu@codeaurora.org> <1527250904-21988-14-git-send-email-absahu@codeaurora.org> <20180526104900.139dd19b@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Abhishek, On Mon, 28 May 2018 11:46:47 +0530, Abhishek Sahu wrote: > On 2018-05-26 14:28, Miquel Raynal wrote: > > Hi Abhishek, > > > >> @@ -2141,12 +2127,10 @@ static int qcom_nandc_block_bad(struct >> mtd_info *mtd, loff_t ofs) > >> goto err; > >> } > >> >> - bbpos = mtd->writesize - host->cw_size * (ecc->steps - 1); > >> - > >> - bad = nandc->data_buffer[bbpos] != 0xff; > >> + bad = bbm_bytes_buf[0] != 0xff; > > > BTW, as there are host->bbm_size bytes that can inform on the block > > state, don't we need to check all of them? > > > We are checking all of them. > host->bbm_size will be either 1 (for NAND_BUSWIDTH_8) or > 2 (for NAND_BUSWIDTH_16). > > https://elixir.bootlin.com/linux/v4.17-rc7/source/drivers/mtd/nand/raw/qcom_nandc.c#L2347 > > Thanks, > Abhishek > > >> >> if (chip->options & NAND_BUSWIDTH_16) > >> - bad = bad || (nandc->data_buffer[bbpos + 1] != 0xff); > >> + bad = bad || (bbm_bytes_buf[1] != 0xff); As told in my previous reply, I missed the above line. However, after checking the code of the core (nand_base.c) I wonder if it is useful to check for the second byte. And if you look at the core's implementation you'll see that the offset is not always 0 in the OOB but maybe 5 for small page NAND chips. Please have a look to the generic implementation and tell me why this is really needed? Thanks, Miquèl