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
|
@ -23,7 +23,7 @@
|
|||
LOG_MODULE_REGISTER(si7006, CONFIG_SENSOR_LOG_LEVEL);
|
||||
|
||||
struct si7006_data {
|
||||
struct device *i2c_dev;
|
||||
const struct device *i2c_dev;
|
||||
uint16_t temperature;
|
||||
uint16_t humidity;
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ struct si7006_data {
|
|||
*
|
||||
* @return int 0 on success
|
||||
*/
|
||||
static int si7006_get_humidity(struct device *i2c_dev,
|
||||
static int si7006_get_humidity(const struct device *i2c_dev,
|
||||
struct si7006_data *si_data)
|
||||
{
|
||||
int retval;
|
||||
|
@ -60,7 +60,7 @@ static int si7006_get_humidity(struct device *i2c_dev,
|
|||
* @return int 0 on success
|
||||
*/
|
||||
|
||||
static int si7006_get_old_temperature(struct device *i2c_dev,
|
||||
static int si7006_get_old_temperature(const struct device *i2c_dev,
|
||||
struct si7006_data *si_data)
|
||||
{
|
||||
uint8_t temp[2];
|
||||
|
@ -83,7 +83,8 @@ static int si7006_get_old_temperature(struct device *i2c_dev,
|
|||
*
|
||||
* @return 0
|
||||
*/
|
||||
static int si7006_sample_fetch(struct device *dev, enum sensor_channel chan)
|
||||
static int si7006_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
int retval;
|
||||
struct si7006_data *si_data = dev->data;
|
||||
|
@ -101,7 +102,8 @@ static int si7006_sample_fetch(struct device *dev, enum sensor_channel chan)
|
|||
*
|
||||
* @return -ENOTSUP for unsupported channels
|
||||
*/
|
||||
static int si7006_channel_get(struct device *dev, enum sensor_channel chan,
|
||||
static int si7006_channel_get(const struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
struct si7006_data *si_data = dev->data;
|
||||
|
@ -144,7 +146,7 @@ static const struct sensor_driver_api si7006_api = {
|
|||
* @return 0 for success
|
||||
*/
|
||||
|
||||
static int si7006_init(struct device *dev)
|
||||
static int si7006_init(const struct device *dev)
|
||||
{
|
||||
struct si7006_data *drv_data = dev->data;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue