linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields
@ 2015-03-16 21:42 Stefan Agner
  2015-03-16 22:28 ` Stephen Warren
  2015-03-19  8:21 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Agner @ 2015-03-16 21:42 UTC (permalink / raw)
  To: linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
	swarren-3lzwWm7+Weoh9ZMKESR00Q
  Cc: thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, linux-gpio-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, stefan-XLVq0VzYD2Y

Optional fields are set to -1 by various preprocessor macros. Make
sure the fields can actually store them.

Signed-off-by: Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>
---
With that, sizes are back to normal:

   text	   data	    bss	    dec	    hex	filename
   5406	    180	      1	   5587	   15d3	drivers/pinctrl/pinctrl-tegra-xusb.o
   5256	     64	      0	   5320	   14c8	drivers/pinctrl/pinctrl-tegra.o
  18072	   1032	      0	  19104	   4aa0	drivers/pinctrl/pinctrl-tegra114.o
  19214	   1128	      0	  20342	   4f76	drivers/pinctrl/pinctrl-tegra124.o
  18352	    876	      0	  19228	   4b1c	drivers/pinctrl/pinctrl-tegra20.o
  24621	   1068	      0	  25689	   6459	drivers/pinctrl/pinctrl-tegra30.o

 drivers/pinctrl/pinctrl-tegra.h | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-tegra.h b/drivers/pinctrl/pinctrl-tegra.h
index 8d94d13..b8a82a3 100644
--- a/drivers/pinctrl/pinctrl-tegra.h
+++ b/drivers/pinctrl/pinctrl-tegra.h
@@ -139,26 +139,26 @@ struct tegra_pingroup {
 	u32 pupd_bank:2;
 	u32 tri_bank:2;
 	u32 drv_bank:2;
-	u32 mux_bit:6;
-	u32 pupd_bit:6;
-	u32 tri_bit:6;
-	u32 einput_bit:6;
-	u32 odrain_bit:6;
-	u32 lock_bit:6;
-	u32 ioreset_bit:6;
-	u32 rcv_sel_bit:6;
-	u32 hsm_bit:6;
-	u32 schmitt_bit:6;
-	u32 lpmd_bit:6;
-	u32 drvdn_bit:6;
-	u32 drvup_bit:6;
-	u32 slwr_bit:6;
-	u32 slwf_bit:6;
-	u32 drvtype_bit:6;
-	u32 drvdn_width:6;
-	u32 drvup_width:6;
-	u32 slwr_width:6;
-	u32 slwf_width:6;
+	s32 mux_bit:6;
+	s32 pupd_bit:6;
+	s32 tri_bit:6;
+	s32 einput_bit:6;
+	s32 odrain_bit:6;
+	s32 lock_bit:6;
+	s32 ioreset_bit:6;
+	s32 rcv_sel_bit:6;
+	s32 hsm_bit:6;
+	s32 schmitt_bit:6;
+	s32 lpmd_bit:6;
+	s32 drvdn_bit:6;
+	s32 drvup_bit:6;
+	s32 slwr_bit:6;
+	s32 slwf_bit:6;
+	s32 drvtype_bit:6;
+	s32 drvdn_width:6;
+	s32 drvup_width:6;
+	s32 slwr_width:6;
+	s32 slwf_width:6;
 };
 
 /**
-- 
2.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields
  2015-03-16 21:42 [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields Stefan Agner
@ 2015-03-16 22:28 ` Stephen Warren
  2015-03-19  8:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Warren @ 2015-03-16 22:28 UTC (permalink / raw)
  To: Stefan Agner, linus.walleij
  Cc: thierry.reding, gnurou, linux-gpio, linux-tegra, linux-kernel,
	Paul Walmsley

On 03/16/2015 03:42 PM, Stefan Agner wrote:
> Optional fields are set to -1 by various preprocessor macros. Make
> sure the fields can actually store them.

This seems fine to me. I suppose there is a small risk that the old code 
let some invalid configurations pass whereas this new code will reject 
them and hence not program any later pinmux configurations in the "list" 
in DT. However, I suspect the risk is quite small and won't be an issue.

Acked-by: Stephen Warren <swarren@nvidia.com>

I also tested this on Beaver, Dalmore, and Jetson TK1 using Paul 
Walmsley's automated test system, and saw no issues, so:

Tested-by: Stephen Warren <swarren@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields
  2015-03-16 21:42 [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields Stefan Agner
  2015-03-16 22:28 ` Stephen Warren
@ 2015-03-19  8:21 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-03-19  8:21 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Mon, Mar 16, 2015 at 10:42 PM, Stefan Agner <stefan@agner.ch> wrote:

> Optional fields are set to -1 by various preprocessor macros. Make
> sure the fields can actually store them.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Patch applied with Stephen's ACK/Test tags.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-19  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 21:42 [PATCH v2] pinctrl: tegra: use signed bitfields for optional fields Stefan Agner
2015-03-16 22:28 ` Stephen Warren
2015-03-19  8:21 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).