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
|
@ -18,7 +18,7 @@ struct mcux_lptmr_config {
|
|||
lptmr_timer_mode_t mode;
|
||||
lptmr_pin_select_t pin;
|
||||
lptmr_pin_polarity_t polarity;
|
||||
void (*irq_config_func)(struct device *dev);
|
||||
void (*irq_config_func)(const struct device *dev);
|
||||
};
|
||||
|
||||
struct mcux_lptmr_data {
|
||||
|
@ -26,7 +26,7 @@ struct mcux_lptmr_data {
|
|||
void *top_user_data;
|
||||
};
|
||||
|
||||
static int mcux_lptmr_start(struct device *dev)
|
||||
static int mcux_lptmr_start(const struct device *dev)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
|
||||
|
@ -37,7 +37,7 @@ static int mcux_lptmr_start(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_lptmr_stop(struct device *dev)
|
||||
static int mcux_lptmr_stop(const struct device *dev)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
|
||||
|
@ -48,7 +48,7 @@ static int mcux_lptmr_stop(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_lptmr_get_value(struct device *dev, uint32_t *ticks)
|
||||
static int mcux_lptmr_get_value(const struct device *dev, uint32_t *ticks)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
|
||||
|
@ -57,8 +57,8 @@ static int mcux_lptmr_get_value(struct device *dev, uint32_t *ticks)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_lptmr_set_top_value(struct device *dev,
|
||||
const struct counter_top_cfg *cfg)
|
||||
static int mcux_lptmr_set_top_value(const struct device *dev,
|
||||
const struct counter_top_cfg *cfg)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
struct mcux_lptmr_data *data = dev->data;
|
||||
|
@ -85,7 +85,7 @@ static int mcux_lptmr_set_top_value(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t mcux_lptmr_get_pending_int(struct device *dev)
|
||||
static uint32_t mcux_lptmr_get_pending_int(const struct device *dev)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
uint32_t mask = LPTMR_CSR_TCF_MASK | LPTMR_CSR_TIE_MASK;
|
||||
|
@ -96,14 +96,14 @@ static uint32_t mcux_lptmr_get_pending_int(struct device *dev)
|
|||
return ((flags & mask) == mask);
|
||||
}
|
||||
|
||||
static uint32_t mcux_lptmr_get_top_value(struct device *dev)
|
||||
static uint32_t mcux_lptmr_get_top_value(const struct device *dev)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
|
||||
return (config->base->CMR & LPTMR_CMR_COMPARE_MASK) + 1U;
|
||||
}
|
||||
|
||||
static uint32_t mcux_lptmr_get_max_relative_alarm(struct device *dev)
|
||||
static uint32_t mcux_lptmr_get_max_relative_alarm(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
|
@ -113,7 +113,7 @@ static uint32_t mcux_lptmr_get_max_relative_alarm(struct device *dev)
|
|||
|
||||
static void mcux_lptmr_isr(void *arg)
|
||||
{
|
||||
struct device *dev = arg;
|
||||
const struct device *dev = arg;
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
struct mcux_lptmr_data *data = dev->data;
|
||||
uint32_t flags;
|
||||
|
@ -126,7 +126,7 @@ static void mcux_lptmr_isr(void *arg)
|
|||
}
|
||||
}
|
||||
|
||||
static int mcux_lptmr_init(struct device *dev)
|
||||
static int mcux_lptmr_init(const struct device *dev)
|
||||
{
|
||||
const struct mcux_lptmr_config *config = dev->config;
|
||||
lptmr_config_t lptmr_config;
|
||||
|
@ -210,7 +210,7 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1,
|
|||
#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay)
|
||||
static struct mcux_lptmr_data mcux_lptmr_data_0;
|
||||
|
||||
static void mcux_lptmr_irq_config_0(struct device *dev);
|
||||
static void mcux_lptmr_irq_config_0(const struct device *dev);
|
||||
|
||||
static struct mcux_lptmr_config mcux_lptmr_config_0 = {
|
||||
.info = {
|
||||
|
@ -248,7 +248,7 @@ DEVICE_AND_API_INIT(mcux_lptmr_0, DT_INST_LABEL(0),
|
|||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
&mcux_lptmr_driver_api);
|
||||
|
||||
static void mcux_lptmr_irq_config_0(struct device *dev)
|
||||
static void mcux_lptmr_irq_config_0(const struct device *dev)
|
||||
{
|
||||
IRQ_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority),
|
||||
mcux_lptmr_isr, DEVICE_GET(mcux_lptmr_0), 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue