Skip to content

Commit

Permalink
mtd: m25p80: Call spi_mem_get_name() to let controller set a custom name
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Frieder Schrempf authored and Mark Brown committed Aug 2, 2018
1 parent 5d27a9c commit b02b17f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mtd/devices/m25p80.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b02b17f

Please sign in to comment.