Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/firmware/broadcom/bcm47xx_nvram.c: use __ioread32_copy() instead of open-coding

Now that we have a generic library function for this, replace the
open-coded instance.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: <zajec5@gmail.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Stephen Boyd and committed by
Linus Torvalds
1f330c32 c431e678

+3 -8
+3 -8
drivers/firmware/broadcom/bcm47xx_nvram.c
··· 56 56 static int nvram_find_and_copy(void __iomem *iobase, u32 lim) 57 57 { 58 58 struct nvram_header __iomem *header; 59 - int i; 60 59 u32 off; 61 - u32 *src, *dst; 62 60 u32 size; 63 61 64 62 if (nvram_len) { ··· 93 95 return -ENXIO; 94 96 95 97 found: 96 - src = (u32 *)header; 97 - dst = (u32 *)nvram_buf; 98 - for (i = 0; i < sizeof(struct nvram_header); i += 4) 99 - *dst++ = __raw_readl(src++); 98 + __ioread32_copy(nvram_buf, header, sizeof(*header) / 4); 100 99 header = (struct nvram_header *)nvram_buf; 101 100 nvram_len = header->len; 102 101 if (nvram_len > size) { ··· 106 111 nvram_len = NVRAM_SPACE - 1; 107 112 } 108 113 /* proceed reading data after header */ 109 - for (; i < nvram_len; i += 4) 110 - *dst++ = readl(src++); 114 + __ioread32_copy(nvram_buf + sizeof(*header), header + 1, 115 + DIV_ROUND_UP(nvram_len, 4)); 111 116 nvram_buf[NVRAM_SPACE - 1] = '\0'; 112 117 113 118 return 0;