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
|
@ -20,7 +20,8 @@
|
|||
#define LOG_LEVEL CONFIG_SENSOR_LOG_LEVEL
|
||||
LOG_MODULE_REGISTER(TMP116);
|
||||
|
||||
static int tmp116_reg_read(struct device *dev, uint8_t reg, uint16_t *val)
|
||||
static int tmp116_reg_read(const struct device *dev, uint8_t reg,
|
||||
uint16_t *val)
|
||||
{
|
||||
struct tmp116_data *drv_data = dev->data;
|
||||
const struct tmp116_dev_config *cfg = dev->config;
|
||||
|
@ -43,7 +44,7 @@ static int tmp116_reg_read(struct device *dev, uint8_t reg, uint16_t *val)
|
|||
* @retval 0 On success
|
||||
* @retval -EIO Otherwise
|
||||
*/
|
||||
static inline int tmp116_device_id_check(struct device *dev)
|
||||
static inline int tmp116_device_id_check(const struct device *dev)
|
||||
{
|
||||
uint16_t value;
|
||||
|
||||
|
@ -62,7 +63,8 @@ static inline int tmp116_device_id_check(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tmp116_sample_fetch(struct device *dev, enum sensor_channel chan)
|
||||
static int tmp116_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
struct tmp116_data *drv_data = dev->data;
|
||||
uint16_t value;
|
||||
|
@ -88,7 +90,8 @@ static int tmp116_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tmp116_channel_get(struct device *dev, enum sensor_channel chan,
|
||||
static int tmp116_channel_get(const struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
struct tmp116_data *drv_data = dev->data;
|
||||
|
@ -114,7 +117,7 @@ static const struct sensor_driver_api tmp116_driver_api = {
|
|||
.channel_get = tmp116_channel_get
|
||||
};
|
||||
|
||||
static int tmp116_init(struct device *dev)
|
||||
static int tmp116_init(const struct device *dev)
|
||||
{
|
||||
struct tmp116_data *drv_data = dev->data;
|
||||
int rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue