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

@ -55,7 +55,7 @@ static inline void set_eic_enable(bool on)
static void sam0_eic_isr(void *arg)
{
struct device *dev = (struct device *)arg;
const struct device *dev = (const struct device *)arg;
struct sam0_eic_data *const dev_data = DEV_DATA(dev);
uint16_t bits = EIC->INTFLAG.reg;
uint32_t line_index;
@ -102,7 +102,7 @@ static void sam0_eic_isr(void *arg)
int sam0_eic_acquire(int port, int pin, enum sam0_eic_trigger trigger,
bool filter, sam0_eic_callback_t cb, void *data)
{
struct device *dev = DEVICE_GET(sam0_eic);
const struct device *dev = DEVICE_GET(sam0_eic);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_port_data *port_data;
struct sam0_eic_line_assignment *line_assignment;
@ -192,7 +192,7 @@ err_in_use:
static bool sam0_eic_check_ownership(int port, int pin, int line_index)
{
struct device *dev = DEVICE_GET(sam0_eic);
const struct device *dev = DEVICE_GET(sam0_eic);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_line_assignment *line_assignment =
&dev_data->lines[line_index];
@ -211,7 +211,7 @@ static bool sam0_eic_check_ownership(int port, int pin, int line_index)
int sam0_eic_release(int port, int pin)
{
struct device *dev = DEVICE_GET(sam0_eic);
const struct device *dev = DEVICE_GET(sam0_eic);
struct sam0_eic_data *dev_data = dev->data;
uint32_t mask;
int line_index;
@ -302,7 +302,7 @@ int sam0_eic_disable_interrupt(int port, int pin)
uint32_t sam0_eic_interrupt_pending(int port)
{
struct device *dev = DEVICE_GET(sam0_eic);
const struct device *dev = DEVICE_GET(sam0_eic);
struct sam0_eic_data *dev_data = dev->data;
struct sam0_eic_line_assignment *line_assignment;
uint32_t set = EIC->INTFLAG.reg;
@ -338,7 +338,7 @@ uint32_t sam0_eic_interrupt_pending(int port)
irq_enable(DT_INST_IRQ_BY_IDX(0, n, irq)); \
} while (0)
static int sam0_eic_init(struct device *dev)
static int sam0_eic_init(const struct device *dev)
{
ARG_UNUSED(dev);