Attention is currently required from: Xiang Wang, Stefan Reinauer, Angel Pons.
Patch set 3:Code-Review +1
8 comments:
Commit Message:
Patch Set #1, Line 10: some SBC
raspberry pi zero w […]
Include this information in your commit message on a `TEST=` line perhaps?
File sysfsgpio.c:
/* parameter format: pins=cs_pin:sck_pin:mosi_pin:miso_pin */
char *pins = extract_programmer_param("pins");
int pins_inited = 0;
do {
struct pin_desc *pins_tab[] = {
&pin_cs, &pin_sck, &pin_mosi, &pin_miso
};
if (!(pins && strlen(pins)))
break;
char *token = strtok(pins, ":");
for (unsigned i = 0; i < ARRAY_SIZE(pins_tab); i++) {
long v;
if (!token)
break;
if (atoi_s(token, 1, &v))
break;
pins_tab[i]->pin = v;
if (export_sysfsgpio(pins_tab[i]))
break;
token = strtok(NULL, ":");
pins_inited = (i + 1 == ARRAY_SIZE(pins_tab));
}
} while (0);
if (pins)
free(pins);
if (!pins_inited)
return 1;
The pin information can be extracted into the global variable pins. […]
It looks much better now but I think we can make one more step forwards to keeping more of the functions pure. This helps for unit-tests (which would be ideal if you can add some) but generally helps box down the global state accesses to a limited number of places.
File sysfsgpio.c:
`g_pins`
g_
g_
Patch Set #3, Line 204: static int parse_pins(void)
`static int parse_pins(struct sysfsgpio_pins *pins)`
`parse_pins(&g_pins)`
g_
To view, visit change 49254. To unsubscribe, or for help writing mail filters, visit settings.