linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: 104-idi-48e: make array register_offset static, makes object smaller
@ 2019-10-06 14:42 Colin King
  2019-10-06 15:07 ` William Breathitt Gray
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2019-10-06 14:42 UTC (permalink / raw)
  To: William Breathitt Gray, Linus Walleij, Bartosz Golaszewski, linux-gpio
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Don't populate the array register_offset on the stack but instead make it
static. Makes the object code smaller by 63 bytes.  Also add the int type
specifier to clean up a checkpatch warning.

Before:
   text	   data	    bss	    dec	    hex	filename
   9212	   5712	   1408	  16332	   3fcc	drivers/gpio/gpio-104-idi-48.o

After:
   text	   data	    bss	    dec	    hex	filename
   9085	   5776	   1408	  16269	   3f8d	drivers/gpio/gpio-104-idi-48.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpio/gpio-104-idi-48.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index ff53887bdaa8..c95c93ec0bd7 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -65,7 +65,7 @@ static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
 	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
 	unsigned i;
-	const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 };
+	static const unsigned int register_offset[6] = { 0, 1, 2, 4, 5, 6 };
 	unsigned base_offset;
 	unsigned mask;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: 104-idi-48e: make array register_offset static, makes object smaller
  2019-10-06 14:42 [PATCH] gpio: 104-idi-48e: make array register_offset static, makes object smaller Colin King
@ 2019-10-06 15:07 ` William Breathitt Gray
  2019-10-09 16:22   ` Bartosz Golaszewski
  0 siblings, 1 reply; 3+ messages in thread
From: William Breathitt Gray @ 2019-10-06 15:07 UTC (permalink / raw)
  To: Colin King
  Cc: Linus Walleij, Bartosz Golaszewski, linux-gpio, kernel-janitors,
	linux-kernel

On Sun, Oct 06, 2019 at 03:42:56PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the array register_offset on the stack but instead make it
> static. Makes the object code smaller by 63 bytes.  Also add the int type
> specifier to clean up a checkpatch warning.
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>    9212	   5712	   1408	  16332	   3fcc	drivers/gpio/gpio-104-idi-48.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>    9085	   5776	   1408	  16269	   3f8d	drivers/gpio/gpio-104-idi-48.o
> 
> (gcc version 9.2.1, amd64)
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/gpio/gpio-104-idi-48.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
> index ff53887bdaa8..c95c93ec0bd7 100644
> --- a/drivers/gpio/gpio-104-idi-48.c
> +++ b/drivers/gpio/gpio-104-idi-48.c
> @@ -65,7 +65,7 @@ static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset)
>  {
>  	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
>  	unsigned i;
> -	const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 };
> +	static const unsigned int register_offset[6] = { 0, 1, 2, 4, 5, 6 };
>  	unsigned base_offset;
>  	unsigned mask;
>  
> -- 
> 2.20.1

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: 104-idi-48e: make array register_offset static, makes object smaller
  2019-10-06 15:07 ` William Breathitt Gray
@ 2019-10-09 16:22   ` Bartosz Golaszewski
  0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-10-09 16:22 UTC (permalink / raw)
  To: William Breathitt Gray
  Cc: Colin King, Linus Walleij, linux-gpio, kernel-janitors, LKML

niedz., 6 paź 2019 o 17:08 William Breathitt Gray
<vilhelm.gray@gmail.com> napisał(a):
>
> On Sun, Oct 06, 2019 at 03:42:56PM +0100, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > Don't populate the array register_offset on the stack but instead make it
> > static. Makes the object code smaller by 63 bytes.  Also add the int type
> > specifier to clean up a checkpatch warning.
> >
> > Before:
> >    text          data     bss     dec     hex filename
> >    9212          5712    1408   16332    3fcc drivers/gpio/gpio-104-idi-48.o
> >
> > After:
> >    text          data     bss     dec     hex filename
> >    9085          5776    1408   16269    3f8d drivers/gpio/gpio-104-idi-48.o
> >
> > (gcc version 9.2.1, amd64)
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  drivers/gpio/gpio-104-idi-48.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
> > index ff53887bdaa8..c95c93ec0bd7 100644
> > --- a/drivers/gpio/gpio-104-idi-48.c
> > +++ b/drivers/gpio/gpio-104-idi-48.c
> > @@ -65,7 +65,7 @@ static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset)
> >  {
> >       struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
> >       unsigned i;
> > -     const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 };
> > +     static const unsigned int register_offset[6] = { 0, 1, 2, 4, 5, 6 };
> >       unsigned base_offset;
> >       unsigned mask;
> >
> > --
> > 2.20.1
>
> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

Applied for next.

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-09 16:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-06 14:42 [PATCH] gpio: 104-idi-48e: make array register_offset static, makes object smaller Colin King
2019-10-06 15:07 ` William Breathitt Gray
2019-10-09 16:22   ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).