Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-07 Thread Arend Van Spriel
On 7-3-2017 10:44, Kalle Valo wrote:
> Arnd Bergmann  writes:
> 
>> On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
>>> Arend Van Spriel  writes:
>>>
 On 2-3-2017 17:38, Arnd Bergmann wrote:
> With KASAN and a couple of other patches applied, this driver is one
> of the few remaining ones that actually use more than 2048 bytes of
> kernel stack:
>
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function
> 'wlc_phy_workarounds_nphy_gainctrl':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the
> frame size of 3264 bytes is larger than 2048 bytes
> [-Wframe-larger-than=]
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the
> frame size of 2864 bytes is larger than 2048 bytes
> [-Wframe-larger-than=]
>
> Here, I'm reducing the stack size by marking as many local variables as
> 'static const' as I can without changing the actual code.

 Acked-by: Arend van Spriel 
>>>
>>> Arnd, via which tree are you planning to submit these? I'm not sure
>>> what I should do with the wireless drivers patches from this series.
>>
>> I'm not quite sure myself yet. I'd probably want the first few patches that
>> do most of the work get merged through Andrew's linux-mm tree once
>> we have come to agreement on them. The driver specific patches like
>> the brcmsmac ones depend on the introduction of noinline_for_kasan
>> or noinline_if_stackbloat and could either go in along with the first
>> set, or as a follow-up through the normal maintainer trees.
> 
> Either way is fine for me. Just mark clearly if you want the wireless
> drivers patches to go through via my tree, otherwise I'll ignore them.

That (dreaded) phy code does not get a lot of changes so I think it does
not matter which tree is will go through in terms of risk for conflicts.
So going through linux-mm is fine for me as well.

Regards,
Arend


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-07 Thread Arend Van Spriel
On 7-3-2017 10:44, Kalle Valo wrote:
> Arnd Bergmann  writes:
> 
>> On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
>>> Arend Van Spriel  writes:
>>>
 On 2-3-2017 17:38, Arnd Bergmann wrote:
> With KASAN and a couple of other patches applied, this driver is one
> of the few remaining ones that actually use more than 2048 bytes of
> kernel stack:
>
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function
> 'wlc_phy_workarounds_nphy_gainctrl':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the
> frame size of 3264 bytes is larger than 2048 bytes
> [-Wframe-larger-than=]
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the
> frame size of 2864 bytes is larger than 2048 bytes
> [-Wframe-larger-than=]
>
> Here, I'm reducing the stack size by marking as many local variables as
> 'static const' as I can without changing the actual code.

 Acked-by: Arend van Spriel 
>>>
>>> Arnd, via which tree are you planning to submit these? I'm not sure
>>> what I should do with the wireless drivers patches from this series.
>>
>> I'm not quite sure myself yet. I'd probably want the first few patches that
>> do most of the work get merged through Andrew's linux-mm tree once
>> we have come to agreement on them. The driver specific patches like
>> the brcmsmac ones depend on the introduction of noinline_for_kasan
>> or noinline_if_stackbloat and could either go in along with the first
>> set, or as a follow-up through the normal maintainer trees.
> 
> Either way is fine for me. Just mark clearly if you want the wireless
> drivers patches to go through via my tree, otherwise I'll ignore them.

That (dreaded) phy code does not get a lot of changes so I think it does
not matter which tree is will go through in terms of risk for conflicts.
So going through linux-mm is fine for me as well.

Regards,
Arend


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-07 Thread Kalle Valo
Arnd Bergmann  writes:

> On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
>> Arend Van Spriel  writes:
>>
>>> On 2-3-2017 17:38, Arnd Bergmann wrote:
 With KASAN and a couple of other patches applied, this driver is one
 of the few remaining ones that actually use more than 2048 bytes of
 kernel stack:

 broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function
 'wlc_phy_workarounds_nphy_gainctrl':
 broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the
 frame size of 3264 bytes is larger than 2048 bytes
 [-Wframe-larger-than=]
 broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
 'wlc_phy_workarounds_nphy':
 broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the
 frame size of 2864 bytes is larger than 2048 bytes
 [-Wframe-larger-than=]

 Here, I'm reducing the stack size by marking as many local variables as
 'static const' as I can without changing the actual code.
>>>
>>> Acked-by: Arend van Spriel 
>>
>> Arnd, via which tree are you planning to submit these? I'm not sure
>> what I should do with the wireless drivers patches from this series.
>
> I'm not quite sure myself yet. I'd probably want the first few patches that
> do most of the work get merged through Andrew's linux-mm tree once
> we have come to agreement on them. The driver specific patches like
> the brcmsmac ones depend on the introduction of noinline_for_kasan
> or noinline_if_stackbloat and could either go in along with the first
> set, or as a follow-up through the normal maintainer trees.

Either way is fine for me. Just mark clearly if you want the wireless
drivers patches to go through via my tree, otherwise I'll ignore them.

-- 
Kalle Valo


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-07 Thread Kalle Valo
Arnd Bergmann  writes:

> On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
>> Arend Van Spriel  writes:
>>
>>> On 2-3-2017 17:38, Arnd Bergmann wrote:
 With KASAN and a couple of other patches applied, this driver is one
 of the few remaining ones that actually use more than 2048 bytes of
 kernel stack:

 broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function
 'wlc_phy_workarounds_nphy_gainctrl':
 broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the
 frame size of 3264 bytes is larger than 2048 bytes
 [-Wframe-larger-than=]
 broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
 'wlc_phy_workarounds_nphy':
 broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the
 frame size of 2864 bytes is larger than 2048 bytes
 [-Wframe-larger-than=]

 Here, I'm reducing the stack size by marking as many local variables as
 'static const' as I can without changing the actual code.
>>>
>>> Acked-by: Arend van Spriel 
>>
>> Arnd, via which tree are you planning to submit these? I'm not sure
>> what I should do with the wireless drivers patches from this series.
>
> I'm not quite sure myself yet. I'd probably want the first few patches that
> do most of the work get merged through Andrew's linux-mm tree once
> we have come to agreement on them. The driver specific patches like
> the brcmsmac ones depend on the introduction of noinline_for_kasan
> or noinline_if_stackbloat and could either go in along with the first
> set, or as a follow-up through the normal maintainer trees.

Either way is fine for me. Just mark clearly if you want the wireless
drivers patches to go through via my tree, otherwise I'll ignore them.

-- 
Kalle Valo


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Arnd Bergmann
On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
> Arend Van Spriel  writes:
>
>> On 2-3-2017 17:38, Arnd Bergmann wrote:
>>> With KASAN and a couple of other patches applied, this driver is one
>>> of the few remaining ones that actually use more than 2048 bytes of
>>> kernel stack:
>>>
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>>> 'wlc_phy_workarounds_nphy_gainctrl':
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
>>> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>>> 'wlc_phy_workarounds_nphy':
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
>>> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>>>
>>> Here, I'm reducing the stack size by marking as many local variables as
>>> 'static const' as I can without changing the actual code.
>>
>> Acked-by: Arend van Spriel 
>
> Arnd, via which tree are you planning to submit these? I'm not sure
> what I should do with the wireless drivers patches from this series.

I'm not quite sure myself yet. I'd probably want the first few patches that
do most of the work get merged through Andrew's linux-mm tree once
we have come to agreement on them. The driver specific patches like
the brcmsmac ones depend on the introduction of noinline_for_kasan
or noinline_if_stackbloat and could either go in along with the first
set, or as a follow-up through the normal maintainer trees.

   Arnd


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Arnd Bergmann
On Mon, Mar 6, 2017 at 5:19 PM, Kalle Valo  wrote:
> Arend Van Spriel  writes:
>
>> On 2-3-2017 17:38, Arnd Bergmann wrote:
>>> With KASAN and a couple of other patches applied, this driver is one
>>> of the few remaining ones that actually use more than 2048 bytes of
>>> kernel stack:
>>>
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>>> 'wlc_phy_workarounds_nphy_gainctrl':
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
>>> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>>> 'wlc_phy_workarounds_nphy':
>>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
>>> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>>>
>>> Here, I'm reducing the stack size by marking as many local variables as
>>> 'static const' as I can without changing the actual code.
>>
>> Acked-by: Arend van Spriel 
>
> Arnd, via which tree are you planning to submit these? I'm not sure
> what I should do with the wireless drivers patches from this series.

I'm not quite sure myself yet. I'd probably want the first few patches that
do most of the work get merged through Andrew's linux-mm tree once
we have come to agreement on them. The driver specific patches like
the brcmsmac ones depend on the introduction of noinline_for_kasan
or noinline_if_stackbloat and could either go in along with the first
set, or as a follow-up through the normal maintainer trees.

   Arnd


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Kalle Valo
Arend Van Spriel  writes:

> On 2-3-2017 17:38, Arnd Bergmann wrote:
>> With KASAN and a couple of other patches applied, this driver is one
>> of the few remaining ones that actually use more than 2048 bytes of
>> kernel stack:
>> 
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>> 'wlc_phy_workarounds_nphy_gainctrl':
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
>> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>> 'wlc_phy_workarounds_nphy':
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
>> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>> 
>> Here, I'm reducing the stack size by marking as many local variables as
>> 'static const' as I can without changing the actual code.
>
> Acked-by: Arend van Spriel 

Arnd, via which tree are you planning to submit these? I'm not sure
what I should do with the wireless drivers patches from this series.

-- 
Kalle Valo


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Kalle Valo
Arend Van Spriel  writes:

> On 2-3-2017 17:38, Arnd Bergmann wrote:
>> With KASAN and a couple of other patches applied, this driver is one
>> of the few remaining ones that actually use more than 2048 bytes of
>> kernel stack:
>> 
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>> 'wlc_phy_workarounds_nphy_gainctrl':
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
>> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
>> 'wlc_phy_workarounds_nphy':
>> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
>> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
>> 
>> Here, I'm reducing the stack size by marking as many local variables as
>> 'static const' as I can without changing the actual code.
>
> Acked-by: Arend van Spriel 

Arnd, via which tree are you planning to submit these? I'm not sure
what I should do with the wireless drivers patches from this series.

-- 
Kalle Valo


Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Arend Van Spriel
On 2-3-2017 17:38, Arnd Bergmann wrote:
> With KASAN and a couple of other patches applied, this driver is one
> of the few remaining ones that actually use more than 2048 bytes of
> kernel stack:
> 
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy_gainctrl':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 
> Here, I'm reducing the stack size by marking as many local variables as
> 'static const' as I can without changing the actual code.

Acked-by: Arend van Spriel 
> Signed-off-by: Arnd Bergmann 
> ---
>  .../broadcom/brcm80211/brcmsmac/phy/phy_n.c| 197 
> ++---
>  1 file changed, 97 insertions(+), 100 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c 
> b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> index 42dc8e1f483d..48a4df488d75 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> @@ -14764,8 +14764,8 @@ static void 
> wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi)
>  }
>  
>  static void
> -wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys,
> -u8 len)
> +wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, const u8 *events,
> +const u8 *dlys, u8 len)
>  {
>   u32 t1_offset, t2_offset;
>   u8 ctr;
> @@ -15240,16 +15240,16 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi)
>  static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>  {
>   u16 currband;
> - s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
> - s8 *lna1_gain_db = NULL;
> - s8 *lna1_gain_db_2 = NULL;
> - s8 *lna2_gain_db = NULL;
> - s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 };
> - s8 *tia_gain_db;
> - s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
> - s8 *tia_gainbits;
> - u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
> - u16 *rfseq_init_gain;
> + static const s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
> + const s8 *lna1_gain_db = NULL;
> + const s8 *lna1_gain_db_2 = NULL;
> + const s8 *lna2_gain_db = NULL;
> + static const s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 
> };
> + const s8 *tia_gain_db;
> + static const s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
> + const s8 *tia_gainbits;
> + static const u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
> + const u16 *rfseq_init_gain;
>   u16 init_gaincode;
>   u16 clip1hi_gaincode;
>   u16 clip1md_gaincode = 0;
> @@ -15310,10 +15310,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>  
>   if ((freq <= 5080) || (freq == 5825)) {
>  
> - s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 };
> - s8 lna1A_gain_db_2_rev7[] = {
> - 11, 17, 22, 25};
> - s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
> + static const s8 lna1A_gain_db_rev7[] = { 11, 
> 16, 20, 24 };
> + static const s8 lna1A_gain_db_2_rev7[] = { 11, 
> 17, 22, 25};
> + static const s8 lna2A_gain_db_rev7[] = { -1, 6, 
> 10, 14 };
>  
>   crsminu_th = 0x3e;
>   lna1_gain_db = lna1A_gain_db_rev7;
> @@ -15321,10 +15320,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>   lna2_gain_db = lna2A_gain_db_rev7;
>   } else if ((freq >= 5500) && (freq <= 5700)) {
>  
> - s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 };
> - s8 lna1A_gain_db_2_rev7[] = {
> - 12, 18, 22, 26};
> - s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
> + static const s8 lna1A_gain_db_rev7[] = { 11, 
> 17, 21, 25 };
> + static const s8 lna1A_gain_db_2_rev7[] = { 12, 
> 18, 22, 26};
> + static const s8 lna2A_gain_db_rev7[] = { 1, 8, 
> 12, 16 };
>  
>   crsminu_th = 0x45;
>   clip1md_gaincode_B = 0x14;
> @@ -15335,10 +15333,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>   lna2_gain_db = lna2A_gain_db_rev7;

Re: [PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-06 Thread Arend Van Spriel
On 2-3-2017 17:38, Arnd Bergmann wrote:
> With KASAN and a couple of other patches applied, this driver is one
> of the few remaining ones that actually use more than 2048 bytes of
> kernel stack:
> 
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy_gainctrl':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
> 3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
> 'wlc_phy_workarounds_nphy':
> broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
> 2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]
> 
> Here, I'm reducing the stack size by marking as many local variables as
> 'static const' as I can without changing the actual code.

Acked-by: Arend van Spriel 
> Signed-off-by: Arnd Bergmann 
> ---
>  .../broadcom/brcm80211/brcmsmac/phy/phy_n.c| 197 
> ++---
>  1 file changed, 97 insertions(+), 100 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c 
> b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> index 42dc8e1f483d..48a4df488d75 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
> @@ -14764,8 +14764,8 @@ static void 
> wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi)
>  }
>  
>  static void
> -wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys,
> -u8 len)
> +wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, const u8 *events,
> +const u8 *dlys, u8 len)
>  {
>   u32 t1_offset, t2_offset;
>   u8 ctr;
> @@ -15240,16 +15240,16 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi)
>  static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>  {
>   u16 currband;
> - s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
> - s8 *lna1_gain_db = NULL;
> - s8 *lna1_gain_db_2 = NULL;
> - s8 *lna2_gain_db = NULL;
> - s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 };
> - s8 *tia_gain_db;
> - s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
> - s8 *tia_gainbits;
> - u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
> - u16 *rfseq_init_gain;
> + static const s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
> + const s8 *lna1_gain_db = NULL;
> + const s8 *lna1_gain_db_2 = NULL;
> + const s8 *lna2_gain_db = NULL;
> + static const s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 
> };
> + const s8 *tia_gain_db;
> + static const s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
> + const s8 *tia_gainbits;
> + static const u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
> + const u16 *rfseq_init_gain;
>   u16 init_gaincode;
>   u16 clip1hi_gaincode;
>   u16 clip1md_gaincode = 0;
> @@ -15310,10 +15310,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>  
>   if ((freq <= 5080) || (freq == 5825)) {
>  
> - s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 };
> - s8 lna1A_gain_db_2_rev7[] = {
> - 11, 17, 22, 25};
> - s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
> + static const s8 lna1A_gain_db_rev7[] = { 11, 
> 16, 20, 24 };
> + static const s8 lna1A_gain_db_2_rev7[] = { 11, 
> 17, 22, 25};
> + static const s8 lna2A_gain_db_rev7[] = { -1, 6, 
> 10, 14 };
>  
>   crsminu_th = 0x3e;
>   lna1_gain_db = lna1A_gain_db_rev7;
> @@ -15321,10 +15320,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>   lna2_gain_db = lna2A_gain_db_rev7;
>   } else if ((freq >= 5500) && (freq <= 5700)) {
>  
> - s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 };
> - s8 lna1A_gain_db_2_rev7[] = {
> - 12, 18, 22, 26};
> - s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
> + static const s8 lna1A_gain_db_rev7[] = { 11, 
> 17, 21, 25 };
> + static const s8 lna1A_gain_db_2_rev7[] = { 12, 
> 18, 22, 26};
> + static const s8 lna2A_gain_db_rev7[] = { 1, 8, 
> 12, 16 };
>  
>   crsminu_th = 0x45;
>   clip1md_gaincode_B = 0x14;
> @@ -15335,10 +15333,9 @@ static void 
> wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
>   lna2_gain_db = lna2A_gain_db_rev7;
>   } else {
>  
> - 

[PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-02 Thread Arnd Bergmann
With KASAN and a couple of other patches applied, this driver is one
of the few remaining ones that actually use more than 2048 bytes of
kernel stack:

broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
'wlc_phy_workarounds_nphy_gainctrl':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]

Here, I'm reducing the stack size by marking as many local variables as
'static const' as I can without changing the actual code.

Signed-off-by: Arnd Bergmann 
---
 .../broadcom/brcm80211/brcmsmac/phy/phy_n.c| 197 ++---
 1 file changed, 97 insertions(+), 100 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
index 42dc8e1f483d..48a4df488d75 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
@@ -14764,8 +14764,8 @@ static void 
wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi)
 }
 
 static void
-wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys,
-  u8 len)
+wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, const u8 *events,
+  const u8 *dlys, u8 len)
 {
u32 t1_offset, t2_offset;
u8 ctr;
@@ -15240,16 +15240,16 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi)
 static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
 {
u16 currband;
-   s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
-   s8 *lna1_gain_db = NULL;
-   s8 *lna1_gain_db_2 = NULL;
-   s8 *lna2_gain_db = NULL;
-   s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 };
-   s8 *tia_gain_db;
-   s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
-   s8 *tia_gainbits;
-   u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
-   u16 *rfseq_init_gain;
+   static const s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
+   const s8 *lna1_gain_db = NULL;
+   const s8 *lna1_gain_db_2 = NULL;
+   const s8 *lna2_gain_db = NULL;
+   static const s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 
};
+   const s8 *tia_gain_db;
+   static const s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
+   const s8 *tia_gainbits;
+   static const u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
+   const u16 *rfseq_init_gain;
u16 init_gaincode;
u16 clip1hi_gaincode;
u16 clip1md_gaincode = 0;
@@ -15310,10 +15310,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
 
if ((freq <= 5080) || (freq == 5825)) {
 
-   s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 };
-   s8 lna1A_gain_db_2_rev7[] = {
-   11, 17, 22, 25};
-   s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
+   static const s8 lna1A_gain_db_rev7[] = { 11, 
16, 20, 24 };
+   static const s8 lna1A_gain_db_2_rev7[] = { 11, 
17, 22, 25};
+   static const s8 lna2A_gain_db_rev7[] = { -1, 6, 
10, 14 };
 
crsminu_th = 0x3e;
lna1_gain_db = lna1A_gain_db_rev7;
@@ -15321,10 +15320,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
lna2_gain_db = lna2A_gain_db_rev7;
} else if ((freq >= 5500) && (freq <= 5700)) {
 
-   s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 };
-   s8 lna1A_gain_db_2_rev7[] = {
-   12, 18, 22, 26};
-   s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
+   static const s8 lna1A_gain_db_rev7[] = { 11, 
17, 21, 25 };
+   static const s8 lna1A_gain_db_2_rev7[] = { 12, 
18, 22, 26};
+   static const s8 lna2A_gain_db_rev7[] = { 1, 8, 
12, 16 };
 
crsminu_th = 0x45;
clip1md_gaincode_B = 0x14;
@@ -15335,10 +15333,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
lna2_gain_db = lna2A_gain_db_rev7;
} else {
 
-   s8 lna1A_gain_db_rev7[] = { 12, 18, 22, 26 };
-   s8 lna1A_gain_db_2_rev7[] = {
-

[PATCH 08/26] brcmsmac: make some local variables 'static const' to reduce stack size

2017-03-02 Thread Arnd Bergmann
With KASAN and a couple of other patches applied, this driver is one
of the few remaining ones that actually use more than 2048 bytes of
kernel stack:

broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 
'wlc_phy_workarounds_nphy_gainctrl':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:16065:1: warning: the frame size of 
3264 bytes is larger than 2048 bytes [-Wframe-larger-than=]
broadcom/brcm80211/brcmsmac/phy/phy_n.c: In function 'wlc_phy_workarounds_nphy':
broadcom/brcm80211/brcmsmac/phy/phy_n.c:17138:1: warning: the frame size of 
2864 bytes is larger than 2048 bytes [-Wframe-larger-than=]

Here, I'm reducing the stack size by marking as many local variables as
'static const' as I can without changing the actual code.

Signed-off-by: Arnd Bergmann 
---
 .../broadcom/brcm80211/brcmsmac/phy/phy_n.c| 197 ++---
 1 file changed, 97 insertions(+), 100 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c 
b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
index 42dc8e1f483d..48a4df488d75 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c
@@ -14764,8 +14764,8 @@ static void 
wlc_phy_ipa_restore_tx_digi_filts_nphy(struct brcms_phy *pi)
 }
 
 static void
-wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, u8 *events, u8 *dlys,
-  u8 len)
+wlc_phy_set_rfseq_nphy(struct brcms_phy *pi, u8 cmd, const u8 *events,
+  const u8 *dlys, u8 len)
 {
u32 t1_offset, t2_offset;
u8 ctr;
@@ -15240,16 +15240,16 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev5(struct brcms_phy *pi)
 static void wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
 {
u16 currband;
-   s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
-   s8 *lna1_gain_db = NULL;
-   s8 *lna1_gain_db_2 = NULL;
-   s8 *lna2_gain_db = NULL;
-   s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 };
-   s8 *tia_gain_db;
-   s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
-   s8 *tia_gainbits;
-   u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
-   u16 *rfseq_init_gain;
+   static const s8 lna1G_gain_db_rev7[] = { 9, 14, 19, 24 };
+   const s8 *lna1_gain_db = NULL;
+   const s8 *lna1_gain_db_2 = NULL;
+   const s8 *lna2_gain_db = NULL;
+   static const s8 tiaA_gain_db_rev7[] = { -9, -6, -3, 0, 3, 3, 3, 3, 3, 3 
};
+   const s8 *tia_gain_db;
+   static const s8 tiaA_gainbits_rev7[] = { 0, 1, 2, 3, 4, 4, 4, 4, 4, 4 };
+   const s8 *tia_gainbits;
+   static const u16 rfseqA_init_gain_rev7[] = { 0x624f, 0x624f };
+   const u16 *rfseq_init_gain;
u16 init_gaincode;
u16 clip1hi_gaincode;
u16 clip1md_gaincode = 0;
@@ -15310,10 +15310,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
 
if ((freq <= 5080) || (freq == 5825)) {
 
-   s8 lna1A_gain_db_rev7[] = { 11, 16, 20, 24 };
-   s8 lna1A_gain_db_2_rev7[] = {
-   11, 17, 22, 25};
-   s8 lna2A_gain_db_rev7[] = { -1, 6, 10, 14 };
+   static const s8 lna1A_gain_db_rev7[] = { 11, 
16, 20, 24 };
+   static const s8 lna1A_gain_db_2_rev7[] = { 11, 
17, 22, 25};
+   static const s8 lna2A_gain_db_rev7[] = { -1, 6, 
10, 14 };
 
crsminu_th = 0x3e;
lna1_gain_db = lna1A_gain_db_rev7;
@@ -15321,10 +15320,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
lna2_gain_db = lna2A_gain_db_rev7;
} else if ((freq >= 5500) && (freq <= 5700)) {
 
-   s8 lna1A_gain_db_rev7[] = { 11, 17, 21, 25 };
-   s8 lna1A_gain_db_2_rev7[] = {
-   12, 18, 22, 26};
-   s8 lna2A_gain_db_rev7[] = { 1, 8, 12, 16 };
+   static const s8 lna1A_gain_db_rev7[] = { 11, 
17, 21, 25 };
+   static const s8 lna1A_gain_db_2_rev7[] = { 12, 
18, 22, 26};
+   static const s8 lna2A_gain_db_rev7[] = { 1, 8, 
12, 16 };
 
crsminu_th = 0x45;
clip1md_gaincode_B = 0x14;
@@ -15335,10 +15333,9 @@ static void 
wlc_phy_workarounds_nphy_gainctrl_2057_rev6(struct brcms_phy *pi)
lna2_gain_db = lna2A_gain_db_rev7;
} else {
 
-   s8 lna1A_gain_db_rev7[] = { 12, 18, 22, 26 };
-   s8 lna1A_gain_db_2_rev7[] = {
-   12, 18, 22,