Message ID | 1533214434-28761-4-git-send-email-frieder.schrempf@exceet.de (mailing list archive) |
---|---|
State | Accepted |
Commit | b02b17f55b2e789b9747cf4dd2eaaa110439a4cc |
Headers | show |
Series | Extend the SPI mem interface to set a custom memory name | expand |
On Thu, 2 Aug 2018 14:53:54 +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. > > Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com> > Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de> Acked-by: Boris Brezillon <boris.brezillon@bootlin.com> > --- > drivers/mtd/devices/m25p80.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index e84563d..aac48800 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -202,6 +202,9 @@ static int m25p_probe(struct spi_mem *spimem) > 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 > * set to "m25p80" and then "type" provides a real chip name. -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index e84563d..aac48800 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -202,6 +202,9 @@ static int m25p_probe(struct spi_mem *spimem) 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 * set to "m25p80" and then "type" provides a real chip name.
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. Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Frieder Schrempf <frieder.schrempf@exceet.de> --- drivers/mtd/devices/m25p80.c | 3 +++ 1 file changed, 3 insertions(+)