linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size
@ 2019-08-28 10:35 Tudor.Ambarus
  2019-08-29  7:48 ` Vignesh Raghavendra
  2019-08-29 10:48 ` Tudor.Ambarus
  0 siblings, 2 replies; 3+ messages in thread
From: Tudor.Ambarus @ 2019-08-28 10:35 UTC (permalink / raw)
  To: marek.vasut, vigneshr, miquel.raynal, richard, linux-mtd, linux-kernel
  Cc: Tudor.Ambarus

From: Tudor Ambarus <tudor.ambarus@microchip.com>

We already pass a pointer to nor, we can obtain the sector_size
by dereferencing it.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 79c8f1dd8c6b..69532573dba9 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -4257,11 +4257,12 @@ spi_nor_select_uniform_erase(struct spi_nor_erase_map *map,
 	return erase;
 }
 
-static int spi_nor_select_erase(struct spi_nor *nor, u32 wanted_size)
+static int spi_nor_select_erase(struct spi_nor *nor)
 {
 	struct spi_nor_erase_map *map = &nor->params.erase_map;
 	const struct spi_nor_erase_type *erase = NULL;
 	struct mtd_info *mtd = &nor->mtd;
+	u32 wanted_size = nor->info->sector_size;
 	int i;
 
 	/*
@@ -4355,7 +4356,7 @@ static int spi_nor_default_setup(struct spi_nor *nor,
 	}
 
 	/* Select the Sector Erase command. */
-	err = spi_nor_select_erase(nor, nor->info->sector_size);
+	err = spi_nor_select_erase(nor);
 	if (err) {
 		dev_err(nor->dev,
 			"can't select erase settings supported by both the SPI controller and memory.\n");
-- 
2.9.5


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size
  2019-08-28 10:35 [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size Tudor.Ambarus
@ 2019-08-29  7:48 ` Vignesh Raghavendra
  2019-08-29 10:48 ` Tudor.Ambarus
  1 sibling, 0 replies; 3+ messages in thread
From: Vignesh Raghavendra @ 2019-08-29  7:48 UTC (permalink / raw)
  To: Tudor.Ambarus, marek.vasut, miquel.raynal, richard, linux-mtd,
	linux-kernel



On 28/08/19 4:05 PM, Tudor.Ambarus@microchip.com wrote:
> From: Tudor Ambarus <tudor.ambarus@microchip.com>
> 
> We already pass a pointer to nor, we can obtain the sector_size
> by dereferencing it.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---

Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>

Regards
Vignesh

>  drivers/mtd/spi-nor/spi-nor.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index 79c8f1dd8c6b..69532573dba9 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -4257,11 +4257,12 @@ spi_nor_select_uniform_erase(struct spi_nor_erase_map *map,
>  	return erase;
>  }
>  
> -static int spi_nor_select_erase(struct spi_nor *nor, u32 wanted_size)
> +static int spi_nor_select_erase(struct spi_nor *nor)
>  {
>  	struct spi_nor_erase_map *map = &nor->params.erase_map;
>  	const struct spi_nor_erase_type *erase = NULL;
>  	struct mtd_info *mtd = &nor->mtd;
> +	u32 wanted_size = nor->info->sector_size;
>  	int i;
>  
>  	/*
> @@ -4355,7 +4356,7 @@ static int spi_nor_default_setup(struct spi_nor *nor,
>  	}
>  
>  	/* Select the Sector Erase command. */
> -	err = spi_nor_select_erase(nor, nor->info->sector_size);
> +	err = spi_nor_select_erase(nor);
>  	if (err) {
>  		dev_err(nor->dev,
>  			"can't select erase settings supported by both the SPI controller and memory.\n");
> 


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size
  2019-08-28 10:35 [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size Tudor.Ambarus
  2019-08-29  7:48 ` Vignesh Raghavendra
@ 2019-08-29 10:48 ` Tudor.Ambarus
  1 sibling, 0 replies; 3+ messages in thread
From: Tudor.Ambarus @ 2019-08-29 10:48 UTC (permalink / raw)
  To: marek.vasut, vigneshr, miquel.raynal, richard, linux-mtd, linux-kernel



On 08/28/2019 01:35 PM, Tudor Ambarus - M18064 wrote:
> From: Tudor Ambarus <tudor.ambarus@microchip.com>
> 
> We already pass a pointer to nor, we can obtain the sector_size
> by dereferencing it.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git,
spi-nor/next branch.

Thanks,
ta
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, other threads:[~2019-08-29 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-28 10:35 [PATCH] mtd: spi-nor: remove superfluous pass of nor->info->sector_size Tudor.Ambarus
2019-08-29  7:48 ` Vignesh Raghavendra
2019-08-29 10:48 ` Tudor.Ambarus

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 NNTP newsgroup(s).