1 From fb009cbdd0693bd633f11e99526617b3d392cfad Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Mon, 8 Mar 2021 10:03:16 +0100
4 Subject: [PATCH] firmware: bcm47xx_nvram: rename finding function and its
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 1. Use "bcm47xx_" function name prefix for consistency
11 2. It takes flash start as argument so s/iobase/flash_start/
12 3. "off" was used for finding flash end so just call it "flash_size"
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
17 drivers/firmware/broadcom/bcm47xx_nvram.c | 24 ++++++++++++-----------
18 1 file changed, 13 insertions(+), 11 deletions(-)
20 --- a/drivers/firmware/broadcom/bcm47xx_nvram.c
21 +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
22 @@ -48,11 +48,13 @@ static u32 find_nvram_size(void __iomem
26 -/* Probe for NVRAM header */
27 -static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
29 + * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it
31 +static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size)
33 struct nvram_header __iomem *header;
39 @@ -61,25 +63,25 @@ static int nvram_find_and_copy(void __io
42 /* TODO: when nvram is on nand flash check for bad blocks first. */
44 - while (off <= lim) {
45 + flash_size = FLASH_MIN;
46 + while (flash_size <= res_size) {
47 /* Windowed flash access */
48 - size = find_nvram_size(iobase + off);
49 + size = find_nvram_size(flash_start + flash_size);
51 - header = (struct nvram_header *)(iobase + off - size);
52 + header = (struct nvram_header *)(flash_start + flash_size - size);
59 /* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
60 - header = (struct nvram_header *)(iobase + 4096);
61 + header = (struct nvram_header *)(flash_start + 4096);
62 if (header->magic == NVRAM_MAGIC) {
67 - header = (struct nvram_header *)(iobase + 1024);
68 + header = (struct nvram_header *)(flash_start + 1024);
69 if (header->magic == NVRAM_MAGIC) {
72 @@ -124,7 +126,7 @@ int bcm47xx_nvram_init_from_mem(u32 base
76 - err = nvram_find_and_copy(iobase, lim);
77 + err = bcm47xx_nvram_find_and_copy(iobase, lim);