Re: [PATCH] x86/platform/intel-mid: make several arrays static, makes code smaller

From: Andy Shevchenko
Date: Fri Aug 25 2017 - 12:54:10 EST


On Fri, 2017-08-25 at 17:32 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> Don't populate arrays on the stack, instead make them static .
> Makes the object code smaller by 76 bytes:
>
> Before:
> ÂÂÂtext ÂÂÂdata ÂÂÂÂbss ÂÂÂÂdec ÂÂÂÂhex
> filename
> ÂÂÂ4217 ÂÂÂ1540 ÂÂÂÂ128 ÂÂÂ5885 ÂÂÂ16fd
> arch/x86/platform/intel-mid/pwr.o
>
> After:
> ÂÂÂtext ÂÂÂdata ÂÂÂÂbss ÂÂÂÂdec ÂÂÂÂhex
> filename
> ÂÂÂ3981 ÂÂÂ1700 ÂÂÂÂ128 ÂÂÂ5809 ÂÂÂ16b1
> arch/x86/platform/intel-mid/pwr.o

Fine by me.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

>
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
> Âarch/x86/platform/intel-mid/pwr.c | 4 ++--
> Â1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/platform/intel-mid/pwr.c
> b/arch/x86/platform/intel-mid/pwr.c
> index ef03852ea6e8..49ec5b94c71f 100644
> --- a/arch/x86/platform/intel-mid/pwr.c
> +++ b/arch/x86/platform/intel-mid/pwr.c
> @@ -444,7 +444,7 @@ static int mid_set_initial_state(struct mid_pwr
> *pwr, const u32 *states)
> Âstatic int pnw_set_initial_state(struct mid_pwr *pwr)
> Â{
> Â /* On Penwell SRAM must stay powered on */
> - const u32 states[] = {
> + static const u32 states[] = {
> Â 0xf00fffff, /* PM_SSC(0) */
> Â 0xffffffff, /* PM_SSC(1) */
> Â 0xffffffff, /* PM_SSC(2) */
> @@ -455,7 +455,7 @@ static int pnw_set_initial_state(struct mid_pwr
> *pwr)
> Â
> Âstatic int tng_set_initial_state(struct mid_pwr *pwr)
> Â{
> - const u32 states[] = {
> + static const u32 states[] = {
> Â 0xffffffff, /* PM_SSC(0) */
> Â 0xffffffff, /* PM_SSC(1) */
> Â 0xffffffff, /* PM_SSC(2) */

--
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy