brcm47xx: backport BCM47xx MIPS commits from 4.3 and 4.4-rc1
[librecmc/librecmc.git] / target / linux / brcm47xx / patches-4.1 / 033-02-MIPS-BCM47xx-Fix-some-WARNINGs-pointed-in-sprom.c-by.patch
1 From 2f94acde42b70c81129b398c44aa09411974a16d Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Sun, 25 Oct 2015 22:16:48 +0100
4 Subject: [PATCH 2/3] MIPS: BCM47xx: Fix some WARNINGs pointed in sprom.c by
5  checkpatch.pl
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 There are still few left:
11 1) Most of them about lines over 80 chars (increased readability exception)
12 2) Wrong parsing of preprocessor macros
13
14 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
15 Cc: linux-mips@linux-mips.org
16 Cc: Hauke Mehrtens <hauke@hauke-m.de>
17 Patchwork: https://patchwork.linux-mips.org/patch/11356/
18 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
19 ---
20  arch/mips/bcm47xx/sprom.c | 25 ++++++++++++++++---------
21  1 file changed, 16 insertions(+), 9 deletions(-)
22
23 diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
24 index e19c1b9..43353db 100644
25 --- a/arch/mips/bcm47xx/sprom.c
26 +++ b/arch/mips/bcm47xx/sprom.c
27 @@ -60,9 +60,9 @@ static int get_nvram_var(const char *prefix, const char *postfix,
28  }
29  
30  #define NVRAM_READ_VAL(type)                                           \
31 -static void nvram_read_ ## type (const char *prefix,                   \
32 -                                const char *postfix, const char *name, \
33 -                                type *val, type allset, bool fallback) \
34 +static void nvram_read_ ## type(const char *prefix,                    \
35 +                               const char *postfix, const char *name,  \
36 +                               type *val, type allset, bool fallback)  \
37  {                                                                      \
38         char buf[100];                                                  \
39         int err;                                                        \
40 @@ -422,7 +422,10 @@ static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom,
41         int i;
42  
43         for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) {
44 -               struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i];
45 +               struct ssb_sprom_core_pwr_info *pwr_info;
46 +
47 +               pwr_info = &sprom->core_pwr_info[i];
48 +
49                 snprintf(postfix, sizeof(postfix), "%i", i);
50                 nvram_read_u8(prefix, postfix, "maxp2ga",
51                               &pwr_info->maxpwr_2g, 0, fallback);
52 @@ -470,7 +473,10 @@ static void bcm47xx_fill_sprom_path_r45(struct ssb_sprom *sprom,
53         int i;
54  
55         for (i = 0; i < ARRAY_SIZE(sprom->core_pwr_info); i++) {
56 -               struct ssb_sprom_core_pwr_info *pwr_info = &sprom->core_pwr_info[i];
57 +               struct ssb_sprom_core_pwr_info *pwr_info;
58 +
59 +               pwr_info = &sprom->core_pwr_info[i];
60 +
61                 snprintf(postfix, sizeof(postfix), "%i", i);
62                 nvram_read_u16(prefix, postfix, "pa2gw3a",
63                                &pwr_info->pa_2g[3], 0, fallback);
64 @@ -535,10 +541,11 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
65         nvram_read_macaddr(prefix, "il0macaddr", sprom->il0mac, fallback);
66  
67         /* The address prefix 00:90:4C is used by Broadcom in their initial
68 -          configuration. When a mac address with the prefix 00:90:4C is used
69 -          all devices from the same series are sharing the same mac address.
70 -          To prevent mac address collisions we replace them with a mac address
71 -          based on the base address. */
72 +        * configuration. When a mac address with the prefix 00:90:4C is used
73 +        * all devices from the same series are sharing the same mac address.
74 +        * To prevent mac address collisions we replace them with a mac address
75 +        * based on the base address.
76 +        */
77         if (!bcm47xx_is_valid_mac(sprom->il0mac)) {
78                 u8 mac[6];
79  
80 -- 
81 1.8.4.5
82