All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Joe Perches <joe@perches.com>
Cc: Jan Dumon <j.dumon@option.com>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 46/62] usb: Use static const
Date: Sun, 21 Nov 2010 17:06:53 +0300	[thread overview]
Message-ID: <4CE9277D.9050505@ru.mvista.com> (raw)
In-Reply-To: <ed2a5bd07f07601ba12ce3c8fcbce2dd954c35aa.1290305776.git.joe@perches.com>

Hello.

On 21-11-2010 5:38, Joe Perches wrote:

> Using static const generally increases object text and decreases data size.
> It also generally decreases overall object size.

>     text	   data	    bss	    dec	    hex	filename
>    36120	    312	   9000	  45432	   b178	drivers/net/usb/hso.o.old
>    36043	    312	   9008	  45363	   b133	drivers/net/usb/hso.o.new

> Consolidate duplicated code into new fix_crc_bug function
> and declare data in that function static const.

> Signed-off-by: Joe Perches<joe@perches.com>
[...]

> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index be8cc2a..c77d0ea 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -1001,6 +1001,18 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
>   	}
>   }
>
> +static void fix_crc_bug(struct urb *urb, __le16 max_packet_size)
> +{
> +	static const u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
> +	u32 rest = urb->actual_length % le16_to_cpu(max_packet_size);
> +
> +	if (((rest == 5) || (rest == 6)) &&
> +	    !memcmp(((u8 *)urb->transfer_buffer) + urb->actual_length - 4,

    Parens around '(u8 *)urb->transfer_buffer' not needed. Could get rid of 
them, while at it...

> +		    crc_check, 4)) {
> +		urb->actual_length -= 4;
> +	}
> +}
> +
>   /* Moving data from usb to kernel (in interrupt state) */
>   static void read_bulk_callback(struct urb *urb)
>   {

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>
To: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Cc: Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>,
	Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 46/62] usb: Use static const
Date: Sun, 21 Nov 2010 17:06:53 +0300	[thread overview]
Message-ID: <4CE9277D.9050505@ru.mvista.com> (raw)
In-Reply-To: <ed2a5bd07f07601ba12ce3c8fcbce2dd954c35aa.1290305776.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>

Hello.

On 21-11-2010 5:38, Joe Perches wrote:

> Using static const generally increases object text and decreases data size.
> It also generally decreases overall object size.

>     text	   data	    bss	    dec	    hex	filename
>    36120	    312	   9000	  45432	   b178	drivers/net/usb/hso.o.old
>    36043	    312	   9008	  45363	   b133	drivers/net/usb/hso.o.new

> Consolidate duplicated code into new fix_crc_bug function
> and declare data in that function static const.

> Signed-off-by: Joe Perches<joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
[...]

> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index be8cc2a..c77d0ea 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -1001,6 +1001,18 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
>   	}
>   }
>
> +static void fix_crc_bug(struct urb *urb, __le16 max_packet_size)
> +{
> +	static const u8 crc_check[4] = { 0xDE, 0xAD, 0xBE, 0xEF };
> +	u32 rest = urb->actual_length % le16_to_cpu(max_packet_size);
> +
> +	if (((rest == 5) || (rest == 6)) &&
> +	    !memcmp(((u8 *)urb->transfer_buffer) + urb->actual_length - 4,

    Parens around '(u8 *)urb->transfer_buffer' not needed. Could get rid of 
them, while at it...

> +		    crc_check, 4)) {
> +		urb->actual_length -= 4;
> +	}
> +}
> +
>   /* Moving data from usb to kernel (in interrupt state) */
>   static void read_bulk_callback(struct urb *urb)
>   {

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-11-21 14:08 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-21  2:38 [ath9k-devel] [PATCH 00/62] drivers/net: Use static const Joe Perches
2010-11-21  2:38 ` Joe Perches
2010-11-21  2:38 ` Joe Perches
2010-11-21  2:38 ` Joe Perches
2010-11-21  2:38 ` [PATCH 01/62] 3c501: " Joe Perches
2010-11-21  2:38 ` [PATCH 02/62] 3c503: " Joe Perches
2010-11-21  2:38 ` [PATCH 03/62] 3c507: " Joe Perches
2010-11-21  2:38 ` [PATCH 04/62] 3c527: " Joe Perches
2010-11-21  2:38 ` [PATCH 05/62] at1700: " Joe Perches
2010-11-21  2:38 ` [PATCH 06/62] benet: " Joe Perches
2010-11-21  2:38 ` [PATCH 07/62] bnx2: " Joe Perches
2010-11-21  2:38 ` [PATCH 08/62] bnx2x: " Joe Perches
2010-11-21  2:38 ` [PATCH 09/62] can: " Joe Perches
2010-11-21  2:38 ` [PATCH 10/62] chelsio: " Joe Perches
2010-11-21  2:38 ` [PATCH 11/62] cxgb3: " Joe Perches
2010-11-21  2:38 ` [PATCH 12/62] " Joe Perches
2010-11-21  2:38 ` [PATCH 13/62] cxgb4: " Joe Perches
2010-11-21  2:38 ` [PATCH 14/62] cxgb4vf: " Joe Perches
2010-11-22 17:42   ` Casey Leedom
2010-11-21  2:38 ` [PATCH 15/62] e1000: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 16/62] " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 17/62] e1000e: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 18/62] e2100: " Joe Perches
2010-11-21  2:38 ` [PATCH 19/62] eepro: " Joe Perches
2010-11-21  2:38 ` [PATCH 20/62] eexpress: " Joe Perches
2010-11-21  2:38 ` [PATCH 21/62] gianfar: " Joe Perches
2010-11-21  2:38 ` [PATCH 22/62] hp: " Joe Perches
2010-11-21  2:38 ` [PATCH 23/62] igb: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 24/62] irda: " Joe Perches
2010-11-21  2:38 ` [PATCH 25/62] " Joe Perches
2010-11-21  2:38 ` [PATCH 26/62] ixgbe: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 27/62] ixgbevf: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 28/62] ixgb: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 29/62] jme: " Joe Perches
2010-11-21  2:38 ` [PATCH 30/62] ksz884x: " Joe Perches
2010-11-21  2:38 ` [PATCH 31/62] netxen: " Joe Perches
2010-11-21  2:38 ` [PATCH 32/62] ni52: " Joe Perches
2010-11-21  2:38 ` [PATCH 33/62] ni65: " Joe Perches
2010-11-21  2:38 ` [PATCH 34/62] pcmcia: " Joe Perches
2010-11-21  2:38 ` [PATCH 35/62] qlcnic: " Joe Perches
2010-11-21  2:38 ` [PATCH 36/62] qlge: " Joe Perches
2010-11-21  2:38 ` [PATCH 37/62] r8169: " Joe Perches
2010-11-21  2:38 ` [PATCH 38/62] s2io: " Joe Perches
2010-11-22  5:36   ` Jon Mason
2010-11-21  2:38 ` [PATCH 39/62] skfp: " Joe Perches
2010-11-21  2:38 ` [PATCH 40/62] skge: " Joe Perches
2010-11-21  2:38 ` [PATCH 41/62] smc-ultra: " Joe Perches
2010-11-21  2:38 ` [PATCH 42/62] tg3: " Joe Perches
2010-11-21  2:38 ` [PATCH 43/62] tokenring: " Joe Perches
2010-11-21  2:38 ` [PATCH 44/62] tulip: " Joe Perches
2010-11-21  2:38 ` [PATCH 45/62] " Joe Perches
2010-11-21  2:38 ` [PATCH 46/62] usb: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21 14:06   ` Sergei Shtylyov [this message]
2010-11-21 14:06     ` Sergei Shtylyov
2010-11-21  2:38 ` [PATCH 47/62] vmxnet3: " Joe Perches
2010-11-30 18:15   ` Shreyas Bhatewara
2010-11-30 18:15     ` Shreyas Bhatewara
2010-11-30 18:24     ` David Miller
2010-11-30 18:36       ` Joe Perches
2010-11-21  2:38 ` [PATCH 48/62] wan: " Joe Perches
2010-11-21  2:38 ` [PATCH 49/62] wd: " Joe Perches
2010-11-21  2:38 ` [PATCH 50/62] ar9170: Use const Joe Perches
2010-11-21  2:38 ` [PATCH 51/62] ath5k: Use static const Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [ath9k-devel] [PATCH 52/62] ath9k: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 53/62] carl9170: " Joe Perches
2010-11-21  2:38 ` [PATCH 54/62] atmel: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:38 ` [PATCH 55/62] b43: " Joe Perches
2010-11-21  2:38 ` [PATCH 56/62] iwlwifi: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-22 15:37   ` Guy, Wey-Yi
2010-11-22 15:37     ` Guy, Wey-Yi
2010-11-21  2:38 ` [PATCH 57/62] libertas: " Joe Perches
2010-11-21  2:38 ` [PATCH 58/62] ray_cs: " Joe Perches
2010-11-21  2:38   ` Joe Perches
2010-11-21  2:39 ` [PATCH 59/62] rndis_wlan: " Joe Perches
2010-11-21  2:39 ` [PATCH 60/62] rt2x00: " Joe Perches
2010-11-21  8:58   ` Gertjan van Wingerde
2010-11-21  8:58     ` Gertjan van Wingerde
2010-11-21  2:39 ` [PATCH 61/62] wl12xx: " Joe Perches
2010-11-21  2:39 ` [PATCH 62/62] zd1211rw: Use const Joe Perches
2010-11-21  2:39   ` Joe Perches
2010-11-21  4:50 ` [ath9k-devel] [PATCH 00/62] drivers/net: Use static const David Miller
2010-11-21  4:50   ` David Miller
2010-11-21  4:50   ` David Miller
2010-11-21  4:50   ` David Miller
2010-11-22 22:10   ` [ath9k-devel] " Joe Perches
2010-11-22 22:10     ` Joe Perches
2010-11-22 22:10     ` Joe Perches
2010-11-22 22:10     ` Joe Perches
2010-11-22 22:19     ` [ath9k-devel] " David Miller
2010-11-22 22:19       ` David Miller
2010-11-22 22:19       ` David Miller
2010-11-22 22:19       ` David Miller
2010-11-22 22:40       ` [ath9k-devel] " Joe Perches
2010-11-22 22:40         ` Joe Perches
2010-11-22 22:40         ` Joe Perches
2010-11-22 22:40         ` Joe Perches
2010-11-23 16:28         ` [ath9k-devel] " David Miller
2010-11-23 16:28           ` David Miller
2010-11-23 16:28           ` David Miller
2010-11-23 16:28           ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CE9277D.9050505@ru.mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=gregkh@suse.de \
    --cc=j.dumon@option.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.