diff mbox

ARM: don't set unused name in struct flash_platform_data

Message ID 1411993853-6309-1-git-send-email-zajec5@gmail.com
State Not Applicable
Headers show

Commit Message

Rafał Miłecki Sept. 29, 2014, 12:30 p.m. UTC
Loading correct SPI driver (m25p80) is handled using modalias from the
struct spi_board_info. There is no point of setting name in the
platform_data, m25p80 ignores it anyway.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 arch/arm/mach-davinci/board-da830-evm.c    | 1 -
 arch/arm/mach-davinci/board-da850-evm.c    | 1 -
 arch/arm/mach-davinci/board-mityomapl138.c | 1 -
 arch/arm/mach-shmobile/board-bockw.c       | 1 -
 arch/arm/mach-shmobile/board-koelsch.c     | 1 -
 arch/arm/mach-shmobile/board-lager.c       | 1 -
 arch/arm/mach-w90x900/dev.c                | 1 -
 7 files changed, 7 deletions(-)

Comments

Simon Horman Sept. 30, 2014, 2:21 a.m. UTC | #1
On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
> Loading correct SPI driver (m25p80) is handled using modalias from the
> struct spi_board_info. There is no point of setting name in the
> platform_data, m25p80 ignores it anyway.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  arch/arm/mach-davinci/board-da830-evm.c    | 1 -
>  arch/arm/mach-davinci/board-da850-evm.c    | 1 -
>  arch/arm/mach-davinci/board-mityomapl138.c | 1 -
>  arch/arm/mach-shmobile/board-bockw.c       | 1 -
>  arch/arm/mach-shmobile/board-koelsch.c     | 1 -
>  arch/arm/mach-shmobile/board-lager.c       | 1 -
>  arch/arm/mach-w90x900/dev.c                | 1 -
>  7 files changed, 7 deletions(-)

Hi,

I am happy to queue up the mach-shmobile portion of this change
if you break it out into a separate patch, one per board.

> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index 5623131..263004a 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -567,7 +567,6 @@ static struct mtd_partition da830evm_spiflash_part[] = {
>  };
>  
>  static struct flash_platform_data da830evm_spiflash_data = {
> -	.name		= "m25p80",
>  	.parts		= da830evm_spiflash_part,
>  	.nr_parts	= ARRAY_SIZE(da830evm_spiflash_part),
>  	.type		= "w25x32",
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 234c5bb..721ff2b 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -104,7 +104,6 @@ static struct mtd_partition da850evm_spiflash_part[] = {
>  };
>  
>  static struct flash_platform_data da850evm_spiflash_data = {
> -	.name		= "m25p80",
>  	.parts		= da850evm_spiflash_part,
>  	.nr_parts	= ARRAY_SIZE(da850evm_spiflash_part),
>  	.type		= "m25p64",
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index 96fc00a..3c93b65 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -350,7 +350,6 @@ static struct mtd_partition spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data mityomapl138_spi_flash_data = {
> -	.name		= "m25p80",
>  	.parts		= spi_flash_partitions,
>  	.nr_parts	= ARRAY_SIZE(spi_flash_partitions),
>  	.type		= "m24p64",
> diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
> index 8a83eb3..e25af56 100644
> --- a/arch/arm/mach-shmobile/board-bockw.c
> +++ b/arch/arm/mach-shmobile/board-bockw.c
> @@ -266,7 +266,6 @@ static struct mtd_partition m25p80_spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data spi_flash_data = {
> -	.name		= "m25p80",
>  	.type		= "s25fl008k",
>  	.parts		= m25p80_spi_flash_partitions,
>  	.nr_parts	= ARRAY_SIZE(m25p80_spi_flash_partitions),
> diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
> index b7d5bc7..a494a00 100644
> --- a/arch/arm/mach-shmobile/board-koelsch.c
> +++ b/arch/arm/mach-shmobile/board-koelsch.c
> @@ -207,7 +207,6 @@ static struct mtd_partition spi_flash_part[] = {
>  };
>  
>  static const struct flash_platform_data spi_flash_data = {
> -	.name		= "m25p80",
>  	.parts		= spi_flash_part,
>  	.nr_parts	= ARRAY_SIZE(spi_flash_part),
>  	.type		= "s25fl512s",
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index e1d8215..3575731 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -315,7 +315,6 @@ static struct mtd_partition spi_flash_part[] = {
>  };
>  
>  static const struct flash_platform_data spi_flash_data = {
> -	.name           = "m25p80",
>  	.parts          = spi_flash_part,
>  	.nr_parts       = ARRAY_SIZE(spi_flash_part),
>  	.type           = "s25fl512s",
> diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
> index e65a80a..9745a73 100644
> --- a/arch/arm/mach-w90x900/dev.c
> +++ b/arch/arm/mach-w90x900/dev.c
> @@ -249,7 +249,6 @@ static struct mtd_partition nuc900_spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data nuc900_spi_flash_data = {
> -	.name = "m25p80",
>  	.parts =  nuc900_spi_flash_partitions,
>  	.nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
>  	.type = "w25x16",
> -- 
> 1.8.4.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Brian Norris Oct. 22, 2014, 5:53 a.m. UTC | #2
On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
> Loading correct SPI driver (m25p80) is handled using modalias from the
> struct spi_board_info. There is no point of setting name in the
> platform_data, m25p80 ignores it anyway.

Wait, is 'name' actually ignored? It looks to me like it sets the MTD
name. See the comments in include/linux/spi/flash.h and
arch/arm/include/asm/mach/flash.h (BTW, why do we have two definitions
for this??):

  @name: optional flash device name (eg, as used with mtdparts=)

And I think it's used for exactly that in m25p80.c:

	if (data && data->name)
		flash->mtd.name = data->name;

> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  arch/arm/mach-davinci/board-da830-evm.c    | 1 -
>  arch/arm/mach-davinci/board-da850-evm.c    | 1 -
>  arch/arm/mach-davinci/board-mityomapl138.c | 1 -
>  arch/arm/mach-shmobile/board-bockw.c       | 1 -
>  arch/arm/mach-shmobile/board-koelsch.c     | 1 -
>  arch/arm/mach-shmobile/board-lager.c       | 1 -
>  arch/arm/mach-w90x900/dev.c                | 1 -
>  7 files changed, 7 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
> index 5623131..263004a 100644
> --- a/arch/arm/mach-davinci/board-da830-evm.c
> +++ b/arch/arm/mach-davinci/board-da830-evm.c
> @@ -567,7 +567,6 @@ static struct mtd_partition da830evm_spiflash_part[] = {
>  };
>  
>  static struct flash_platform_data da830evm_spiflash_data = {
> -	.name		= "m25p80",
>  	.parts		= da830evm_spiflash_part,
>  	.nr_parts	= ARRAY_SIZE(da830evm_spiflash_part),
>  	.type		= "w25x32",
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 234c5bb..721ff2b 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -104,7 +104,6 @@ static struct mtd_partition da850evm_spiflash_part[] = {
>  };
>  
>  static struct flash_platform_data da850evm_spiflash_data = {
> -	.name		= "m25p80",
>  	.parts		= da850evm_spiflash_part,
>  	.nr_parts	= ARRAY_SIZE(da850evm_spiflash_part),
>  	.type		= "m25p64",
> diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
> index 96fc00a..3c93b65 100644
> --- a/arch/arm/mach-davinci/board-mityomapl138.c
> +++ b/arch/arm/mach-davinci/board-mityomapl138.c
> @@ -350,7 +350,6 @@ static struct mtd_partition spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data mityomapl138_spi_flash_data = {
> -	.name		= "m25p80",
>  	.parts		= spi_flash_partitions,
>  	.nr_parts	= ARRAY_SIZE(spi_flash_partitions),
>  	.type		= "m24p64",
> diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
> index 8a83eb3..e25af56 100644
> --- a/arch/arm/mach-shmobile/board-bockw.c
> +++ b/arch/arm/mach-shmobile/board-bockw.c
> @@ -266,7 +266,6 @@ static struct mtd_partition m25p80_spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data spi_flash_data = {
> -	.name		= "m25p80",
>  	.type		= "s25fl008k",
>  	.parts		= m25p80_spi_flash_partitions,
>  	.nr_parts	= ARRAY_SIZE(m25p80_spi_flash_partitions),
> diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
> index b7d5bc7..a494a00 100644
> --- a/arch/arm/mach-shmobile/board-koelsch.c
> +++ b/arch/arm/mach-shmobile/board-koelsch.c
> @@ -207,7 +207,6 @@ static struct mtd_partition spi_flash_part[] = {
>  };
>  
>  static const struct flash_platform_data spi_flash_data = {
> -	.name		= "m25p80",
>  	.parts		= spi_flash_part,
>  	.nr_parts	= ARRAY_SIZE(spi_flash_part),
>  	.type		= "s25fl512s",
> diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
> index e1d8215..3575731 100644
> --- a/arch/arm/mach-shmobile/board-lager.c
> +++ b/arch/arm/mach-shmobile/board-lager.c
> @@ -315,7 +315,6 @@ static struct mtd_partition spi_flash_part[] = {
>  };
>  
>  static const struct flash_platform_data spi_flash_data = {
> -	.name           = "m25p80",
>  	.parts          = spi_flash_part,
>  	.nr_parts       = ARRAY_SIZE(spi_flash_part),
>  	.type           = "s25fl512s",
> diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
> index e65a80a..9745a73 100644
> --- a/arch/arm/mach-w90x900/dev.c
> +++ b/arch/arm/mach-w90x900/dev.c
> @@ -249,7 +249,6 @@ static struct mtd_partition nuc900_spi_flash_partitions[] = {
>  };
>  
>  static struct flash_platform_data nuc900_spi_flash_data = {
> -	.name = "m25p80",
>  	.parts =  nuc900_spi_flash_partitions,
>  	.nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
>  	.type = "w25x16",

Brian
Rafał Miłecki Oct. 22, 2014, 6:03 a.m. UTC | #3
On 22 October 2014 07:53, Brian Norris <computersforpeace@gmail.com> wrote:
> On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
>> Loading correct SPI driver (m25p80) is handled using modalias from the
>> struct spi_board_info. There is no point of setting name in the
>> platform_data, m25p80 ignores it anyway.
>
> Wait, is 'name' actually ignored? It looks to me like it sets the MTD
> name. See the comments in include/linux/spi/flash.h and
> arch/arm/include/asm/mach/flash.h (BTW, why do we have two definitions
> for this??):
>
>   @name: optional flash device name (eg, as used with mtdparts=)
>
> And I think it's used for exactly that in m25p80.c:
>
>         if (data && data->name)
>                 flash->mtd.name = data->name;

And very few lines later in the m25p80.c you have this:
if (data && data->type)
        id = spi_nor_match_id(data->type);

Code I touched in my patch was using both: name and type. So what you
got it "type" took a precedence and "name" value was ignored. It seems
like ppl used to use "name" to trigger "m25p80" probe, which isn't
needed (it's done by SPI layer).

Also see my comment about data->type usage I added in:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42
Brian Norris Oct. 22, 2014, 6:10 a.m. UTC | #4
On Wed, Oct 22, 2014 at 08:03:45AM +0200, Rafał Miłecki wrote:
> On 22 October 2014 07:53, Brian Norris <computersforpeace@gmail.com> wrote:
> > On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
> >> Loading correct SPI driver (m25p80) is handled using modalias from the
> >> struct spi_board_info. There is no point of setting name in the
> >> platform_data, m25p80 ignores it anyway.
> >
> > Wait, is 'name' actually ignored? It looks to me like it sets the MTD
> > name. See the comments in include/linux/spi/flash.h and
> > arch/arm/include/asm/mach/flash.h (BTW, why do we have two definitions
> > for this??):
> >
> >   @name: optional flash device name (eg, as used with mtdparts=)
> >
> > And I think it's used for exactly that in m25p80.c:
> >
> >         if (data && data->name)
> >                 flash->mtd.name = data->name;
> 
> And very few lines later in the m25p80.c you have this:
> if (data && data->type)
>         id = spi_nor_match_id(data->type);

How is that relevant to the value of 'flash->mtd.name'?

> Code I touched in my patch was using both: name and type. So what you
> got it "type" took a precedence and "name" value was ignored. It seems
> like ppl used to use "name" to trigger "m25p80" probe, which isn't
> needed (it's done by SPI layer).
> 
> Also see my comment about data->type usage I added in:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42

But I'm not talking about probing / driver matching. The 'name' field is
used for assigning the MTD name deterministically. This name is used for
things like 'mtdparts'.

Brian
Rafał Miłecki Oct. 22, 2014, 6:11 a.m. UTC | #5
On 22 October 2014 08:03, Rafał Miłecki <zajec5@gmail.com> wrote:
> On 22 October 2014 07:53, Brian Norris <computersforpeace@gmail.com> wrote:
>> On Mon, Sep 29, 2014 at 02:30:53PM +0200, Rafał Miłecki wrote:
>>> Loading correct SPI driver (m25p80) is handled using modalias from the
>>> struct spi_board_info. There is no point of setting name in the
>>> platform_data, m25p80 ignores it anyway.
>>
>> Wait, is 'name' actually ignored? It looks to me like it sets the MTD
>> name. See the comments in include/linux/spi/flash.h and
>> arch/arm/include/asm/mach/flash.h (BTW, why do we have two definitions
>> for this??):
>>
>>   @name: optional flash device name (eg, as used with mtdparts=)
>>
>> And I think it's used for exactly that in m25p80.c:
>>
>>         if (data && data->name)
>>                 flash->mtd.name = data->name;
>
> And very few lines later in the m25p80.c you have this:
> if (data && data->type)
>         id = spi_nor_match_id(data->type);
>
> Code I touched in my patch was using both: name and type. So what you
> got it "type" took a precedence and "name" value was ignored. It seems
> like ppl used to use "name" to trigger "m25p80" probe, which isn't
> needed (it's done by SPI layer).
>
> Also see my comment about data->type usage I added in:
> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=32f1b7c8352fd33d41bcec3cfb054ccdcfd40a42

Oh, wait. I just noticed you pointed to the code setting mtd's name,
not finding a chip name. Sorry, I got a bit confused by so many recent
changes to the m25p80 and spi-nor.
So you are right, m25p80 uses this "name" to set the mtd_info's name.
Will look at this again.
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 5623131..263004a 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -567,7 +567,6 @@  static struct mtd_partition da830evm_spiflash_part[] = {
 };
 
 static struct flash_platform_data da830evm_spiflash_data = {
-	.name		= "m25p80",
 	.parts		= da830evm_spiflash_part,
 	.nr_parts	= ARRAY_SIZE(da830evm_spiflash_part),
 	.type		= "w25x32",
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 234c5bb..721ff2b 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -104,7 +104,6 @@  static struct mtd_partition da850evm_spiflash_part[] = {
 };
 
 static struct flash_platform_data da850evm_spiflash_data = {
-	.name		= "m25p80",
 	.parts		= da850evm_spiflash_part,
 	.nr_parts	= ARRAY_SIZE(da850evm_spiflash_part),
 	.type		= "m25p64",
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
index 96fc00a..3c93b65 100644
--- a/arch/arm/mach-davinci/board-mityomapl138.c
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -350,7 +350,6 @@  static struct mtd_partition spi_flash_partitions[] = {
 };
 
 static struct flash_platform_data mityomapl138_spi_flash_data = {
-	.name		= "m25p80",
 	.parts		= spi_flash_partitions,
 	.nr_parts	= ARRAY_SIZE(spi_flash_partitions),
 	.type		= "m24p64",
diff --git a/arch/arm/mach-shmobile/board-bockw.c b/arch/arm/mach-shmobile/board-bockw.c
index 8a83eb3..e25af56 100644
--- a/arch/arm/mach-shmobile/board-bockw.c
+++ b/arch/arm/mach-shmobile/board-bockw.c
@@ -266,7 +266,6 @@  static struct mtd_partition m25p80_spi_flash_partitions[] = {
 };
 
 static struct flash_platform_data spi_flash_data = {
-	.name		= "m25p80",
 	.type		= "s25fl008k",
 	.parts		= m25p80_spi_flash_partitions,
 	.nr_parts	= ARRAY_SIZE(m25p80_spi_flash_partitions),
diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c
index b7d5bc7..a494a00 100644
--- a/arch/arm/mach-shmobile/board-koelsch.c
+++ b/arch/arm/mach-shmobile/board-koelsch.c
@@ -207,7 +207,6 @@  static struct mtd_partition spi_flash_part[] = {
 };
 
 static const struct flash_platform_data spi_flash_data = {
-	.name		= "m25p80",
 	.parts		= spi_flash_part,
 	.nr_parts	= ARRAY_SIZE(spi_flash_part),
 	.type		= "s25fl512s",
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index e1d8215..3575731 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -315,7 +315,6 @@  static struct mtd_partition spi_flash_part[] = {
 };
 
 static const struct flash_platform_data spi_flash_data = {
-	.name           = "m25p80",
 	.parts          = spi_flash_part,
 	.nr_parts       = ARRAY_SIZE(spi_flash_part),
 	.type           = "s25fl512s",
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index e65a80a..9745a73 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -249,7 +249,6 @@  static struct mtd_partition nuc900_spi_flash_partitions[] = {
 };
 
 static struct flash_platform_data nuc900_spi_flash_data = {
-	.name = "m25p80",
 	.parts =  nuc900_spi_flash_partitions,
 	.nr_parts = ARRAY_SIZE(nuc900_spi_flash_partitions),
 	.type = "w25x16",