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
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
static void gpio_stm32_isr(int line, void *arg)
|
||||
{
|
||||
struct device *dev = arg;
|
||||
const struct device *dev = arg;
|
||||
struct gpio_stm32_data *data = dev->data;
|
||||
|
||||
gpio_fire_callbacks(&data->cb, dev, BIT(line));
|
||||
|
@ -294,7 +294,7 @@ static int gpio_stm32_enable_int(int port, int pin)
|
|||
defined(CONFIG_SOC_SERIES_STM32L1X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32L4X) || \
|
||||
defined(CONFIG_SOC_SERIES_STM32G4X)
|
||||
struct device *clk = device_get_binding(STM32_CLOCK_CONTROL_NAME);
|
||||
const struct device *clk = device_get_binding(STM32_CLOCK_CONTROL_NAME);
|
||||
struct stm32_pclken pclken = {
|
||||
#ifdef CONFIG_SOC_SERIES_STM32H7X
|
||||
.bus = STM32_CLOCK_BUS_APB4,
|
||||
|
@ -313,7 +313,7 @@ static int gpio_stm32_enable_int(int port, int pin)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_stm32_port_get_raw(struct device *dev, uint32_t *value)
|
||||
static int gpio_stm32_port_get_raw(const struct device *dev, uint32_t *value)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
GPIO_TypeDef *gpio = (GPIO_TypeDef *)cfg->base;
|
||||
|
@ -323,7 +323,7 @@ static int gpio_stm32_port_get_raw(struct device *dev, uint32_t *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_stm32_port_set_masked_raw(struct device *dev,
|
||||
static int gpio_stm32_port_set_masked_raw(const struct device *dev,
|
||||
gpio_port_pins_t mask,
|
||||
gpio_port_value_t value)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ static int gpio_stm32_port_set_masked_raw(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_stm32_port_set_bits_raw(struct device *dev,
|
||||
static int gpio_stm32_port_set_bits_raw(const struct device *dev,
|
||||
gpio_port_pins_t pins)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
|
@ -356,7 +356,7 @@ static int gpio_stm32_port_set_bits_raw(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_stm32_port_clear_bits_raw(struct device *dev,
|
||||
static int gpio_stm32_port_clear_bits_raw(const struct device *dev,
|
||||
gpio_port_pins_t pins)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
|
@ -376,7 +376,7 @@ static int gpio_stm32_port_clear_bits_raw(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_stm32_port_toggle_bits(struct device *dev,
|
||||
static int gpio_stm32_port_toggle_bits(const struct device *dev,
|
||||
gpio_port_pins_t pins)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
|
@ -396,7 +396,7 @@ static int gpio_stm32_port_toggle_bits(struct device *dev,
|
|||
/**
|
||||
* @brief Configure pin or port
|
||||
*/
|
||||
static int gpio_stm32_config(struct device *dev,
|
||||
static int gpio_stm32_config(const struct device *dev,
|
||||
gpio_pin_t pin, gpio_flags_t flags)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
|
@ -425,9 +425,10 @@ exit:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int gpio_stm32_pin_interrupt_configure(struct device *dev,
|
||||
gpio_pin_t pin, enum gpio_int_mode mode,
|
||||
enum gpio_int_trig trig)
|
||||
static int gpio_stm32_pin_interrupt_configure(const struct device *dev,
|
||||
gpio_pin_t pin,
|
||||
enum gpio_int_mode mode,
|
||||
enum gpio_int_trig trig)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = dev->config;
|
||||
int edge = 0;
|
||||
|
@ -476,7 +477,7 @@ exit:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int gpio_stm32_manage_callback(struct device *dev,
|
||||
static int gpio_stm32_manage_callback(const struct device *dev,
|
||||
struct gpio_callback *callback,
|
||||
bool set)
|
||||
{
|
||||
|
@ -506,12 +507,12 @@ static const struct gpio_driver_api gpio_stm32_driver = {
|
|||
*
|
||||
* @return 0
|
||||
*/
|
||||
static int gpio_stm32_init(struct device *device)
|
||||
static int gpio_stm32_init(const struct device *device)
|
||||
{
|
||||
const struct gpio_stm32_config *cfg = device->config;
|
||||
|
||||
/* enable clock for subsystem */
|
||||
struct device *clk =
|
||||
const struct device *clk =
|
||||
device_get_binding(STM32_CLOCK_CONTROL_NAME);
|
||||
|
||||
if (clock_control_on(clk,
|
||||
|
@ -612,7 +613,7 @@ GPIO_DEVICE_INIT_STM32(k, K);
|
|||
|
||||
#if defined(CONFIG_SOC_SERIES_STM32F1X)
|
||||
|
||||
static int gpio_stm32_afio_init(struct device *device)
|
||||
static int gpio_stm32_afio_init(const struct device *device)
|
||||
{
|
||||
UNUSED(device);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue