n810bm: Simplify calib pointer access
[openwrt.git] / target / linux / brcm47xx / patches-2.6.36 / 031-sb-fix-nvram_get-on-bcm47xx-platform.patch
1 From 99dfec6e793651963ede3c2721b9ff3c81e3aeac Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 27 Nov 2010 14:04:36 +0100
4 Subject: [PATCH 6/6] sb: fix nvram_get on bcm47xx platform
5
6 The nvram_get function was never in the mainline kernel, it only
7 existed in an external OpenWrt patch. Use nvram_getenv function, which
8 is in mainline and use an include instead of an extra function
9 declaration.
10 et0macaddr contains the mac address in text from like
11 00:11:22:33:44:55. We have to parse it before adding it into macaddr.
12
13 nvram_parse_macaddr will be merged into asm/mach-bcm47xx/nvram.h though
14 the MIPS git tree and will be available soon. It will not build now
15 without nvram_parse_macaddr, but it haven't done before.
16
17 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
18 ---
19  include/linux/ssb/ssb_driver_gige.h |   17 +++++++++++------
20  1 files changed, 11 insertions(+), 6 deletions(-)
21
22 --- a/include/linux/ssb/ssb_driver_gige.h
23 +++ b/include/linux/ssb/ssb_driver_gige.h
24 @@ -96,16 +96,21 @@ static inline bool ssb_gige_must_flush_p
25         return 0;
26  }
27  
28 -extern char * nvram_get(const char *name);
29 +#ifdef CONFIG_BCM47XX
30 +#include <asm/mach-bcm47xx/nvram.h>
31  /* Get the device MAC address */
32  static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
33  {
34 -#ifdef CONFIG_BCM47XX
35 -       char *res = nvram_get("et0macaddr");
36 -       if (res)
37 -               memcpy(macaddr, res, 6);
38 -#endif
39 +       char buf[20];
40 +       if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0)
41 +               return;
42 +       nvram_parse_macaddr(buf, macaddr);
43  }
44 +#else
45 +static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
46 +{
47 +}
48 +#endif
49  
50  extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
51                                           struct pci_dev *pdev);