Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4958478imm; Tue, 7 Aug 2018 10:06:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfU3oiTxgXmAl67FqmGMUzW2I6mnkI2ZdG4kpkIqiH3Vs1zBd7eLhnkOHNHYX4M9wEoXef0 X-Received: by 2002:a62:ed5:: with SMTP id 82-v6mr22740024pfo.198.1533661601756; Tue, 07 Aug 2018 10:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533661601; cv=none; d=google.com; s=arc-20160816; b=Mp1oAGX+m3j1TR3AoMwT2jH1GE/7qNHlm140Vgs7YVbKhpwDV6oPyRp4uoFVAYrsP5 Bxf31/3MXObEGEcgnIyBnHHZbNtYiXh+WgnzWUXGDu/etru43/rpAYqE94q72rlZ9qGU /sxOwLzRYCP6Z6yLD5cXlqJj5nUoS8XWTExySLk/qSEv6+EbEi8HOrzyrqunShrL3Aj3 vtkB3Qkec9qFE6PXyZrlV3YvlBF56519Mi4BQdsl/iaP+gdx+9bZz25odAMxJre6aDXc SEDQUQCy4D1YR7kb7zCSFKKtcyOo2lWj994CQ+dtHrsSOt00CRj08v+PodXPUbUzVsRj EhIA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=L7aBMe7z5VlYUqLIhu0UzWq4yufraFoU+9BSbAJEMlQ=; b=kSF1UVVQmqXhBNGLxCozCRn4a1v2Eah6uIeCyfv84kWrAYiedglFcSopnAQLmIjY2u mnF3beomvo+9lyQrHEnUAHTnnrLjRTiyUi4s0+noCz9P+L8ED7C4VQf+9piikd8aStUx cBW/esyi+CvBwmjCrI5yr9LEl9aPn+NThtNqaGzbGtRa4KZPSjpEwUAG9PloncjRqJVY C88D6TFst/f7oJxum1cM9IrkjRqVjHaxd6fVbNQgFQPv3WNURVa0Nyh0avK3JFCDsBhK US4srt4uNyzvnxlCgdcUOgGv1TZsFd3STfa/cxddyuGVlKmVxEvysmBa7vQVv5HLebbR uXhQ== 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 h90-v6si1362566plb.484.2018.08.07.10.06.26; Tue, 07 Aug 2018 10:06:41 -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 S2389932AbeHGTS6 (ORCPT + 99 others); Tue, 7 Aug 2018 15:18:58 -0400 Received: from mail.bootlin.com ([62.4.15.54]:36452 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388577AbeHGTS6 (ORCPT ); Tue, 7 Aug 2018 15:18:58 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 96BA32072C; Tue, 7 Aug 2018 19:03:40 +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 bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 8AF0D20908; Tue, 7 Aug 2018 19:02:55 +0200 (CEST) Date: Tue, 7 Aug 2018 19:02:56 +0200 From: Boris Brezillon To: Janusz Krzysztofik Cc: Linus Walleij , Jonathan Corbet , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Tony Lindgren , Aaro Koskinen , linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-doc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 08/12] mtd: rawnand: ams-delta: Simplify pointer resolution on read/write Message-ID: <20180807190256.092b2364@bbrezillon> In-Reply-To: <20180806222918.12644-9-jmkrzyszt@gmail.com> References: <20180718235710.18242-1-jmkrzyszt@gmail.com> <20180806222918.12644-1-jmkrzyszt@gmail.com> <20180806222918.12644-9-jmkrzyszt@gmail.com> 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=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Aug 2018 00:29:14 +0200 Janusz Krzysztofik wrote: > Simplify data read/write sub-functions by changing their APIs so they > accept driver private structure pointer instead of mtd_info. > > Signed-off-by: Janusz Krzysztofik Reviewed-by: Boris Brezillon Can you move that one earlier in the series so that it can be applied even if we're still discussing the GPIO bitmap changes? > --- > drivers/mtd/nand/raw/ams-delta.c | 40 ++++++++++++++++++++++------------------ > 1 file changed, 22 insertions(+), 18 deletions(-) > > diff --git a/drivers/mtd/nand/raw/ams-delta.c b/drivers/mtd/nand/raw/ams-delta.c > index d02c48c013e8..30c461138195 100644 > --- a/drivers/mtd/nand/raw/ams-delta.c > +++ b/drivers/mtd/nand/raw/ams-delta.c > @@ -76,10 +76,8 @@ static void ams_delta_write_commit(struct ams_delta_nand *priv) > gpiod_set_value(priv->gpiod_nwe, 1); > } > > -static void ams_delta_write_next_byte(struct mtd_info *mtd, u_char byte) > +static void ams_delta_write_next_byte(struct ams_delta_nand *priv, u_char byte) > { > - struct nand_chip *this = mtd_to_nand(mtd); > - struct ams_delta_nand *priv = nand_get_controller_data(this); > struct gpio_descs *data_gpiods = priv->data_gpiods; > unsigned long bits = byte; > int i, value_array[data_gpiods->ndescs]; > @@ -93,10 +91,8 @@ static void ams_delta_write_next_byte(struct mtd_info *mtd, u_char byte) > ams_delta_write_commit(priv); > } > > -static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) > +static void ams_delta_write_first_byte(struct ams_delta_nand *priv, u_char byte) > { > - struct nand_chip *this = mtd_to_nand(mtd); > - struct ams_delta_nand *priv = nand_get_controller_data(this); > struct gpio_descs *data_gpiods = priv->data_gpiods; > unsigned long bits = byte; > int i; > @@ -108,10 +104,8 @@ static void ams_delta_write_byte(struct mtd_info *mtd, u_char byte) > ams_delta_write_commit(priv); > } > > -static u_char ams_delta_read_next_byte(struct mtd_info *mtd) > +static u_char ams_delta_read_next_byte(struct ams_delta_nand *priv) > { > - struct nand_chip *this = mtd_to_nand(mtd); > - struct ams_delta_nand *priv = nand_get_controller_data(this); > struct gpio_descs *data_gpiods = priv->data_gpiods; > unsigned long bits = 0; > int i, value_array[data_gpiods->ndescs]; > @@ -131,38 +125,48 @@ static u_char ams_delta_read_next_byte(struct mtd_info *mtd) > return bits; > } > > -static u_char ams_delta_read_byte(struct mtd_info *mtd) > +static u_char ams_delta_read_first_byte(struct ams_delta_nand *priv) > { > - struct nand_chip *this = mtd_to_nand(mtd); > - struct ams_delta_nand *priv = nand_get_controller_data(this); > struct gpio_descs *data_gpiods = priv->data_gpiods; > int i; > > for (i = 0; i < data_gpiods->ndescs; i++) > gpiod_direction_input(data_gpiods->desc[i]); > > - return ams_delta_read_next_byte(mtd); > + return ams_delta_read_next_byte(priv); > +} > + > +static u_char ams_delta_read_byte(struct mtd_info *mtd) > +{ > + struct nand_chip *this = mtd_to_nand(mtd); > + struct ams_delta_nand *priv = nand_get_controller_data(this); > + > + return ams_delta_read_first_byte(priv); > } > > static void ams_delta_write_buf(struct mtd_info *mtd, const u_char *buf, > int len) > { > + struct nand_chip *this = mtd_to_nand(mtd); > + struct ams_delta_nand *priv = nand_get_controller_data(this); > int i; > > if (len > 0) > - ams_delta_write_byte(mtd, buf[0]); > + ams_delta_write_first_byte(priv, buf[0]); > for (i = 1; i < len; i++) > - ams_delta_write_next_byte(mtd, buf[i]); > + ams_delta_write_next_byte(priv, buf[i]); > } > > static void ams_delta_read_buf(struct mtd_info *mtd, u_char *buf, int len) > { > + struct nand_chip *this = mtd_to_nand(mtd); > + struct ams_delta_nand *priv = nand_get_controller_data(this); > int i; > > if (len > 0) > - buf[0] = ams_delta_read_byte(mtd); > + buf[0] = ams_delta_read_first_byte(priv); > for (i = 1; i < len; i++) > - buf[i] = ams_delta_read_next_byte(mtd); > + buf[i] = ams_delta_read_next_byte(priv); > } > > /* > @@ -186,7 +190,7 @@ static void ams_delta_hwcontrol(struct mtd_info *mtd, int cmd, > } > > if (cmd != NAND_CMD_NONE) > - ams_delta_write_byte(mtd, cmd); > + ams_delta_write_first_byte(priv, cmd); > } > > static int ams_delta_nand_ready(struct mtd_info *mtd)