From patchwork Wed Sep 25 23:52:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 2946101 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 952919F3C4 for ; Wed, 25 Sep 2013 23:52:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D61D720373 for ; Wed, 25 Sep 2013 23:52:24 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC38E202FF for ; Wed, 25 Sep 2013 23:52:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VOysY-0005hp-K7; Wed, 25 Sep 2013 23:52:22 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VOysX-0005hk-9p for spi-devel-general@lists.sourceforge.net; Wed, 25 Sep 2013 23:52:21 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.220.46 as permitted sender) client-ip=209.85.220.46; envelope-from=tpiepho@gmail.com; helo=mail-pa0-f46.google.com; Received: from mail-pa0-f46.google.com ([209.85.220.46]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1VOysW-0007qH-JS for spi-devel-general@lists.sourceforge.net; Wed, 25 Sep 2013 23:52:21 +0000 Received: by mail-pa0-f46.google.com with SMTP id fa1so497180pad.5 for ; Wed, 25 Sep 2013 16:52:14 -0700 (PDT) X-Received: by 10.66.216.129 with SMTP id oq1mr1882030pac.75.1380153134758; Wed, 25 Sep 2013 16:52:14 -0700 (PDT) Received: from [127.0.1.1] (174-31-223-101.tukw.qwest.net. [174.31.223.101]) by mx.google.com with ESMTPSA id fk4sm628150pab.23.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Sep 2013 16:52:14 -0700 (PDT) Subject: [PATCH 2/4] spi: Order fields in spi_device for better packing To: spi-devel-general@lists.sourceforge.net, Mark Brown , yuhang wang From: Trent Piepho Date: Wed, 25 Sep 2013 16:52:14 -0700 Message-ID: <20130925235214.22061.8047.stgit@Graphine> In-Reply-To: References: User-Agent: StGit/0.15 MIME-Version: 1.0 X-Spam-Score: -1.6 (-) X-Headers-End: 1VOysW-0007qH-JS Cc: Sourav Poddar X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that spi_device->mode is a u16, the chip_select, bits_per_mode, and mode fields pack poorly, taking 8 bytes: four data and four padding. By moving (u8)bits_per_word up one position, to after (u8)chip_select, they pack better and only use 4 bytes. Signed-off-by: Trent Piepho Reviewed-by: Sourav Poddar Tested-by: Sourav Poddar --- include/linux/spi/spi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 887116d..beaffe8 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -74,6 +74,7 @@ struct spi_device { struct spi_master *master; u32 max_speed_hz; u8 chip_select; + u8 bits_per_word; u16 mode; #define SPI_CPHA 0x01 /* clock phase */ #define SPI_CPOL 0x02 /* clock polarity */ @@ -91,7 +92,6 @@ struct spi_device { #define SPI_TX_QUAD 0x200 /* transmit with 4 wires */ #define SPI_RX_DUAL 0x400 /* receive with 2 wires */ #define SPI_RX_QUAD 0x800 /* receive with 4 wires */ - u8 bits_per_word; int irq; void *controller_state; void *controller_data;