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

MIPS: bcm47xx: refactor fetching board data

Now the fetching of board data also uses nvram_read_u16 and not
simple_strtoul any more.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Hauke Mehrtens and committed by
John W. Linville
a9bba182 5a20ef3d

+18 -6
+1 -6
arch/mips/bcm47xx/setup.c
··· 109 109 /* Fill boardinfo structure */ 110 110 memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); 111 111 112 - if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) 113 - iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0); 114 - else 115 - iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM; 116 - if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0) 117 - iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0); 112 + bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL); 118 113 119 114 bcm47xx_fill_sprom(&iv->sprom, NULL); 120 115
+12
arch/mips/bcm47xx/sprom.c
··· 618 618 bcm47xx_fill_sprom_r1(sprom, prefix); 619 619 } 620 620 } 621 + 622 + #ifdef CONFIG_BCM47XX_SSB 623 + void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, 624 + const char *prefix) 625 + { 626 + nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0); 627 + if (!boardinfo->vendor) 628 + boardinfo->vendor = SSB_BOARDVENDOR_BCM; 629 + 630 + nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0); 631 + } 632 + #endif
+5
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
··· 47 47 void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix); 48 48 void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix); 49 49 50 + #ifdef CONFIG_BCM47XX_SSB 51 + void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, 52 + const char *prefix); 53 + #endif 54 + 50 55 #endif /* __ASM_BCM47XX_H */