device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all the other attributes, it is possible to switch all device driver instance to be constant. A coccinelle rule is used for this: @r_const_dev_1 disable optional_qualifier @ @@ -struct device * +const struct device * @r_const_dev_2 disable optional_qualifier @ @@ -struct device * const +const struct device * Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -44,18 +44,19 @@ struct i2c_cc13xx_cc26xx_config {
|
|||
uint32_t sda_pin;
|
||||
};
|
||||
|
||||
static inline struct i2c_cc13xx_cc26xx_data *get_dev_data(struct device *dev)
|
||||
static inline struct i2c_cc13xx_cc26xx_data *get_dev_data(const struct device *dev)
|
||||
{
|
||||
return dev->data;
|
||||
}
|
||||
|
||||
static inline const struct i2c_cc13xx_cc26xx_config *
|
||||
get_dev_config(struct device *dev)
|
||||
get_dev_config(const struct device *dev)
|
||||
{
|
||||
return dev->config;
|
||||
}
|
||||
|
||||
static int i2c_cc13xx_cc26xx_transmit(struct device *dev, const uint8_t *buf,
|
||||
static int i2c_cc13xx_cc26xx_transmit(const struct device *dev,
|
||||
const uint8_t *buf,
|
||||
uint32_t len, uint16_t addr)
|
||||
{
|
||||
const uint32_t base = get_dev_config(dev)->base;
|
||||
|
@ -123,7 +124,8 @@ send_error_stop:
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int i2c_cc13xx_cc26xx_receive(struct device *dev, uint8_t *buf, uint32_t len,
|
||||
static int i2c_cc13xx_cc26xx_receive(const struct device *dev, uint8_t *buf,
|
||||
uint32_t len,
|
||||
uint16_t addr)
|
||||
{
|
||||
const uint32_t base = get_dev_config(dev)->base;
|
||||
|
@ -195,7 +197,8 @@ recv_error_stop:
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int i2c_cc13xx_cc26xx_transfer(struct device *dev, struct i2c_msg *msgs,
|
||||
static int i2c_cc13xx_cc26xx_transfer(const struct device *dev,
|
||||
struct i2c_msg *msgs,
|
||||
uint8_t num_msgs, uint16_t addr)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -242,7 +245,8 @@ static int i2c_cc13xx_cc26xx_transfer(struct device *dev, struct i2c_msg *msgs,
|
|||
}
|
||||
|
||||
#define CPU_FREQ DT_PROP(DT_PATH(cpus, cpu_0), clock_frequency)
|
||||
static int i2c_cc13xx_cc26xx_configure(struct device *dev, uint32_t dev_config)
|
||||
static int i2c_cc13xx_cc26xx_configure(const struct device *dev,
|
||||
uint32_t dev_config)
|
||||
{
|
||||
bool fast;
|
||||
|
||||
|
@ -304,7 +308,7 @@ static void i2c_cc13xx_cc26xx_isr(void *arg)
|
|||
static int postNotifyFxn(unsigned int eventType, uintptr_t eventArg,
|
||||
uintptr_t clientArg)
|
||||
{
|
||||
struct device *dev = (struct device *)clientArg;
|
||||
const struct device *dev = (const struct device *)clientArg;
|
||||
int ret = Power_NOTIFYDONE;
|
||||
int16_t res_id;
|
||||
|
||||
|
@ -328,8 +332,8 @@ static int postNotifyFxn(unsigned int eventType, uintptr_t eventArg,
|
|||
#endif
|
||||
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
static int i2c_cc13xx_cc26xx_set_power_state(struct device *dev,
|
||||
uint32_t new_state)
|
||||
static int i2c_cc13xx_cc26xx_set_power_state(const struct device *dev,
|
||||
uint32_t new_state)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -366,8 +370,10 @@ static int i2c_cc13xx_cc26xx_set_power_state(struct device *dev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int i2c_cc13xx_cc26xx_pm_control(struct device *dev, uint32_t ctrl_command,
|
||||
void *context, device_pm_cb cb, void *arg)
|
||||
static int i2c_cc13xx_cc26xx_pm_control(const struct device *dev,
|
||||
uint32_t ctrl_command,
|
||||
void *context, device_pm_cb cb,
|
||||
void *arg)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
@ -391,7 +397,7 @@ static int i2c_cc13xx_cc26xx_pm_control(struct device *dev, uint32_t ctrl_comman
|
|||
}
|
||||
#endif /* CONFIG_DEVICE_POWER_MANAGEMENT */
|
||||
|
||||
static int i2c_cc13xx_cc26xx_init(struct device *dev)
|
||||
static int i2c_cc13xx_cc26xx_init(const struct device *dev)
|
||||
{
|
||||
uint32_t cfg;
|
||||
int err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue