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

@ -15,7 +15,7 @@ LOG_MODULE_DECLARE(CCS811);
#define IRQ_PIN DT_INST_GPIO_PIN(0, irq_gpios)
int ccs811_attr_set(struct device *dev,
int ccs811_attr_set(const struct device *dev,
enum sensor_channel chan,
enum sensor_attribute attr,
const struct sensor_value *thr)
@ -45,7 +45,7 @@ int ccs811_attr_set(struct device *dev,
return rc;
}
static inline void setup_irq(struct device *dev,
static inline void setup_irq(const struct device *dev,
bool enable)
{
struct ccs811_data *data = dev->data;
@ -56,7 +56,7 @@ static inline void setup_irq(struct device *dev,
gpio_pin_interrupt_configure(data->irq_gpio, IRQ_PIN, flags);
}
static inline void handle_irq(struct device *dev)
static inline void handle_irq(const struct device *dev)
{
struct ccs811_data *data = dev->data;
@ -69,7 +69,7 @@ static inline void handle_irq(struct device *dev)
#endif
}
static void process_irq(struct device *dev)
static void process_irq(const struct device *dev)
{
struct ccs811_data *data = dev->data;
@ -82,7 +82,7 @@ static void process_irq(struct device *dev)
}
}
static void gpio_callback(struct device *dev,
static void gpio_callback(const struct device *dev,
struct gpio_callback *cb,
uint32_t pins)
{
@ -97,7 +97,7 @@ static void gpio_callback(struct device *dev,
#ifdef CONFIG_CCS811_TRIGGER_OWN_THREAD
static void irq_thread(int dev_ptr, int unused)
{
struct device *dev = INT_TO_POINTER(dev_ptr);
const struct device *dev = INT_TO_POINTER(dev_ptr);
struct ccs811_data *drv_data = dev->data;
ARG_UNUSED(unused);
@ -118,7 +118,7 @@ static void work_cb(struct k_work *work)
#error Unhandled trigger configuration
#endif
int ccs811_trigger_set(struct device *dev,
int ccs811_trigger_set(const struct device *dev,
const struct sensor_trigger *trig,
sensor_trigger_handler_t handler)
{
@ -168,7 +168,7 @@ int ccs811_trigger_set(struct device *dev,
return rc;
}
int ccs811_init_interrupt(struct device *dev)
int ccs811_init_interrupt(const struct device *dev)
{
struct ccs811_data *drv_data = dev->data;