On 06/05/2025 10:50, Aaron Kling wrote:
...
if (setup->unit != SPI_DELAY_UNIT_SCK ||
hold->unit != SPI_DELAY_UNIT_SCK ||
inactive->unit != SPI_DELAY_UNIT_SCK) {
if ((setup->unit && setup->unit != SPI_DELAY_UNIT_SCK) ||
(hold->unit && hold->unit != SPI_DELAY_UNIT_SCK) ||
(inactive->unit && inactive->unit != SPI_DELAY_UNIT_SCK)) {
The above does not look correct to me. For example, if 'setup->unit' is 0, this means that the unit is 'SPI_DELAY_UNIT_USECS' and does not indicate that the delay is 0.
Shouldn't the above be ...
if ((setup && setup->unit != SPI_DELAY_UNIT_SCK) || (hold && hold->unit != SPI_DELAY_UNIT_SCK) || (inactive && inactive->unit != SPI_DELAY_UNIT_SCK)) {
This is what the code looked like before 373c36b [0], which dropped that check because the pointers can never be NULL. Should this check if ->value is not 0 instead?
What the code does now does not match what you describe and does not appear to be correct. Yes checking ->value is not 0 would make sense.
Jon