Thread (20 messages) flat view 20 messages, 11 authors, 2011-05-10

[PATCH 1/4] drivers: create a pinmux subsystem

From: joe@perches.com (Joe Perches)
Date: 2011-05-10 22:37:03
Also in: lkml

On Wed, 2011-05-11 at 00:18 +0200, Linus Walleij wrote:
2011/5/2 Joe Perches [off-list ref]:
quoted
On Mon, 2011-05-02 at 21:16 +0200, Linus Walleij wrote:
quoted
From: Linus Walleij <redacted>
diff --git a/drivers/pinmux/core.c b/drivers/pinmux/core.c
Trivial comments follow
quoted
+static inline int pin_is_valid(int pin)
+{
+     return ((unsigned)pin) < MACH_NR_PINS;
+}
Couldn't pin just be declared unsigned or maybe u32?
No, because like in the GPIO subsystem you *may* want to send in invalid
pins, and those are identified by negative numbers.
Then I think this is clearer and the compiler
should produce the same code.

static inline bool pin_is_valid(int pin)
{ 
	return pin >= 0 && pin < MACH_NR_PINS;
}

cheers, Joe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help