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

@ -186,7 +186,7 @@ void z_loapic_enable(unsigned char cpu_number)
* kernel runs through its device initializations, so this is unneeded.
*/
static int loapic_init(struct device *unused)
static int loapic_init(const struct device *unused)
{
ARG_UNUSED(unused);
return 0;
@ -333,7 +333,7 @@ int z_irq_controller_isr_vector_get(void)
}
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
static int loapic_suspend(struct device *port)
static int loapic_suspend(const struct device *port)
{
volatile uint32_t lvt; /* local vector table entry value */
int loapic_irq;
@ -361,7 +361,7 @@ static int loapic_suspend(struct device *port)
return 0;
}
int loapic_resume(struct device *port)
int loapic_resume(const struct device *port)
{
int loapic_irq;
@ -394,7 +394,8 @@ int loapic_resume(struct device *port)
* Implements the driver control management functionality
* the *context may include IN data or/and OUT data
*/
static int loapic_device_ctrl(struct device *port, uint32_t ctrl_command,
static int loapic_device_ctrl(const struct device *port,
uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg)
{
int ret = 0;