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:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -188,7 +188,8 @@ static uint8_t bme680_calc_gas_wait(uint16_t dur)
|
|||
return durval;
|
||||
}
|
||||
|
||||
static int bme680_sample_fetch(struct device *dev, enum sensor_channel chan)
|
||||
static int bme680_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
struct bme680_data *data = dev->data;
|
||||
uint8_t buff[BME680_LEN_FIELD] = { 0 };
|
||||
|
@ -233,7 +234,8 @@ static int bme680_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int bme680_channel_get(struct device *dev, enum sensor_channel chan,
|
||||
static int bme680_channel_get(const struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
struct bme680_data *data = dev->data;
|
||||
|
@ -339,7 +341,7 @@ static int bme680_read_compensation(struct bme680_data *data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int bme680_chip_init(struct device *dev)
|
||||
static int bme680_chip_init(const struct device *dev)
|
||||
{
|
||||
struct bme680_data *data = (struct bme680_data *)dev->data;
|
||||
int err;
|
||||
|
@ -398,7 +400,7 @@ static int bme680_chip_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int bme680_init(struct device *dev)
|
||||
static int bme680_init(const struct device *dev)
|
||||
{
|
||||
struct bme680_data *data = dev->data;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
#define BME680_CONCAT_BYTES(msb, lsb) (((uint16_t)msb << 8) | (uint16_t)lsb)
|
||||
|
||||
struct bme680_data {
|
||||
struct device *i2c_master;
|
||||
const struct device *i2c_master;
|
||||
uint16_t i2c_slave_addr;
|
||||
|
||||
/* Compensation parameters. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue