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

@ -523,7 +523,7 @@ static const struct bt_hci_driver drv = {
.send = hci_driver_send,
};
static int hci_driver_init(struct device *unused)
static int hci_driver_init(const struct device *unused)
{
ARG_UNUSED(unused);

View file

@ -49,7 +49,7 @@ static struct {
} event;
/* Entropy device */
static struct device *dev_entropy;
static const struct device *dev_entropy;
static int init_reset(void);
static int prepare(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb,

View file

@ -31,9 +31,9 @@
#include <drivers/gpio.h>
extern struct device *vega_debug_portb;
extern struct device *vega_debug_portc;
extern struct device *vega_debug_portd;
extern const struct device *vega_debug_portb;
extern const struct device *vega_debug_portc;
extern const struct device *vega_debug_portd;
#define DEBUG0_PIN 5
#define DEBUG0_PORT vega_debug_portd

View file

@ -42,11 +42,11 @@ static struct {
} event;
static struct {
struct device *clk;
const struct device *clk;
} lll;
/* Entropy device */
static struct device *dev_entropy;
static const struct device *dev_entropy;
static int init_reset(void);
static int prepare(lll_is_abort_cb_t is_abort_cb, lll_abort_cb_t abort_cb,
@ -110,7 +110,7 @@ static void swi_ull_low_rv32m1_isr(void *arg)
int lll_init(void)
{
struct device *clk_k32;
const struct device *clk_k32;
int err;
ARG_UNUSED(clk_k32);