LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: remove unused function input parameter
@ 2013-12-25 12:40 Caizhiyong
  2013-12-26  2:32 ` Huang Shijie
  2014-04-16  5:09 ` Brian Norris
  0 siblings, 2 replies; 3+ messages in thread
From: Caizhiyong @ 2013-12-25 12:40 UTC (permalink / raw
  To: linux-mtd@lists.infradead.org
  Cc: Brian Norris, Wanglin (Albert), Huang Shijie, David Woodhouse,
	linux-kernel@vger.kernel.org, Artem Bityutskiy

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);
 
 	if (IS_ERR(type)) {
 		if (!(chip->options & NAND_SCAN_SILENT_NODEV))
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: remove unused function input parameter
  2013-12-25 12:40 [PATCH] mtd: nand: remove unused function input parameter Caizhiyong
@ 2013-12-26  2:32 ` Huang Shijie
  2014-04-16  5:09 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Huang Shijie @ 2013-12-26  2:32 UTC (permalink / raw
  To: Caizhiyong
  Cc: linux-mtd@lists.infradead.org, Brian Norris, Wanglin (Albert),
	David Woodhouse, linux-kernel@vger.kernel.org, Artem Bityutskiy

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: remove unused function input parameter
  2013-12-25 12:40 [PATCH] mtd: nand: remove unused function input parameter Caizhiyong
  2013-12-26  2:32 ` Huang Shijie
@ 2014-04-16  5:09 ` Brian Norris
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2014-04-16  5:09 UTC (permalink / raw
  To: Caizhiyong
  Cc: linux-mtd@lists.infradead.org, Wanglin (Albert), Huang Shijie,
	David Woodhouse, linux-kernel@vger.kernel.org, Artem Bityutskiy

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-16  5:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 12:40 [PATCH] mtd: nand: remove unused function input parameter Caizhiyong
2013-12-26  2:32 ` Huang Shijie
2014-04-16  5:09 ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).