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
|
@ -23,10 +23,10 @@ struct mcux_rtc_data {
|
|||
struct mcux_rtc_config {
|
||||
struct counter_config_info info;
|
||||
RTC_Type *base;
|
||||
void (*irq_config_func)(struct device *dev);
|
||||
void (*irq_config_func)(const struct device *dev);
|
||||
};
|
||||
|
||||
static int mcux_rtc_start(struct device *dev)
|
||||
static int mcux_rtc_start(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
|
@ -41,7 +41,7 @@ static int mcux_rtc_start(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_rtc_stop(struct device *dev)
|
||||
static int mcux_rtc_stop(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
|
@ -59,7 +59,7 @@ static int mcux_rtc_stop(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t mcux_rtc_read(struct device *dev)
|
||||
static uint32_t mcux_rtc_read(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
|
@ -81,13 +81,13 @@ static uint32_t mcux_rtc_read(struct device *dev)
|
|||
return ticks;
|
||||
}
|
||||
|
||||
static int mcux_rtc_get_value(struct device *dev, uint32_t *ticks)
|
||||
static int mcux_rtc_get_value(const struct device *dev, uint32_t *ticks)
|
||||
{
|
||||
*ticks = mcux_rtc_read(dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_rtc_set_alarm(struct device *dev, uint8_t chan_id,
|
||||
static int mcux_rtc_set_alarm(const struct device *dev, uint8_t chan_id,
|
||||
const struct counter_alarm_cfg *alarm_cfg)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
|
@ -127,7 +127,7 @@ static int mcux_rtc_set_alarm(struct device *dev, uint8_t chan_id,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_rtc_cancel_alarm(struct device *dev, uint8_t chan_id)
|
||||
static int mcux_rtc_cancel_alarm(const struct device *dev, uint8_t chan_id)
|
||||
{
|
||||
struct mcux_rtc_data *data = dev->data;
|
||||
|
||||
|
@ -141,7 +141,7 @@ static int mcux_rtc_cancel_alarm(struct device *dev, uint8_t chan_id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_rtc_set_top_value(struct device *dev,
|
||||
static int mcux_rtc_set_top_value(const struct device *dev,
|
||||
const struct counter_top_cfg *cfg)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
|
@ -166,7 +166,7 @@ static int mcux_rtc_set_top_value(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t mcux_rtc_get_pending_int(struct device *dev)
|
||||
static uint32_t mcux_rtc_get_pending_int(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
|
@ -175,14 +175,14 @@ static uint32_t mcux_rtc_get_pending_int(struct device *dev)
|
|||
return RTC_GetStatusFlags(config->base) & RTC_SR_TAF_MASK;
|
||||
}
|
||||
|
||||
static uint32_t mcux_rtc_get_top_value(struct device *dev)
|
||||
static uint32_t mcux_rtc_get_top_value(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
|
||||
return info->max_top_value;
|
||||
}
|
||||
|
||||
static uint32_t mcux_rtc_get_max_relative_alarm(struct device *dev)
|
||||
static uint32_t mcux_rtc_get_max_relative_alarm(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
|
||||
|
@ -191,7 +191,7 @@ static uint32_t mcux_rtc_get_max_relative_alarm(struct device *dev)
|
|||
|
||||
static void mcux_rtc_isr(void *arg)
|
||||
{
|
||||
struct device *dev = arg;
|
||||
const struct device *dev = arg;
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
CONTAINER_OF(info, struct mcux_rtc_config, info);
|
||||
|
@ -231,7 +231,7 @@ static void mcux_rtc_isr(void *arg)
|
|||
RTC_StartTimer(config->base);
|
||||
}
|
||||
|
||||
static int mcux_rtc_init(struct device *dev)
|
||||
static int mcux_rtc_init(const struct device *dev)
|
||||
{
|
||||
const struct counter_config_info *info = dev->config;
|
||||
const struct mcux_rtc_config *config =
|
||||
|
@ -264,7 +264,7 @@ static const struct counter_driver_api mcux_rtc_driver_api = {
|
|||
|
||||
static struct mcux_rtc_data mcux_rtc_data_0;
|
||||
|
||||
static void mcux_rtc_irq_config_0(struct device *dev);
|
||||
static void mcux_rtc_irq_config_0(const struct device *dev);
|
||||
|
||||
static struct mcux_rtc_config mcux_rtc_config_0 = {
|
||||
.base = (RTC_Type *)DT_INST_REG_ADDR(0),
|
||||
|
@ -283,7 +283,7 @@ DEVICE_AND_API_INIT(rtc, DT_INST_LABEL(0), &mcux_rtc_init,
|
|||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&mcux_rtc_driver_api);
|
||||
|
||||
static void mcux_rtc_irq_config_0(struct device *dev)
|
||||
static void mcux_rtc_irq_config_0(const struct device *dev)
|
||||
{
|
||||
IRQ_CONNECT(DT_INST_IRQN(0),
|
||||
DT_INST_IRQ(0, priority),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue