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:
Tomasz Bursztyka 2020-04-30 20:33:38 +02:00 committed by Carles Cufí
commit e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions

View file

@ -77,7 +77,7 @@ static uint32_t get_bus_clock(uint32_t clock, uint32_t prescaler)
return clock / prescaler;
}
static inline int stm32_clock_control_on(struct device *dev,
static inline int stm32_clock_control_on(const struct device *dev,
clock_control_subsys_t sub_system)
{
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
@ -129,7 +129,7 @@ static inline int stm32_clock_control_on(struct device *dev,
}
static inline int stm32_clock_control_off(struct device *dev,
static inline int stm32_clock_control_off(const struct device *dev,
clock_control_subsys_t sub_system)
{
struct stm32_pclken *pclken = (struct stm32_pclken *)(sub_system);
@ -180,7 +180,7 @@ static inline int stm32_clock_control_off(struct device *dev,
}
static int stm32_clock_control_get_subsys_rate(struct device *clock,
static int stm32_clock_control_get_subsys_rate(const struct device *clock,
clock_control_subsys_t sub_system,
uint32_t *rate)
{
@ -283,7 +283,7 @@ static inline void stm32_clock_control_mco_init(void)
#endif /* CONFIG_CLOCK_STM32_MCO2_SRC_NOCLOCK */
}
static int stm32_clock_control_init(struct device *dev)
static int stm32_clock_control_init(const struct device *dev)
{
LL_UTILS_ClkInitTypeDef s_ClkInitStruct;
uint32_t hclk_prescaler;