drivers/periph_spi: make spi_acquire() return void

There is no way to properly handle incorrect SPI parameters at run time, so
just having an assertion blow up is the better choice here.

As most instances of `spi_acquire()` don't check the return value anyway, this
will improve debugging experience quite a bit. Some implementation of
spi_acquire() don't even check parameters anyway.
This commit is contained in:
Marian Buschsieweke 2021-02-01 11:12:56 +01:00
parent c4df2cca51
commit 9e5f7b6797
No known key found for this signature in database
GPG Key ID: 61F64C6599B1539F

View File

@ -340,22 +340,16 @@ int spi_init_with_gpio_mode(spi_t bus, spi_gpio_mode_t mode);
* is active when this function is called, this function will block until the
* other transaction is complete (spi_relase was called).
*
* @note This function expects the @p bus and the @p cs parameters to be
* valid (they are checked in spi_init and spi_init_cs before)
*
* @param[in] bus SPI device to access
* @param[in] cs chip select pin/line to use, set to SPI_CS_UNDEF if chip
* select should not be handled by the SPI driver
* @param[in] mode mode to use for the new transaction
* @param[in] clk bus clock speed to use for the transaction
*
* @retval 0 success
* @retval -EINVAL Invalid mode in @p mode
* @retval -EINVAL Invalid clock in @p clock
* @retval -ENOTSUP Unsupported but valid mode in @p mode
* @retval -ENOTSUP Unsupported but valid clock in @p clock
* @pre All parameters are valid and supported, otherwise an assertion blows
* up (if assertions are enabled).
*/
int spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk);
void spi_acquire(spi_t bus, spi_cs_t cs, spi_mode_t mode, spi_clk_t clk);
/**
* @brief Finish an ongoing SPI transaction by releasing the given SPI bus