
17 Jun
2011
17 Jun
'11
2:09 a.m.
Mike,
On Thu, Jun 16, 2011 at 5:06 PM, Mike Frysinger vapier@gentoo.org wrote:
On Thursday, June 16, 2011 19:51:33 Tom Warren wrote:
+int gpio_request(int gp, const char *label) +{
- if (gp >= MAX_NUM_GPIOS)
- return -1;
- strncpy(gpio_names[gp].name, label, GPIO_NAME_SIZE);
if the label is >=GPIO_NAME_SIZE, the result will not be NUL terminated. i'd suggest you add something like this to after the strncpy call: gpio_names[gp].name[GPIO_NAME_SIZE - 1] = '\0';
Will do. Thanks for the quick response!
- return (val >> GPIO_BIT(gp)) & 1;
could be written as !!(val >> GPIO_BIT(gp)), but up to you, or see how the code size works out
I'll check it and update if your way is smaller. Thanks.
otherwise, looks fine. not that i looked too closely as i dont know anything about Tegra2 parts. -mike
Thanks,
Tom