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

@ -85,7 +85,7 @@ static uint32_t wdt_sam0_timeout_to_wdt_period(uint32_t timeout_ms)
return find_msb_set(next_pow2 >> 4);
}
static void wdt_sam0_isr(struct device *dev)
static void wdt_sam0_isr(const struct device *dev)
{
struct wdt_sam0_dev_data *data = dev->data;
@ -96,7 +96,7 @@ static void wdt_sam0_isr(struct device *dev)
}
}
static int wdt_sam0_setup(struct device *dev, uint8_t options)
static int wdt_sam0_setup(const struct device *dev, uint8_t options)
{
struct wdt_sam0_dev_data *data = dev->data;
@ -127,7 +127,7 @@ static int wdt_sam0_setup(struct device *dev, uint8_t options)
return 0;
}
static int wdt_sam0_disable(struct device *dev)
static int wdt_sam0_disable(const struct device *dev)
{
if (!wdt_sam0_is_enabled()) {
return -EFAULT;
@ -139,8 +139,8 @@ static int wdt_sam0_disable(struct device *dev)
return 0;
}
static int wdt_sam0_install_timeout(struct device *dev,
const struct wdt_timeout_cfg *cfg)
static int wdt_sam0_install_timeout(const struct device *dev,
const struct wdt_timeout_cfg *cfg)
{
struct wdt_sam0_dev_data *data = dev->data;
uint32_t window, per;
@ -225,7 +225,7 @@ timeout_invalid:
return -EINVAL;
}
static int wdt_sam0_feed(struct device *dev, int channel_id)
static int wdt_sam0_feed(const struct device *dev, int channel_id)
{
struct wdt_sam0_dev_data *data = dev->data;
@ -250,7 +250,7 @@ static const struct wdt_driver_api wdt_sam0_api = {
.feed = wdt_sam0_feed,
};
static int wdt_sam0_init(struct device *dev)
static int wdt_sam0_init(const struct device *dev)
{
#ifdef CONFIG_WDT_DISABLE_AT_BOOT
/* Ignore any errors */