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
|
@ -28,8 +28,8 @@ LOG_MODULE_REGISTER(DHT, CONFIG_SENSOR_LOG_LEVEL);
|
|||
* @return duration in usec of signal being measured,
|
||||
* -1 if duration exceeds DHT_SIGNAL_MAX_WAIT_DURATION
|
||||
*/
|
||||
static int8_t dht_measure_signal_duration(struct device *dev,
|
||||
bool active)
|
||||
static int8_t dht_measure_signal_duration(const struct device *dev,
|
||||
bool active)
|
||||
{
|
||||
struct dht_data *drv_data = dev->data;
|
||||
const struct dht_config *cfg = dev->config;
|
||||
|
@ -57,7 +57,8 @@ static int8_t dht_measure_signal_duration(struct device *dev,
|
|||
(uint64_t)sys_clock_hw_cycles_per_sec();
|
||||
}
|
||||
|
||||
static int dht_sample_fetch(struct device *dev, enum sensor_channel chan)
|
||||
static int dht_sample_fetch(const struct device *dev,
|
||||
enum sensor_channel chan)
|
||||
{
|
||||
struct dht_data *drv_data = dev->data;
|
||||
const struct dht_config *cfg = dev->config;
|
||||
|
@ -164,7 +165,7 @@ cleanup:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int dht_channel_get(struct device *dev,
|
||||
static int dht_channel_get(const struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
struct sensor_value *val)
|
||||
{
|
||||
|
@ -221,7 +222,7 @@ static const struct sensor_driver_api dht_api = {
|
|||
.channel_get = &dht_channel_get,
|
||||
};
|
||||
|
||||
static int dht_init(struct device *dev)
|
||||
static int dht_init(const struct device *dev)
|
||||
{
|
||||
int rc = 0;
|
||||
struct dht_data *drv_data = dev->data;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define DHT_DATA_BITS_NUM 40
|
||||
|
||||
struct dht_data {
|
||||
struct device *gpio;
|
||||
const struct device *gpio;
|
||||
uint8_t sample[4];
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue