Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596Ab0KUOIq (ORCPT ); Sun, 21 Nov 2010 09:08:46 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:62277 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346Ab0KUOIp (ORCPT ); Sun, 21 Nov 2010 09:08:45 -0500 Message-ID: <4CE9277D.9050505@ru.mvista.com> Date: Sun, 21 Nov 2010 17:06:53 +0300 From: Sergei Shtylyov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6 MIME-Version: 1.0 To: Joe Perches CC: Jan Dumon , Greg Kroah-Hartman , linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 46/62] usb: Use static const References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1661 Lines: 51 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 [...] > 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/