drivers: spi: Fix device instance const qualifier loss
Some needed to wrap the device pointer into device's data, where others needed only device's data to be passed to HAL callback function. Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
45832ac1d6
commit
898f914df5
8 changed files with 70 additions and 49 deletions
|
@ -29,6 +29,7 @@ struct spi_mcux_config {
|
|||
};
|
||||
|
||||
struct spi_mcux_data {
|
||||
const struct device *dev;
|
||||
dspi_master_handle_t handle;
|
||||
struct spi_context ctx;
|
||||
size_t transfer_len;
|
||||
|
@ -116,13 +117,12 @@ static void spi_mcux_isr(void *arg)
|
|||
static void spi_mcux_master_transfer_callback(SPI_Type *base,
|
||||
dspi_master_handle_t *handle, status_t status, void *userData)
|
||||
{
|
||||
const struct device *dev = userData;
|
||||
struct spi_mcux_data *data = dev->data;
|
||||
struct spi_mcux_data *data = userData;
|
||||
|
||||
spi_context_update_tx(&data->ctx, 1, data->transfer_len);
|
||||
spi_context_update_rx(&data->ctx, 1, data->transfer_len);
|
||||
|
||||
spi_mcux_transfer_next_packet(dev);
|
||||
spi_mcux_transfer_next_packet(data->dev);
|
||||
}
|
||||
|
||||
static int spi_mcux_configure(const struct device *dev,
|
||||
|
@ -194,7 +194,8 @@ static int spi_mcux_configure(const struct device *dev,
|
|||
DSPI_MasterInit(base, &master_config, clock_freq);
|
||||
|
||||
DSPI_MasterTransferCreateHandle(base, &data->handle,
|
||||
spi_mcux_master_transfer_callback, dev);
|
||||
spi_mcux_master_transfer_callback,
|
||||
data);
|
||||
|
||||
DSPI_SetDummyData(base, 0);
|
||||
|
||||
|
@ -271,6 +272,8 @@ static int spi_mcux_init(const struct device *dev)
|
|||
const struct spi_mcux_config *config = dev->config;
|
||||
struct spi_mcux_data *data = dev->data;
|
||||
|
||||
data->dev = dev;
|
||||
|
||||
config->irq_config_func(dev);
|
||||
|
||||
spi_context_unlock_unconditionally(&data->ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue