[GreatFET] spi_bus_* calls taking spi_target_t

Garret Kelly garret.kelly at gmail.com
Wed Sep 25 19:31:55 EDT 2019


Hello!

I'm writing a class that uses SPI and noticed that the
spi_bus_{start,stop,etc} calls from spi_bus.h all take a spi_target_t,
not a spi_bus_t, but pull the bus out of the target and use it to
dispatch the call anyway.  It's spiflash_target_t that uses the
spi_target_t's fields, so it kind of feels like spi_bus_* functions
should take a plain spi_bus_* and spi_target_t should maybe be an
embeddable struct that spiflash_target_t can turn back into its
corresponding data (the GPIO WP and select pins) using container_of()
or something similar.

Happy to make a patch to do the shuffle, but also happy to leave
things well enough alone if there's a reason for the naming that I
don't know yet.  :)

Garret


More information about the GreatFET mailing list