
17 Jun
2011
17 Jun
'11
2:06 a.m.
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';
- 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
otherwise, looks fine. not that i looked too closely as i dont know anything about Tegra2 parts. -mike