031-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 23d2bc42aceb829eaf90c694941e4523c22865e8 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
  3. Date: Wed, 10 Dec 2014 11:49:53 +0100
  4. Subject: [PATCH] MIPS: BCM47XX: Use helpers for reading NVRAM content
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Also drop some unneeded memset-s.
  9. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  10. Cc: Hauke Mehrtens <hauke@hauke-m.de>
  11. Cc: Paul Walmsley <paul@pwsan.com>
  12. Cc: linux-mips@linux-mips.org
  13. Patchwork: https://patchwork.linux-mips.org/patch/8661/
  14. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  15. ---
  16. arch/mips/bcm47xx/nvram.c | 7 ++-----
  17. 1 file changed, 2 insertions(+), 5 deletions(-)
  18. --- a/arch/mips/bcm47xx/nvram.c
  19. +++ b/arch/mips/bcm47xx/nvram.c
  20. @@ -91,7 +91,6 @@ static int nvram_find_and_copy(void __io
  21. return -ENXIO;
  22. found:
  23. -
  24. if (header->len > size)
  25. pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n");
  26. if (header->len > NVRAM_SPACE)
  27. @@ -101,10 +100,9 @@ found:
  28. src = (u32 *) header;
  29. dst = (u32 *) nvram_buf;
  30. for (i = 0; i < sizeof(struct nvram_header); i += 4)
  31. - *dst++ = *src++;
  32. + *dst++ = __raw_readl(src++);
  33. for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
  34. - *dst++ = le32_to_cpu(*src++);
  35. - memset(dst, 0x0, NVRAM_SPACE - i);
  36. + *dst++ = readl(src++);
  37. return 0;
  38. }
  39. @@ -165,7 +163,6 @@ static int nvram_init(void)
  40. err = mtd_read(mtd, from, len, &bytes_read, dst);
  41. if (err)
  42. return err;
  43. - memset(dst + bytes_read, 0x0, NVRAM_SPACE - bytes_read);
  44. return 0;
  45. }