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

@ -23,7 +23,7 @@ static int sbs_cmd_reg_read(const struct device *dev,
uint8_t i2c_data[2];
int status;
cfg = (struct sbs_gauge_config *)dev->config;
cfg = dev->config;
status = i2c_burst_read(cfg->i2c_dev, cfg->i2c_addr, reg_addr,
i2c_data, ARRAY_SIZE(i2c_data));
if (status < 0) {
@ -48,7 +48,7 @@ static int sbs_gauge_channel_get(const struct device *dev,
struct sbs_gauge_data *data;
int32_t int_temp;
data = (struct sbs_gauge_data *)dev->data;
data = dev->data;
val->val2 = 0;
switch (chan) {
@ -128,7 +128,7 @@ static int sbs_gauge_sample_fetch(const struct device *dev,
struct sbs_gauge_data *data;
int status = 0;
data = (struct sbs_gauge_data *)dev->data;
data = dev->data;
switch (chan) {
case SENSOR_CHAN_GAUGE_VOLTAGE:
@ -262,7 +262,7 @@ static int sbs_gauge_init(const struct device *dev)
{
const struct sbs_gauge_config *cfg;
cfg = (struct sbs_gauge_config *)dev->config;
cfg = dev->config;
if (!device_is_ready(cfg->i2c_dev)) {
LOG_ERR("%s device is not ready", cfg->i2c_dev->name);