Commit 23d2bc42 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Ralf Baechle

MIPS: BCM47XX: Use helpers for reading NVRAM content

Also drop some unneeded memset-s.
Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8661/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent aa816c1b
...@@ -91,7 +91,6 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim) ...@@ -91,7 +91,6 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
return -ENXIO; return -ENXIO;
found: found:
if (header->len > size) if (header->len > size)
pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n"); pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n");
if (header->len > NVRAM_SPACE) if (header->len > NVRAM_SPACE)
...@@ -101,10 +100,9 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim) ...@@ -101,10 +100,9 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
src = (u32 *) header; src = (u32 *) header;
dst = (u32 *) nvram_buf; dst = (u32 *) nvram_buf;
for (i = 0; i < sizeof(struct nvram_header); i += 4) for (i = 0; i < sizeof(struct nvram_header); i += 4)
*dst++ = *src++; *dst++ = __raw_readl(src++);
for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4) for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
*dst++ = le32_to_cpu(*src++); *dst++ = readl(src++);
memset(dst, 0x0, NVRAM_SPACE - i);
return 0; return 0;
} }
...@@ -165,7 +163,6 @@ static int nvram_init(void) ...@@ -165,7 +163,6 @@ static int nvram_init(void)
err = mtd_read(mtd, from, len, &bytes_read, dst); err = mtd_read(mtd, from, len, &bytes_read, dst);
if (err) if (err)
return err; return err;
memset(dst + bytes_read, 0x0, NVRAM_SPACE - bytes_read);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment