Re: [PATCH] gpiolib: allow poll on gpio value
From: David Brownell
Date: Sat Jun 06 2009 - 01:41:27 EST
On Friday 05 June 2009, Daniel Glöckner wrote:
> + else {
> + int i;
> + status = 0;
> + for (i = 0; i < ARRAY_SIZE(trigger_types); i++)
> + if ((desc->flags & ((1 << FLAG_TRIG_FALL)
> + | (1 << FLAG_TRIG_RISE)))
> + == trigger_types[i].flags) {
> + status = sprintf(buf, "%s\n",
> + trigger_types[i].name);
> + break;
> + }
> + }
Looks pretty clean overall, but that snippet highlights some cosmetic
issues I'd like to see cleaned up:
- Blank line after each declaration block -- "int i" above.
- Prefer BIT(n) to (1 << n)
- And here, the ((1 << FLAG_TRIG_FALL) | (1 << FLAG_TRIG_RISE))
thing shows up all over, maybe #define as GPIO_TRIGGER_MASK
- That "== triger_types[..]" should use only tabs for indent.
And yes, like Ben I think this functionality is probably worth having,
since it's not something that *can* really be done from userspace with
the current calls.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/