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
|
@ -15,14 +15,16 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (*isr_t)(struct device *dev);
|
||||
typedef int (*isr_t)(const struct device *dev);
|
||||
|
||||
/* driver API definition */
|
||||
typedef int (*shared_irq_register_t)(struct device *dev,
|
||||
isr_t isr_func,
|
||||
struct device *isr_dev);
|
||||
typedef int (*shared_irq_enable_t)(struct device *dev, struct device *isr_dev);
|
||||
typedef int (*shared_irq_disable_t)(struct device *dev, struct device *isr_dev);
|
||||
typedef int (*shared_irq_register_t)(const struct device *dev,
|
||||
isr_t isr_func,
|
||||
const struct device *isr_dev);
|
||||
typedef int (*shared_irq_enable_t)(const struct device *dev,
|
||||
const struct device *isr_dev);
|
||||
typedef int (*shared_irq_disable_t)(const struct device *dev,
|
||||
const struct device *isr_dev);
|
||||
|
||||
struct shared_irq_driver_api {
|
||||
shared_irq_register_t isr_register;
|
||||
|
@ -30,7 +32,7 @@ struct shared_irq_driver_api {
|
|||
shared_irq_disable_t disable;
|
||||
};
|
||||
|
||||
extern int shared_irq_initialize(struct device *port);
|
||||
extern int shared_irq_initialize(const struct device *port);
|
||||
|
||||
typedef void (*shared_irq_config_irq_t)(void);
|
||||
|
||||
|
@ -41,7 +43,7 @@ struct shared_irq_config {
|
|||
};
|
||||
|
||||
struct shared_irq_client {
|
||||
struct device *isr_dev;
|
||||
const struct device *isr_dev;
|
||||
isr_t isr_func;
|
||||
uint32_t enabled;
|
||||
};
|
||||
|
@ -56,8 +58,9 @@ struct shared_irq_runtime {
|
|||
* @param isr_func Pointer to the ISR function for the device.
|
||||
* @param isr_dev Pointer to the device that will service the interrupt.
|
||||
*/
|
||||
static inline int shared_irq_isr_register(struct device *dev, isr_t isr_func,
|
||||
struct device *isr_dev)
|
||||
static inline int shared_irq_isr_register(const struct device *dev,
|
||||
isr_t isr_func,
|
||||
const struct device *isr_dev)
|
||||
{
|
||||
const struct shared_irq_driver_api *api =
|
||||
(const struct shared_irq_driver_api *)dev->api;
|
||||
|
@ -70,7 +73,8 @@ static inline int shared_irq_isr_register(struct device *dev, isr_t isr_func,
|
|||
* @param dev Pointer to device structure for SHARED_IRQ driver instance.
|
||||
* @param isr_dev Pointer to the device that will service the interrupt.
|
||||
*/
|
||||
static inline int shared_irq_enable(struct device *dev, struct device *isr_dev)
|
||||
static inline int shared_irq_enable(const struct device *dev,
|
||||
const struct device *isr_dev)
|
||||
{
|
||||
const struct shared_irq_driver_api *api =
|
||||
(const struct shared_irq_driver_api *)dev->api;
|
||||
|
@ -83,7 +87,8 @@ static inline int shared_irq_enable(struct device *dev, struct device *isr_dev)
|
|||
* @param dev Pointer to device structure for SHARED_IRQ driver instance.
|
||||
* @param isr_dev Pointer to the device that will service the interrupt.
|
||||
*/
|
||||
static inline int shared_irq_disable(struct device *dev, struct device *isr_dev)
|
||||
static inline int shared_irq_disable(const struct device *dev,
|
||||
const struct device *isr_dev)
|
||||
{
|
||||
const struct shared_irq_driver_api *api =
|
||||
(const struct shared_irq_driver_api *)dev->api;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue