Received: by 10.213.65.68 with SMTP id h4csp690762imn; Wed, 4 Apr 2018 05:46:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/kFqgzMNlJLI1dajnrfJnax9P23g3b2DOZ34BXBLCR4X2oxdwLqP07yGbbhvx9VVqufxl0 X-Received: by 2002:a17:902:6b49:: with SMTP id g9-v6mr18675381plt.75.1522845965039; Wed, 04 Apr 2018 05:46:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522845964; cv=none; d=google.com; s=arc-20160816; b=maZxiduX1zI11L2k1l/wDAOzuQ9za4/KIkkS9ylcqBrjU5cmpQ5d4+1X+kngXCU0Lf fL8AbUMM2WY5qq62U2K8PYiNWjRmBR28aBuxyDv8ywQc4GAndEKaneOfR0LNOAWZOGaM E3JDNxKFhB5j1XBMQKt2bBdyf9kjXwsTtk2g9gYUVirwBAFwl4Mb7keec0lVW7G1GavV T2L5i9Rx/Fzw+p1z1PCGRMk8BIiGqNCTXgFytXV1WBW0RaUrNDvYn3NW929dPAsxK8HD LK055I8rlezN5uh9eXBNzHv0mlrLlGyyTvZA+5cCa3ummElsLyZSgZlRRmrQXyhWcaIR isrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=EM6FL5rdLvMh1YGKHsBasFaK0gWc0134Rw0YuE1GLEw=; b=Ds9JrcWk9yMtZ03S6it/vz7psKCWKuXPGTnpvfrcSG3OOCyuG+jeEbd5Nd7i3eoGg+ vXcj0qXcikHvUSDzUsG54lLFm1/QKqMcSfP5x4RinqNveCfqGNhyHAPxNmmAWFvdtJKc nPIIUEY3H0qi5kX3+XnH7Plx1zUmv/7bT6uE0+E4aXi3e+Fi4td0pVQ3ISVyNtHz0uZV tK2RhhzLT1PiQVpUU0Njy/G6kxOgdquPFCOg3PtE6sg2fCTsAtUEUryHHnUIZUOckLSL D2An2wlCjernWjabNJ0oHeu8wbKO98EYTMr3dxYbHsEcuOkGk+mGET4m1sgrWnx0fbeY tCwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=CUl0/uMi; dkim=pass header.i=@codeaurora.org header.s=default header.b=jDprduqE; 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 u7si2633682pgv.251.2018.04.04.05.45.46; Wed, 04 Apr 2018 05:46:04 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=CUl0/uMi; dkim=pass header.i=@codeaurora.org header.s=default header.b=jDprduqE; 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 S1751517AbeDDMnQ (ORCPT + 99 others); Wed, 4 Apr 2018 08:43:16 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41176 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbeDDMnN (ORCPT ); Wed, 4 Apr 2018 08:43:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5EFC360F6B; Wed, 4 Apr 2018 12:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522845793; bh=czDmo59CkQ01tLn9KqVdu3ZTPvktHITLkybezYuAeFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CUl0/uMi7vojC0mz6RcmJXrmPYMVQsc417mjcTghqg7dxjts5Kjtaox8BYARyprNK 35mZI3GaPDEmNwpL2mU/d8+xjZTiT1Xm7gE4CdOjB6pqWsdgXXN1JdatRF5TP5Lc9p KFBmpX/lwQWasui2wUBuvJLviDxZ6r9Fq5OzjZfI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7A27060F72; Wed, 4 Apr 2018 12:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522845792; bh=czDmo59CkQ01tLn9KqVdu3ZTPvktHITLkybezYuAeFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDprduqE4UVqrP0vjAYqEGlmWhpqeOdW5nniH/Zv5qs9Xt3IG0vF0RRwUB+ptnOwf N/daBjcyfI3g4E/uOUWoP14g1BX88zw8dIZPgklT5nx3jcNP8DL4uoPjJ5ah5sHkUr q+kvwqJnBAz6j/7D1KCO+Zat7/GyYiaUd0HEu8vI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7A27060F72 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Boris Brezillon Cc: 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 , Abhishek Sahu Subject: [PATCH 5/9] mtd: nand: qcom: parse read errors for read oob also Date: Wed, 4 Apr 2018 18:12:21 +0530 Message-Id: <1522845745-6624-6-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org read_page and read_oob both calls the read_page_ecc function. The QCOM NAND controller protect the OOB available bytes with ECC so read errors should be checked for read_oob also. Now this patch moves the error checking code inside read_page_ecc so caller does not have to check explicitly for read errors. Signed-off-by: Abhishek Sahu --- drivers/mtd/nand/qcom_nandc.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c index 0ebcc55..ba43752 100644 --- a/drivers/mtd/nand/qcom_nandc.c +++ b/drivers/mtd/nand/qcom_nandc.c @@ -1676,6 +1676,7 @@ static int read_page_ecc(struct qcom_nand_host *host, u8 *data_buf, struct nand_chip *chip = &host->chip; struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); struct nand_ecc_ctrl *ecc = &chip->ecc; + u8 *data_buf_start = data_buf, *oob_buf_start = oob_buf; int i, ret; config_nand_page_read(nandc); @@ -1741,6 +1742,9 @@ static int read_page_ecc(struct qcom_nand_host *host, u8 *data_buf, free_descs(nandc); + if (!ret) + ret = parse_read_errors(host, data_buf_start, oob_buf_start); + return ret; } @@ -1786,20 +1790,14 @@ static int qcom_nandc_read_page(struct mtd_info *mtd, struct nand_chip *chip, struct qcom_nand_host *host = to_qcom_nand_host(chip); struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); u8 *data_buf, *oob_buf = NULL; - int ret; nand_read_page_op(chip, page, 0, NULL, 0); data_buf = buf; oob_buf = oob_required ? chip->oob_poi : NULL; clear_bam_transaction(nandc); - ret = read_page_ecc(host, data_buf, oob_buf); - if (ret) { - dev_err(nandc->dev, "failure to read page\n"); - return ret; - } - return parse_read_errors(host, data_buf, oob_buf); + return read_page_ecc(host, data_buf, oob_buf); } /* implements ecc->read_page_raw() */ @@ -1889,7 +1887,6 @@ static int qcom_nandc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, struct qcom_nand_host *host = to_qcom_nand_host(chip); struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip); struct nand_ecc_ctrl *ecc = &chip->ecc; - int ret; clear_read_regs(nandc); clear_bam_transaction(nandc); @@ -1898,11 +1895,7 @@ static int qcom_nandc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, set_address(host, 0, page); update_rw_regs(host, ecc->steps, true); - ret = read_page_ecc(host, NULL, chip->oob_poi); - if (ret) - dev_err(nandc->dev, "failure to read oob\n"); - - return ret; + return read_page_ecc(host, NULL, chip->oob_poi); } /* implements ecc->write_page() */ -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation