From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933265AbbCPQ7w (ORCPT ); Mon, 16 Mar 2015 12:59:52 -0400 Received: from avon.wwwdotorg.org ([70.85.31.133]:48055 "EHLO avon.wwwdotorg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756758AbbCPQ7s (ORCPT ); Mon, 16 Mar 2015 12:59:48 -0400 Message-ID: <55070C00.5040804@wwwdotorg.org> Date: Mon, 16 Mar 2015 10:59:44 -0600 From: Stephen Warren User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Stefan Agner CC: linus.walleij@linaro.org, thierry.reding@gmail.com, gnurou@gmail.com, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] pinctrl: tegra: use signed bitfields for optional fields References: <1426377952-12383-1-git-send-email-stefan@agner.ch> In-Reply-To: <1426377952-12383-1-git-send-email-stefan@agner.ch> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/14/2015 06:05 PM, Stefan Agner wrote: > Optional fields are set to -1 by various preprocessor macros. Make > sure the struct fields can actually store them. > diff --git a/drivers/pinctrl/pinctrl-tegra.h b/drivers/pinctrl/pinctrl-tegra.h > - u32 mux_bit:6; > - u32 pupd_bit:6; > - u32 tri_bit:6; ... > + s8 mux_bit:6; > + s8 pupd_bit:6; > + s8 tri_bit:6; Could we make these s32s instead? According to the C standard, the type should be a signed or unsigned int, and s32 matches that better than s8 for existing Tegra 32-bit platforms. Equally, for bitfields that don't fit into the remaining space within a container (s8 above), implementations are allowed to either span bitfields across multiple containers, or pad the current container and start the bitfield in the next container. Using the larger s32 as the "container" yields less opportunity for potential padding and thus wasting space. Do you observe any increase in the sizes reported by "${CROSS_COMPILE}size pinctrl-tegra*.o" with this patch?