diff mbox

mtd: nand: remove unused function input parameter

Message ID C3050A4DBA34F345975765E43127F10F25E47D50@SZXEMA512-MBX.china.huawei.com
State Accepted
Commit bb77082fa2584f0855e614e99b5ffd40b9cf4251
Headers show

Commit Message

Caizhiyong Dec. 25, 2013, 12:40 p.m. UTC
From: Cai Zhiyong <caizhiyong@huawei.com>
Date: Wed, 25 Dec 2013 20:11:15 +0800
Subject: [PATCH] mtd: nand: remove unused function input parameter

The nand_get_flash_type parameter "busw" input value is not used by any
branch, and it is updated before use it in the function, so remove it, 
define the "busw" as an internal variable.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
---
 drivers/mtd/nand/nand_base.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Huang Shijie Dec. 26, 2013, 2:32 a.m. UTC | #1
On Wed, Dec 25, 2013 at 12:40:50PM +0000, Caizhiyong wrote:
> From: Cai Zhiyong <caizhiyong@huawei.com>
> Date: Wed, 25 Dec 2013 20:11:15 +0800
> Subject: [PATCH] mtd: nand: remove unused function input parameter
> 
> The nand_get_flash_type parameter "busw" input value is not used by any
> branch, and it is updated before use it in the function, so remove it, 
> define the "busw" as an internal variable.
> 
> Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
> ---
>  drivers/mtd/nand/nand_base.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 9b3bb3c..a123afa 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -3337,10 +3337,10 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
>   */
>  static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
>  						  struct nand_chip *chip,
> -						  int busw,
>  						  int *maf_id, int *dev_id,
>  						  struct nand_flash_dev *type)
>  {
> +	int busw;
>  	int i, maf_idx;
>  	u8 id_data[8];
>  
> @@ -3497,18 +3497,16 @@ ident_done:
>  int nand_scan_ident(struct mtd_info *mtd, int maxchips,
>  		    struct nand_flash_dev *table)
>  {
> -	int i, busw, nand_maf_id, nand_dev_id;
> +	int i, nand_maf_id, nand_dev_id;
>  	struct nand_chip *chip = mtd->priv;
>  	struct nand_flash_dev *type;
>  
> -	/* Get buswidth to select the correct functions */
> -	busw = chip->options & NAND_BUSWIDTH_16;
>  	/* Set the default functions */
> -	nand_set_defaults(chip, busw);
> +	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
>  
>  	/* Read the flash type */
> -	type = nand_get_flash_type(mtd, chip, busw,
> -				&nand_maf_id, &nand_dev_id, table);
> +	type = nand_get_flash_type(mtd, chip, &nand_maf_id,
> +				   &nand_dev_id, table);
I think the "busw" is to make the code more readable, since the nand_set_defaults
also needs a busw.

Let Brian judge it.

thanks
Huang Shijie
Brian Norris April 16, 2014, 5:09 a.m. UTC | #2
On Wed, Dec 25, 2013 at 12:40:50PM +0000, Caizhiyong wrote:
> From: Cai Zhiyong <caizhiyong@huawei.com>
> Date: Wed, 25 Dec 2013 20:11:15 +0800
> Subject: [PATCH] mtd: nand: remove unused function input parameter
> 
> The nand_get_flash_type parameter "busw" input value is not used by any
> branch, and it is updated before use it in the function, so remove it, 
> define the "busw" as an internal variable.
> 
> Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>

I merged this patch and sent it upstream for 3.15-rc1, but I don't think
I ever sent you a notification... here goes:

Applied, thanks!

Brian
diff mbox

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 9b3bb3c..a123afa 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3337,10 +3337,10 @@  static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
  */
 static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 						  struct nand_chip *chip,
-						  int busw,
 						  int *maf_id, int *dev_id,
 						  struct nand_flash_dev *type)
 {
+	int busw;
 	int i, maf_idx;
 	u8 id_data[8];
 
@@ -3497,18 +3497,16 @@  ident_done:
 int nand_scan_ident(struct mtd_info *mtd, int maxchips,
 		    struct nand_flash_dev *table)
 {
-	int i, busw, nand_maf_id, nand_dev_id;
+	int i, nand_maf_id, nand_dev_id;
 	struct nand_chip *chip = mtd->priv;
 	struct nand_flash_dev *type;
 
-	/* Get buswidth to select the correct functions */
-	busw = chip->options & NAND_BUSWIDTH_16;
 	/* Set the default functions */
-	nand_set_defaults(chip, busw);
+	nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
 
 	/* Read the flash type */
-	type = nand_get_flash_type(mtd, chip, busw,
-				&nand_maf_id, &nand_dev_id, table);
+	type = nand_get_flash_type(mtd, chip, &nand_maf_id,
+				   &nand_dev_id, table);
 
 	if (IS_ERR(type)) {
 		if (!(chip->options & NAND_SCAN_SILENT_NODEV))