ath9k: reduce stack usage in ar9003_aic_cal_post_process
authorArnd Bergmann <arnd@arndb.de>
Fri, 12 Feb 2016 11:55:21 +0000 (12:55 +0100)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 3 Mar 2016 17:27:17 +0000 (19:27 +0200)
commite9a26010f607621597f25e55d94faf85a2d0d5a4
tree23b2ef3528087972879215f7319699b0d7dc8070
parent82def495d118c6d36300c1cf2448c276273be603
ath9k: reduce stack usage in ar9003_aic_cal_post_process

In some configurations, this function uses more than the warning limit
of 1024 bytes:

drivers/net/wireless/ath/ath9k/ar9003_aic.c: In function 'ar9003_aic_cal_post_process':
drivers/net/wireless/ath/ath9k/ar9003_aic.c:434:1: error: the frame size of 1040 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

It turns out that there are two large arrays on the stack here, but
almost all the data in them is never used outside of the loop in
which it gets written, so we can replace the array with a single
instance.

The .valid flag is used later, so I'm replacing the array of structures
with an array of bools. An obvious follow-up optimization would be
to replace it with a bitmask and set_bit()/find_first_bit()/
find_last_bit()/... operations. However, I have not tested this patch,
so I sticked to the simpler transformation that does the job of
reducing the stack usage to a harmless level.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath9k/ar9003_aic.c
drivers/net/wireless/ath/ath9k/ar9003_aic.h
This page took 0.025071 seconds and 5 git commands to generate.