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
|
@ -19,7 +19,8 @@
|
|||
|
||||
LOG_MODULE_REGISTER(IAQ_CORE, CONFIG_SENSOR_LOG_LEVEL);
|
||||
|
||||
static int iaqcore_sample_fetch(struct device *dev, enum sensor_channel chan)
|
||||
static int iaqcore_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
struct iaq_core_data *drv_data = dev->data;
|
||||
struct iaq_registers buf;
|
||||
|
@ -66,7 +67,7 @@ static int iaqcore_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
static int iaqcore_channel_get(struct device *dev,
|
||||
static int iaqcore_channel_get(const struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
|
@ -97,7 +98,7 @@ static const struct sensor_driver_api iaq_core_driver_api = {
|
|||
.channel_get = iaqcore_channel_get,
|
||||
};
|
||||
|
||||
static int iaq_core_init(struct device *dev)
|
||||
static int iaq_core_init(const struct device *dev)
|
||||
{
|
||||
struct iaq_core_data *drv_data = dev->data;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ struct iaq_registers {
|
|||
} __packed;
|
||||
|
||||
struct iaq_core_data {
|
||||
struct device *i2c;
|
||||
const struct device *i2c;
|
||||
uint16_t co2;
|
||||
uint16_t voc;
|
||||
uint8_t status;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue