[3/7] mtd: nand: Rename nand_get_flash_type() into nand_detect()

Message ID 20220727093748.1415135-4-michael@amarulasolutions.com
State New
Headers show
Series
  • NAND new improvements
Related show

Commit Message

Michael Trimarchi July 27, 2022, 9:37 a.m. UTC
Upstream linux commit 7bb427990ee364.

Rename the function to match this new behavior.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/nand/raw/mt7621_nand.c  |  3 +--
 drivers/mtd/nand/raw/mxs_nand_spl.c |  2 +-
 drivers/mtd/nand/raw/nand_base.c    | 11 +++++------
 include/linux/mtd/rawnand.h         |  4 ++--
 4 files changed, 9 insertions(+), 11 deletions(-)

Comments

Dario Binacchi July 27, 2022, 12:16 p.m. UTC | #1
Hi Michael,

On Wed, Jul 27, 2022 at 11:37 AM Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Upstream linux commit 7bb427990ee364.
>
> Rename the function to match this new behavior.
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/mtd/nand/raw/mt7621_nand.c  |  3 +--
>  drivers/mtd/nand/raw/mxs_nand_spl.c |  2 +-
>  drivers/mtd/nand/raw/nand_base.c    | 11 +++++------
>  include/linux/mtd/rawnand.h         |  4 ++--
>  4 files changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/mt7621_nand.c b/drivers/mtd/nand/raw/mt7621_nand.c
> index a4a0bce35d..f6eddb84a9 100644
> --- a/drivers/mtd/nand/raw/mt7621_nand.c
> +++ b/drivers/mtd/nand/raw/mt7621_nand.c
> @@ -1186,8 +1186,7 @@ int mt7621_nfc_spl_post_init(struct mt7621_nfc *nfc)
>         int nand_maf_id, nand_dev_id;
>         int ret;
>
> -       ret = nand_get_flash_type(nand, &nand_maf_id,
> -                                 &nand_dev_id, NULL);
> +       ret = nand_detect(nand, &nand_maf_id, &nand_dev_id, NULL);
>
>         if (ret)
>                 return ret;
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index 773d375fc2..4dffa76eaf 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -83,7 +83,7 @@ static int mxs_flash_full_ident(struct mtd_info *mtd)
>         struct nand_chip *chip = mtd_to_nand(mtd);
>         int ret;
>
> -       ret = nand_get_flash_type(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
> +       ret = nand_detect(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
>
>         if (ret) {
>                 chip->select_chip(mtd, -1);
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index b4fa618dc4..1a1a757932 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4276,8 +4276,8 @@ static const struct nand_manufacturer *nand_get_manufacturer_desc(u8 id)
>  /*
>   * Get the flash and manufacturer id and lookup if the type is supported.
>   */
> -int nand_get_flash_type(struct nand_chip *chip, int *maf_id,
> -                       int *dev_id, struct nand_flash_dev *type)
> +int nand_detect(struct nand_chip *chip, int *maf_id,
> +               int *dev_id, struct nand_flash_dev *type)
>  {
>         struct mtd_info *mtd = &chip->mtd;
>         const struct nand_manufacturer *manufacturer_desc;
> @@ -4461,7 +4461,7 @@ ident_done:
>                 mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
>         return 0;
>  }
> -EXPORT_SYMBOL(nand_get_flash_type);
> +EXPORT_SYMBOL(nand_detect);
>
>  #if CONFIG_IS_ENABLED(OF_CONTROL)
>
> @@ -4558,8 +4558,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>         nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
>
>         /* Read the flash type */
> -       ret = nand_get_flash_type(chip, &nand_maf_id,
> -                                  &nand_dev_id, table);
> +       ret = nand_detect(chip, &nand_maf_id, &nand_dev_id, table);
>
>         if (ret) {
>                 if (!(chip->options & NAND_SCAN_SILENT_NODEV))
> @@ -4591,7 +4590,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>         for (i = 1; i < maxchips; i++) {
>                 u8 id[2];
>
> -               /* See comment in nand_get_flash_type for reset */
> +               /* See comment in nand_detect for reset */
>                 nand_reset(chip, i);
>
>                 chip->select_chip(mtd, i);
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 8178f36b49..fb002ae641 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -29,8 +29,8 @@ struct nand_flash_dev;
>  struct device_node;
>
>  /* Get the flash and manufacturer id and lookup if the type is supported. */
> -int nand_get_flash_type(struct nand_chip *chip, int *maf_id, int *dev_id,
> -                       struct nand_flash_dev *type);
> +int nand_detect(struct nand_chip *chip, int *maf_id, int *dev_id,
> +               struct nand_flash_dev *type);
>
>  /* Scan and identify a NAND device */
>  int nand_scan(struct mtd_info *mtd, int max_chips);
> --
> 2.34.1
>

looks good to me.

Dario
Tommaso Merciai July 28, 2022, 7:55 a.m. UTC | #2
On Wed, Jul 27, 2022 at 11:37:44AM +0200, Michael Trimarchi wrote:
> Upstream linux commit 7bb427990ee364.
> 
> Rename the function to match this new behavior.
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>  drivers/mtd/nand/raw/mt7621_nand.c  |  3 +--
>  drivers/mtd/nand/raw/mxs_nand_spl.c |  2 +-
>  drivers/mtd/nand/raw/nand_base.c    | 11 +++++------
>  include/linux/mtd/rawnand.h         |  4 ++--
>  4 files changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/mt7621_nand.c b/drivers/mtd/nand/raw/mt7621_nand.c
> index a4a0bce35d..f6eddb84a9 100644
> --- a/drivers/mtd/nand/raw/mt7621_nand.c
> +++ b/drivers/mtd/nand/raw/mt7621_nand.c
> @@ -1186,8 +1186,7 @@ int mt7621_nfc_spl_post_init(struct mt7621_nfc *nfc)
>  	int nand_maf_id, nand_dev_id;
>  	int ret;
>  
> -	ret = nand_get_flash_type(nand, &nand_maf_id,
> -				  &nand_dev_id, NULL);
> +	ret = nand_detect(nand, &nand_maf_id, &nand_dev_id, NULL);
>  
>  	if (ret)
>  		return ret;
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index 773d375fc2..4dffa76eaf 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -83,7 +83,7 @@ static int mxs_flash_full_ident(struct mtd_info *mtd)
>  	struct nand_chip *chip = mtd_to_nand(mtd);
>  	int ret;
>  
> -	ret = nand_get_flash_type(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
> +	ret = nand_detect(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
>  
>  	if (ret) {
>  		chip->select_chip(mtd, -1);
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index b4fa618dc4..1a1a757932 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4276,8 +4276,8 @@ static const struct nand_manufacturer *nand_get_manufacturer_desc(u8 id)
>  /*
>   * Get the flash and manufacturer id and lookup if the type is supported.
>   */
> -int nand_get_flash_type(struct nand_chip *chip, int *maf_id,
> -			int *dev_id, struct nand_flash_dev *type)
> +int nand_detect(struct nand_chip *chip, int *maf_id,
> +		int *dev_id, struct nand_flash_dev *type)
>  {
>  	struct mtd_info *mtd = &chip->mtd;
>  	const struct nand_manufacturer *manufacturer_desc;
> @@ -4461,7 +4461,7 @@ ident_done:
>  		mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
>  	return 0;
>  }
> -EXPORT_SYMBOL(nand_get_flash_type);
> +EXPORT_SYMBOL(nand_detect);
>  
>  #if CONFIG_IS_ENABLED(OF_CONTROL)
>  
> @@ -4558,8 +4558,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>  	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
>  
>  	/* Read the flash type */
> -	ret = nand_get_flash_type(chip, &nand_maf_id,
> -				   &nand_dev_id, table);
> +	ret = nand_detect(chip, &nand_maf_id, &nand_dev_id, table);
>  
>  	if (ret) {
>  		if (!(chip->options & NAND_SCAN_SILENT_NODEV))
> @@ -4591,7 +4590,7 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>  	for (i = 1; i < maxchips; i++) {
>  		u8 id[2];
>  
> -		/* See comment in nand_get_flash_type for reset */
> +		/* See comment in nand_detect for reset */
>  		nand_reset(chip, i);
>  
>  		chip->select_chip(mtd, i);
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 8178f36b49..fb002ae641 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -29,8 +29,8 @@ struct nand_flash_dev;
>  struct device_node;
>  
>  /* Get the flash and manufacturer id and lookup if the type is supported. */
> -int nand_get_flash_type(struct nand_chip *chip, int *maf_id, int *dev_id,
> -			struct nand_flash_dev *type);
> +int nand_detect(struct nand_chip *chip, int *maf_id, int *dev_id,
> +		struct nand_flash_dev *type);
>  
>  /* Scan and identify a NAND device */
>  int nand_scan(struct mtd_info *mtd, int max_chips);
> -- 
> 2.34.1
> 

What do you think about to keep both function?

 - nand_get_flash_type
 - nand_detect

Patch

diff --git a/drivers/mtd/nand/raw/mt7621_nand.c b/drivers/mtd/nand/raw/mt7621_nand.c
index a4a0bce35d..f6eddb84a9 100644
--- a/drivers/mtd/nand/raw/mt7621_nand.c
+++ b/drivers/mtd/nand/raw/mt7621_nand.c
@@ -1186,8 +1186,7 @@  int mt7621_nfc_spl_post_init(struct mt7621_nfc *nfc)
 	int nand_maf_id, nand_dev_id;
 	int ret;
 
-	ret = nand_get_flash_type(nand, &nand_maf_id,
-				  &nand_dev_id, NULL);
+	ret = nand_detect(nand, &nand_maf_id, &nand_dev_id, NULL);
 
 	if (ret)
 		return ret;
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index 773d375fc2..4dffa76eaf 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -83,7 +83,7 @@  static int mxs_flash_full_ident(struct mtd_info *mtd)
 	struct nand_chip *chip = mtd_to_nand(mtd);
 	int ret;
 
-	ret = nand_get_flash_type(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
+	ret = nand_detect(mtd, chip, &nand_maf_id, &nand_dev_id, NULL);
 
 	if (ret) {
 		chip->select_chip(mtd, -1);
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index b4fa618dc4..1a1a757932 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4276,8 +4276,8 @@  static const struct nand_manufacturer *nand_get_manufacturer_desc(u8 id)
 /*
  * Get the flash and manufacturer id and lookup if the type is supported.
  */
-int nand_get_flash_type(struct nand_chip *chip, int *maf_id,
-			int *dev_id, struct nand_flash_dev *type)
+int nand_detect(struct nand_chip *chip, int *maf_id,
+		int *dev_id, struct nand_flash_dev *type)
 {
 	struct mtd_info *mtd = &chip->mtd;
 	const struct nand_manufacturer *manufacturer_desc;
@@ -4461,7 +4461,7 @@  ident_done:
 		mtd->erasesize >> 10, mtd->writesize, mtd->oobsize);
 	return 0;
 }
-EXPORT_SYMBOL(nand_get_flash_type);
+EXPORT_SYMBOL(nand_detect);
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 
@@ -4558,8 +4558,7 @@  int nand_scan_ident(struct mtd_info *mtd, int maxchips,
 	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
 
 	/* Read the flash type */
-	ret = nand_get_flash_type(chip, &nand_maf_id,
-				   &nand_dev_id, table);
+	ret = nand_detect(chip, &nand_maf_id, &nand_dev_id, table);
 
 	if (ret) {
 		if (!(chip->options & NAND_SCAN_SILENT_NODEV))
@@ -4591,7 +4590,7 @@  int nand_scan_ident(struct mtd_info *mtd, int maxchips,
 	for (i = 1; i < maxchips; i++) {
 		u8 id[2];
 
-		/* See comment in nand_get_flash_type for reset */
+		/* See comment in nand_detect for reset */
 		nand_reset(chip, i);
 
 		chip->select_chip(mtd, i);
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 8178f36b49..fb002ae641 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -29,8 +29,8 @@  struct nand_flash_dev;
 struct device_node;
 
 /* Get the flash and manufacturer id and lookup if the type is supported. */
-int nand_get_flash_type(struct nand_chip *chip, int *maf_id, int *dev_id,
-			struct nand_flash_dev *type);
+int nand_detect(struct nand_chip *chip, int *maf_id, int *dev_id,
+		struct nand_flash_dev *type);
 
 /* Scan and identify a NAND device */
 int nand_scan(struct mtd_info *mtd, int max_chips);