drivers: remove redundant data/config casts

Some drivers explicitely casted data/config from void * to the
corresponding type. However, this is unnecessary and, in many drivers it
has been misused to drop const qualifier (refer to previous commits).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-01-19 12:14:50 +01:00 committed by Carles Cufí
commit 435213a753
20 changed files with 68 additions and 69 deletions

View file

@ -111,7 +111,7 @@ static inline void i2s_purge_stream_buffers(struct stream *strm,
static void i2s_tx_stream_disable(const struct device *dev)
{
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->tx;
const struct device *dev_dma = dev_data->dev_dma;
const struct i2s_mcux_config *dev_cfg = dev->config;
@ -144,7 +144,7 @@ static void i2s_tx_stream_disable(const struct device *dev)
static void i2s_rx_stream_disable(const struct device *dev)
{
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->rx;
const struct device *dev_dma = dev_data->dev_dma;
const struct i2s_mcux_config *dev_cfg = dev->config;
@ -184,7 +184,7 @@ static void i2s_dma_tx_callback(const struct device *dma_dev,
const struct device *dev = (struct device *)arg;
const struct i2s_mcux_config *dev_cfg = dev->config;
I2S_Type *base = (I2S_Type *)dev_cfg->base;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->tx;
void *buffer = NULL;
int ret;
@ -255,7 +255,7 @@ static void i2s_dma_rx_callback(const struct device *dma_dev,
struct device *dev = (struct device *)arg;
const struct i2s_mcux_config *dev_cfg = dev->config;
I2S_Type *base = (I2S_Type *)dev_cfg->base;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->rx;
void *buffer;
int ret;
@ -361,7 +361,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
{
const struct i2s_mcux_config *dev_cfg = dev->config;
I2S_Type *base = (I2S_Type *)dev_cfg->base;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
sai_transceiver_t config;
uint32_t mclk;
/*num_words is frame size*/
@ -614,7 +614,7 @@ static int i2s_mcux_config(const struct device *dev, enum i2s_dir dir,
const struct i2s_config *i2s_mcux_config_get(const struct device *dev,
enum i2s_dir dir)
{
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
if (dir == I2S_DIR_RX)
return &dev_data->rx.cfg;
@ -626,7 +626,7 @@ static int i2s_tx_stream_start(const struct device *dev)
{
int ret = 0;
void *buffer;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->tx;
uint32_t data_path = strm->start_channel;
const struct device *dev_dma = dev_data->dev_dma;
@ -680,7 +680,7 @@ static int i2s_rx_stream_start(const struct device *dev)
{
int ret = 0;
void *buffer;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->rx;
const struct device *dev_dma = dev_data->dev_dma;
const struct i2s_mcux_config *dev_cfg = dev->config;
@ -732,7 +732,7 @@ static int i2s_rx_stream_start(const struct device *dev)
static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir,
enum i2s_trigger_cmd cmd)
{
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm;
unsigned int key;
int ret = 0;
@ -830,7 +830,7 @@ static int i2s_mcux_read(const struct device *dev, void **mem_block,
size_t *size)
{
const struct i2s_mcux_config *dev_cfg = dev->config;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->rx;
void *buffer;
int ret = 0;
@ -869,7 +869,7 @@ static int i2s_mcux_read(const struct device *dev, void **mem_block,
static int i2s_mcux_write(const struct device *dev, void *mem_block,
size_t size)
{
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
struct stream *strm = &dev_data->tx;
int ret;
@ -1013,7 +1013,7 @@ static int i2s_mcux_initialize(const struct device *dev)
{
const struct i2s_mcux_config *dev_cfg = dev->config;
I2S_Type *base = (I2S_Type *)dev_cfg->base;
struct i2s_dev_data *dev_data = (struct i2s_dev_data *)dev->data;
struct i2s_dev_data *dev_data = dev->data;
uint32_t mclk;
if (!dev_data->dev_dma) {