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

@ -18,7 +18,8 @@ static const uint32_t sample_period[] = {
1250, 2500, 5000, 10000, 20000, 40000, 80000, 80000
};
static int fxas21002_sample_fetch(struct device *dev, enum sensor_channel chan)
static int fxas21002_sample_fetch(const struct device *dev,
enum sensor_channel chan)
{
const struct fxas21002_config *config = dev->config;
struct fxas21002_data *data = dev->data;
@ -70,7 +71,8 @@ static void fxas21002_convert(struct sensor_value *val, int16_t raw,
val->val2 = micro_rad % 1000000;
}
static int fxas21002_channel_get(struct device *dev, enum sensor_channel chan,
static int fxas21002_channel_get(const struct device *dev,
enum sensor_channel chan,
struct sensor_value *val)
{
const struct fxas21002_config *config = dev->config;
@ -130,7 +132,7 @@ static int fxas21002_channel_get(struct device *dev, enum sensor_channel chan,
return ret;
}
int fxas21002_get_power(struct device *dev, enum fxas21002_power *power)
int fxas21002_get_power(const struct device *dev, enum fxas21002_power *power)
{
const struct fxas21002_config *config = dev->config;
struct fxas21002_data *data = dev->data;
@ -148,7 +150,7 @@ int fxas21002_get_power(struct device *dev, enum fxas21002_power *power)
return 0;
}
int fxas21002_set_power(struct device *dev, enum fxas21002_power power)
int fxas21002_set_power(const struct device *dev, enum fxas21002_power power)
{
const struct fxas21002_config *config = dev->config;
struct fxas21002_data *data = dev->data;
@ -184,7 +186,7 @@ uint32_t fxas21002_get_transition_time(enum fxas21002_power start,
return transition_time;
}
static int fxas21002_init(struct device *dev)
static int fxas21002_init(const struct device *dev)
{
const struct fxas21002_config *config = dev->config;
struct fxas21002_data *data = dev->data;