Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1138822imu; Wed, 16 Jan 2019 13:27:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN4MDz5lkteAUGDuCum1HI5WT8bzBIM1v5QOc23zggqQx3GHfiG21Xgoc7VG8/Wd1aUK28UU X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr11465431plb.70.1547674055102; Wed, 16 Jan 2019 13:27:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547674055; cv=none; d=google.com; s=arc-20160816; b=I6B3b55/CjAUHPq4AAtlyLljpoTNK4hcp9GFyTY6vwURzZqQOOw67B8M1UBBhCFiDw uGQqAb0fAp/PE87rGjOHWFH/OckmPaK8QQRLNwDIBogduIdrgmAhIrqDvhYE8aOuSzAV XrRddjWsf7G+5Fs2ZNpt93NlRN/XIGOoOmac7lXkH3S81cDJJMUgonvpvlOgZL6Ue4SX dtuwFmeWTJAyEo95/2kPyP68mg1clPIdrN6AC2FISvOY3uC2uvEu5pUM8dxLKCe4OwTq dcEgtA2bxOkyLIs/AWPlzSR/yyZHJcRmHDJ0sjVBPlmm9dAdE7L4XPb0msaBH0idaF9M KD1Q== 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; bh=wPEfXx2dYe/jgdWEHp7zOpdgIl8D5UVA5aD2eKqtxMY=; b=BnYn/nHLABNu2wkdEgYb0d+qxBcppawEiJKK2T9KP1nyD0CbraDAiDYptFflyUDlUb Y8fquyPatP1CIftO2KAflLVn6bqVLDZPnXoUYRzNksZrUm4pds29qxui8Q+GrIWhSx3v vJGKnTFJDnuAHIPsKL5boSDGzZF3P7ms/W42OpQrBdTsfvbX3Ylr9ZanVVygZcmekpt8 Hzhk8K+TG6Pq3L55svwwONeh2+hdVluIz8f+o87e2E+wYUZRFYUb4tJEyL+acsb7D1wy Syc9Ksk908j1+5hTaPaHu0Hqx86HOXl22rNKAbJDI3o5CJuQ5STeuNhlurP6q+nlJAxv 7IHg== 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 r34si7289032pga.242.2019.01.16.13.27.17; Wed, 16 Jan 2019 13:27:35 -0800 (PST) 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 S2388953AbfAPKFB convert rfc822-to-8bit (ORCPT + 99 others); Wed, 16 Jan 2019 05:05:01 -0500 Received: from mail.bootlin.com ([62.4.15.54]:52687 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732165AbfAPKFA (ORCPT ); Wed, 16 Jan 2019 05:05:00 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 79C652074E; Wed, 16 Jan 2019 11:04:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 Received: from xps13 (aaubervilliers-681-1-37-87.w90-88.abo.wanadoo.fr [90.88.156.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 29E682073D; Wed, 16 Jan 2019 11:04:57 +0100 (CET) Date: Wed, 16 Jan 2019 11:04:57 +0100 From: Miquel Raynal To: Yoshio Furuyama Cc: bbrezillon@kernel.org, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, frieder.schrempf@kontron.De, peron.clem@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: spinand: Add support for all Toshiba Memory products Message-ID: <20190116110457.6ca57d77@xps13> In-Reply-To: <20190116055319.2755-1-tmcmc-mb-yfuruyama7@ml.toshiba.co.jp> References: <20190116055319.2755-1-tmcmc-mb-yfuruyama7@ml.toshiba.co.jp> Organization: Bootlin X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.32; 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 Yoshio, Yoshio Furuyama wrote on Wed, 16 Jan 2019 14:53:19 +0900: > Add device table for Toshiba Memory products. > Also, generalize OOB layout structure and function names. > > Signed-off-by: Yoshio Furuyama > > --- > drivers/mtd/nand/spi/toshiba.c | 79 +++++++++++++++++++++++++++++++++------- > 1 file changed, 65 insertions(+), 14 deletions(-) > > diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c > index 0812655..0916962 100644 > --- a/drivers/mtd/nand/spi/toshiba.c > +++ b/drivers/mtd/nand/spi/toshiba.c > @@ -25,19 +25,19 @@ static SPINAND_OP_VARIANTS(write_cache_variants, > static SPINAND_OP_VARIANTS(update_cache_variants, > SPINAND_PROG_LOAD(false, 0, NULL, 0)); > > -static int tc58cvg2s0h_ooblayout_ecc(struct mtd_info *mtd, int section, > +static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section, > struct mtd_oob_region *region) > { > - if (section > 7) > + if (section > 0) > return -ERANGE; > > - region->offset = 128 + 16 * section; > - region->length = 16; > + region->offset = mtd->oobsize / 2; > + region->length = mtd->oobsize / 2; > > return 0; > } > > -static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section, > +static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section, > struct mtd_oob_region *region) > { > if (section > 0) > @@ -45,17 +45,17 @@ static int tc58cvg2s0h_ooblayout_free(struct mtd_info *mtd, int section, > > /* 2 bytes reserved for BBM */ > region->offset = 2; > - region->length = 126; > + region->length = mtd->oobsize / 2 - 2; I know this is valid C but I am always puzzled when reading such mathematical operation, I would prefer (mtd->oobsize / 2) - 2. I'm fine with the rest so if there is no other comment I will fix when applying. Thanks, Miquèl