All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
To: u-boot@lists.denx.de
Cc: Amarula patchwork <linux-amarula@amarulasolutions.com>,
	michael@amarulasolutions.com,
	Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Simon Glass <sjg@chromium.org>, Wolfgang Denk <wd@denx.de>
Subject: [PATCH v4 04/14] mtd: nand: Get rid of mtd variable in function calls
Date: Fri, 22 Jul 2022 18:09:58 +0200	[thread overview]
Message-ID: <20220722161009.2686504-5-dario.binacchi@amarulasolutions.com> (raw)
In-Reply-To: <20220722161009.2686504-1-dario.binacchi@amarulasolutions.com>

From: Michael Trimarchi <michael@amarulasolutions.com>

chip points to mtd. Passing chip is enough to have a reference
to mtd when is necessary

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---

(no changes since v3)

Changes in v3:
- Fix code style warnings raised by patman.

 drivers/mtd/nand/raw/nand_base.c | 25 +++++++++++++------------
 include/linux/mtd/rawnand.h      |  3 +--
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 0900e6dbf9a6..145de22be852 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4160,8 +4160,9 @@ static int nand_get_bits_per_cell(u8 cellinfo)
  * chip. The rest of the parameters must be decoded according to generic or
  * manufacturer-specific "extended ID" decoding patterns.
  */
-static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip)
+static void nand_decode_ext_id(struct nand_chip *chip)
 {
+	struct mtd_info *mtd = &chip->mtd;
 	int extid, id_len;
 	/* The 3rd id byte holds MLC / multichip data */
 	chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]);
@@ -4291,7 +4292,7 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip)
  * compliant and does not have a full-id or legacy-id entry in the nand_ids
  * table.
  */
-static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chip)
+static void nand_manufacturer_detect(struct nand_chip *chip)
 {
 	/*
 	 * Try manufacturer detection if available and use
@@ -4301,7 +4302,7 @@ static void nand_manufacturer_detect(struct mtd_info *mtd, struct nand_chip *chi
 	    chip->manufacturer.desc->ops->detect)
 		chip->manufacturer.desc->ops->detect(chip);
 	else
-		nand_decode_ext_id(mtd, chip);
+		nand_decode_ext_id(chip);
 }
 
 /*
@@ -4324,9 +4325,9 @@ static int nand_manufacturer_init(struct nand_chip *chip)
  * decodes a matching ID table entry and assigns the MTD size parameters for
  * the chip.
  */
-static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip,
-				struct nand_flash_dev *type)
+static void nand_decode_id(struct nand_chip *chip, struct nand_flash_dev *type)
 {
+	struct mtd_info *mtd = &chip->mtd;
 	int maf_id = chip->id.data[0];
 
 	mtd->erasesize = type->erasesize;
@@ -4439,11 +4440,11 @@ static const struct nand_manufacturers *nand_get_manufacturer_desc(u8 id)
 /*
  * Get the flash and manufacturer id and lookup if the type is supported.
  */
-struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
-						  struct nand_chip *chip,
-						  int *maf_id, int *dev_id,
-						  struct nand_flash_dev *type)
+struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip, int *maf_id,
+					   int *dev_id,
+					   struct nand_flash_dev *type)
 {
+	struct mtd_info *mtd = &chip->mtd;
 	const struct nand_manufacturers *manufacturer_desc;
 	int busw, ret;
 	u8 *id_data = chip->id.data;
@@ -4539,9 +4540,9 @@ struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 	chip->chipsize = (uint64_t)type->chipsize << 20;
 
 	if (!type->pagesize) {
-		nand_manufacturer_detect(mtd, chip);
+		nand_manufacturer_detect(chip);
 	} else {
-		nand_decode_id(mtd, chip, type);
+		nand_decode_id(chip, type);
 	}
 
 	/* Get chip options */
@@ -4729,7 +4730,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
 	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
 
 	/* Read the flash type */
-	type = nand_get_flash_type(mtd, chip, &nand_maf_id,
+	type = nand_get_flash_type(chip, &nand_maf_id,
 				   &nand_dev_id, table);
 
 	if (IS_ERR(type)) {
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 57fe7fb47bd8..d8141cb4d114 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -29,8 +29,7 @@ struct nand_flash_dev;
 struct device_node;
 
 /* Get the flash and manufacturer id and lookup if the type is supported. */
-struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
-					   struct nand_chip *chip,
+struct nand_flash_dev *nand_get_flash_type(struct nand_chip *chip,
 					   int *maf_id, int *dev_id,
 					   struct nand_flash_dev *type);
 
-- 
2.32.0


  parent reply	other threads:[~2022-07-22 16:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 16:09 [PATCH v4 00/14] Port manufacturer specific initialization Dario Binacchi
2022-07-22 16:09 ` [PATCH v4 01/14] mtd: nand: Get rid of busw parameter Dario Binacchi
2022-07-22 16:09 ` [PATCH v4 02/14] mtd: nand: Store nand ID in struct nand_chip Dario Binacchi
2022-07-22 16:09 ` [PATCH v4 03/14] mtd: nand: Add manufacturer specific initialization/detection steps Dario Binacchi
2022-07-22 16:09 ` Dario Binacchi [this message]
2022-07-22 16:09 ` [PATCH v4 05/14] mtd: nand: Fix MediaTek MT7621 SoC build Dario Binacchi
2022-07-26  0:53   ` Weijie Gao
2022-07-22 16:10 ` [PATCH v4 06/14] mtd: nand: Export symbol nand_decode_ext_id Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 07/14] mtd: nand: Move Samsung specific init/detection logic in nand_samsung.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 08/14] mtd: nand: Move Hynix specific init/detection logic in nand_hynix.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 09/14] mtd: nand: Move Toshiba specific init/detection logic in nand_toshiba.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 10/14] mtd: nand: Move Micron specific init logic in nand_micron.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 11/14] mtd: nand: Move AMD/Spansion specific init/detection logic in nand_amd.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 12/14] mtd: nand: Move Macronix specific initialization in nand_macronix.c Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 13/14] mtd: nand: toshiba: Retrieve ECC requirements from extended ID Dario Binacchi
2022-07-22 16:10 ` [PATCH v4 14/14] mtd: decommission the NAND museum Dario Binacchi
2022-07-22 17:22 ` [PATCH v4 00/14] Port manufacturer specific initialization Michael Nazzareno Trimarchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722161009.2686504-5-dario.binacchi@amarulasolutions.com \
    --to=dario.binacchi@amarulasolutions.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=michael@amarulasolutions.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.