lkml.org 
[lkml]   [2009]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] gpiolib: allow poll on gpio value
Date
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-06-06 07:45    [W:0.105 / U:1.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site