Rework gpioaei to make it support more than one pin per GPIO resource.
Also allow one instance of gpioaei to handle multiple resources.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 65960 Build 62843: arc lint + arc unit
Event Timeline
I don't really like that we have to loop through the AEI resources twice, but I haven't been able to find a better way to do this.
sys/dev/gpio/acpi_gpiobus.c | ||
---|---|---|
310 | What's this brace doing here? | |
334 | why BUS_ADD_CHILD and not bus_add_child? The usual pattern is to add the child with the ivars... So I'm a bit confused below that you get the ivards... Am I missing something here? | |
sys/dev/gpio/gpioaei.c | ||
137 | Doesn't this rely on the fact that type is initialized to 0 in the malloc? Maybe making that more explicit would help? |
sys/dev/gpio/acpi_gpiobus.c | ||
---|---|---|
310 | It's so I don't pollute the rest of the function with the 4 aei variables. | |
334 | gpiobus_add_child_common (which is called from acpi_gpiobus' bus_add_child) deals with allocating the ivars and calling device_set_ivars. So all we have to do after that is set the acpi specific bits and set the pins needed by _AEI.
s/bus_add_child/device_add_child ? | |
sys/dev/gpio/gpioaei.c | ||
137 | Yes and Yes :) Looking through the code again, we could just remove the M_ZERO and initialize type and intr_rid explicitly. |
Fix max pin check when enumerating _AEI.
GPIO_PIN_MAX returns the highest usable pin, so '>' should be used, not '>='.
sys/dev/gpio/acpi_gpiobus.c | ||
---|---|---|
310 | If you don't want to move the variables to the top of the function moving this into a new function might be cleaner. It's uncommon to put these into the middle of a function. | |
sys/dev/gpio/gpioaei.c | ||
124 | Why M_NOWAIT when you don't handle it returning NULL? | |
239–249 | It looks like you're implementing SLIST_FOREACH_SAFE |
sys/dev/gpio/gpioaei.c | ||
---|---|---|
124 | This function gets called by ACPICA. While I tested M_WAITOK and it seemed to work fine, I'd rather not assume it's not doing anything else (e.g holding a mutex).
Not sure what else to do other than an assertion. | |
239–249 | Ah, looks like I am. |