lkml.org 
[lkml]   [2010]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 46/62] usb: Use static const
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


\
 
 \ /
  Last update: 2010-11-21 15:11    [W:0.221 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site