0001-MTD-m25p80-allow-loading-mtd-name-from-OF.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From 0a27a5e5917d8d5e179763788c204d12895c278b Mon Sep 17 00:00:00 2001
  2. From: John Crispin <[email protected]>
  3. Date: Tue, 29 Jan 2013 21:11:55 +0100
  4. Subject: [PATCH 01/22] MTD: m25p80: allow loading mtd name from OF
  5. In accordance with the physmap flash we should honour the linux,mtd-name
  6. property when deciding what name the mtd device has.
  7. Signed-off-by: Thomas Langer <[email protected]>
  8. Signed-off-by: John Crispin <[email protected]>
  9. ---
  10. drivers/mtd/devices/m25p80.c | 5 +++++
  11. 1 file changed, 5 insertions(+)
  12. --- a/drivers/mtd/devices/m25p80.c
  13. +++ b/drivers/mtd/devices/m25p80.c
  14. @@ -922,10 +922,13 @@ static int m25p_probe(struct spi_device
  15. unsigned i;
  16. struct mtd_part_parser_data ppdata;
  17. struct device_node __maybe_unused *np = spi->dev.of_node;
  18. + const char __maybe_unused *of_mtd_name = NULL;
  19. #ifdef CONFIG_MTD_OF_PARTS
  20. if (!of_device_is_available(np))
  21. return -ENODEV;
  22. + of_property_read_string(spi->dev.of_node,
  23. + "linux,mtd-name", &of_mtd_name);
  24. #endif
  25. /* Platform data helps sort out which chip type we have, as
  26. @@ -1001,6 +1004,8 @@ static int m25p_probe(struct spi_device
  27. if (data && data->name)
  28. flash->mtd.name = data->name;
  29. + else if (of_mtd_name)
  30. + flash->mtd.name = of_mtd_name;
  31. else
  32. flash->mtd.name = dev_name(&spi->dev);