ar71xx: make 902-unaligned_access_hacks.patch apply again
[openwrt/staging/chunkeey.git] / target / linux / brcm47xx / patches-4.0 / 030-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch
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
9 Also drop some unneeded memset-s.
10
11 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
12 Cc: Hauke Mehrtens <hauke@hauke-m.de>
13 Cc: Paul Walmsley <paul@pwsan.com>
14 Cc: linux-mips@linux-mips.org
15 Patchwork: https://patchwork.linux-mips.org/patch/8661/
16 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
17 ---
18 arch/mips/bcm47xx/nvram.c | 7 ++-----
19 1 file changed, 2 insertions(+), 5 deletions(-)
20
21 --- a/arch/mips/bcm47xx/nvram.c
22 +++ b/arch/mips/bcm47xx/nvram.c
23 @@ -91,7 +91,6 @@ static int nvram_find_and_copy(void __io
24 return -ENXIO;
25
26 found:
27 -
28 if (header->len > size)
29 pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n");
30 if (header->len > NVRAM_SPACE)
31 @@ -101,10 +100,9 @@ found:
32 src = (u32 *) header;
33 dst = (u32 *) nvram_buf;
34 for (i = 0; i < sizeof(struct nvram_header); i += 4)
35 - *dst++ = *src++;
36 + *dst++ = __raw_readl(src++);
37 for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
38 - *dst++ = le32_to_cpu(*src++);
39 - memset(dst, 0x0, NVRAM_SPACE - i);
40 + *dst++ = readl(src++);
41
42 return 0;
43 }
44 @@ -165,7 +163,6 @@ static int nvram_init(void)
45 err = mtd_read(mtd, from, len, &bytes_read, dst);
46 if (err)
47 return err;
48 - memset(dst + bytes_read, 0x0, NVRAM_SPACE - bytes_read);
49
50 return 0;
51 }