Message ID | 1530789310-16254-3-git-send-email-frieder.schrempf@exceet.de |
---|---|
State | Changes Requested |
Delegated to: | Boris Brezillon |
Headers | show |
Series | Port the FSL QSPI driver to the SPI framework | expand |
On Thu, 5 Jul 2018 13:14:58 +0200 Frieder Schrempf <frieder.schrempf@exceet.de> wrote: > By calling spi_mem_get_name(), the driver of the (Q)SPI controller can > set a custom name for the memory device if necessary. > This is useful to keep mtdparts compatible when controller drivers are > ported from the MTD to the SPI layer. > > Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de> > --- > drivers/mtd/devices/m25p80.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index e84563d..482f0ef 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -199,8 +199,7 @@ static int m25p_probe(struct spi_mem *spimem) > hwcaps.mask |= SNOR_HWCAPS_READ_1_2_2; > } > > - if (data && data->name) > - nor->mtd.name = data->name; > + nor->mtd.name = spi_mem_get_name(spimem); Hm, not sure you can do that without breaking setup that pass a flash_platform_data object with a name. Also, you should keep the name extracted from the label property if any (this is done earlier, when spi_nor_set_flash_node() is called). if (data && data->name) nor->mtd.name = data->name; if (!nor->mtd.name) nor->mtd.name = spi_mem_get_name(spimem); > > /* For some (historical?) reason many platforms provide two different > * names in flash_platform_data: "name" and "type". Quite often name is
Hi Boris, On 05.07.2018 14:56, Boris Brezillon wrote: > On Thu, 5 Jul 2018 13:14:58 +0200 > Frieder Schrempf <frieder.schrempf@exceet.de> wrote: > >> By calling spi_mem_get_name(), the driver of the (Q)SPI controller can >> set a custom name for the memory device if necessary. >> This is useful to keep mtdparts compatible when controller drivers are >> ported from the MTD to the SPI layer. >> >> Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de> >> --- >> drivers/mtd/devices/m25p80.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c >> index e84563d..482f0ef 100644 >> --- a/drivers/mtd/devices/m25p80.c >> +++ b/drivers/mtd/devices/m25p80.c >> @@ -199,8 +199,7 @@ static int m25p_probe(struct spi_mem *spimem) >> hwcaps.mask |= SNOR_HWCAPS_READ_1_2_2; >> } >> >> - if (data && data->name) >> - nor->mtd.name = data->name; >> + nor->mtd.name = spi_mem_get_name(spimem); > > Hm, not sure you can do that without breaking setup that pass a > flash_platform_data object with a name. > > Also, you should keep the name extracted from the label property if any > (this is done earlier, when spi_nor_set_flash_node() is called). > > if (data && data->name) > nor->mtd.name = data->name; > > if (!nor->mtd.name) > nor->mtd.name = spi_mem_get_name(spimem); I missed both facts, that data could be passed with a name assigned already and that spi_nor_set_flash_node() might assign a name from dt. I should have looked at the code more closely. Thanks for pointing that out. I'll fix it. Frieder > >> >> /* For some (historical?) reason many platforms provide two different >> * names in flash_platform_data: "name" and "type". Quite often name is >
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index e84563d..482f0ef 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -199,8 +199,7 @@ static int m25p_probe(struct spi_mem *spimem) hwcaps.mask |= SNOR_HWCAPS_READ_1_2_2; } - if (data && data->name) - nor->mtd.name = data->name; + nor->mtd.name = spi_mem_get_name(spimem); /* For some (historical?) reason many platforms provide two different * names in flash_platform_data: "name" and "type". Quite often name is
By calling spi_mem_get_name(), the driver of the (Q)SPI controller can set a custom name for the memory device if necessary. This is useful to keep mtdparts compatible when controller drivers are ported from the MTD to the SPI layer. Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de> --- drivers/mtd/devices/m25p80.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)