Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727437 > unrolled thread

[PATCH] input: elantech: make arrays debounce_packet static, reduces object code size

Started byColin King <colin.king@canonical.com>
First post2017-09-06 15:10 +0200
Last post2017-09-07 23:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] input: elantech: make arrays debounce_packet static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-06 15:10 +0200
    Re: [PATCH] input: elantech: make arrays debounce_packet static,  reduces object code size Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-09-07 23:40 +0200

#1727437 — [PATCH] input: elantech: make arrays debounce_packet static, reduces object code size

FromColin King <colin.king@canonical.com>
Date2017-09-06 15:10 +0200
Subject[PATCH] input: elantech: make arrays debounce_packet static, reduces object code size
Message-ID<umIfF-2cQ-19@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Don't populate the arrays debounce_packet on the stack, instead make
them static.  Makes the object code smaller by over 870 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  30553	   9152	      0	  39705	   9b19	drivers/input/mouse/elantech.o

After:
   text	   data	    bss	    dec	    hex	filename
  29521	   9312	      0	  38833	   97b1	drivers/input/mouse/elantech.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/input/mouse/elantech.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 6428d6f4d568..b84cd978fce2 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -700,7 +700,9 @@ static int elantech_debounce_check_v2(struct psmouse *psmouse)
          * When we encounter packet that matches this exactly, it means the
          * hardware is in debounce status. Just ignore the whole packet.
          */
-        const u8 debounce_packet[] = { 0x84, 0xff, 0xff, 0x02, 0xff, 0xff };
+	static const u8 debounce_packet[] = {
+		0x84, 0xff, 0xff, 0x02, 0xff, 0xff
+	};
         unsigned char *packet = psmouse->packet;
 
         return !memcmp(packet, debounce_packet, sizeof(debounce_packet));
@@ -741,7 +743,9 @@ static int elantech_packet_check_v2(struct psmouse *psmouse)
 static int elantech_packet_check_v3(struct psmouse *psmouse)
 {
 	struct elantech_data *etd = psmouse->private;
-	const u8 debounce_packet[] = { 0xc4, 0xff, 0xff, 0x02, 0xff, 0xff };
+	static const u8 debounce_packet[] = {
+		0xc4, 0xff, 0xff, 0x02, 0xff, 0xff
+	};
 	unsigned char *packet = psmouse->packet;
 
 	/*
-- 
2.14.1

[toc] | [next] | [standalone]


#1728457 — Re: [PATCH] input: elantech: make arrays debounce_packet static, reduces object code size

FromDmitry Torokhov <dmitry.torokhov@gmail.com>
Date2017-09-07 23:40 +0200
SubjectRe: [PATCH] input: elantech: make arrays debounce_packet static, reduces object code size
Message-ID<uncGJ-5J7-13@gated-at.bofh.it>
In reply to#1727437
On Wed, Sep 06, 2017 at 01:59:44PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Don't populate the arrays debounce_packet on the stack, instead make
> them static.  Makes the object code smaller by over 870 bytes:
> 
> Before:
>    text	   data	    bss	    dec	    hex	filename
>   30553	   9152	      0	  39705	   9b19	drivers/input/mouse/elantech.o
> 
> After:
>    text	   data	    bss	    dec	    hex	filename
>   29521	   9312	      0	  38833	   97b1	drivers/input/mouse/elantech.o
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied, thank you.

> ---
>  drivers/input/mouse/elantech.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
> index 6428d6f4d568..b84cd978fce2 100644
> --- a/drivers/input/mouse/elantech.c
> +++ b/drivers/input/mouse/elantech.c
> @@ -700,7 +700,9 @@ static int elantech_debounce_check_v2(struct psmouse *psmouse)
>           * When we encounter packet that matches this exactly, it means the
>           * hardware is in debounce status. Just ignore the whole packet.
>           */
> -        const u8 debounce_packet[] = { 0x84, 0xff, 0xff, 0x02, 0xff, 0xff };
> +	static const u8 debounce_packet[] = {
> +		0x84, 0xff, 0xff, 0x02, 0xff, 0xff
> +	};
>          unsigned char *packet = psmouse->packet;
>  
>          return !memcmp(packet, debounce_packet, sizeof(debounce_packet));
> @@ -741,7 +743,9 @@ static int elantech_packet_check_v2(struct psmouse *psmouse)
>  static int elantech_packet_check_v3(struct psmouse *psmouse)
>  {
>  	struct elantech_data *etd = psmouse->private;
> -	const u8 debounce_packet[] = { 0xc4, 0xff, 0xff, 0x02, 0xff, 0xff };
> +	static const u8 debounce_packet[] = {
> +		0xc4, 0xff, 0xff, 0x02, 0xff, 0xff
> +	};
>  	unsigned char *packet = psmouse->packet;
>  
>  	/*
> -- 
> 2.14.1
> 

-- 
Dmitry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web