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>
diff --git a/drivers/interrupt_controller/intc_shared_irq.c b/drivers/interrupt_controller/intc_shared_irq.c
index addd2ec..5351b03 100644
--- a/drivers/interrupt_controller/intc_shared_irq.c
+++ b/drivers/interrupt_controller/intc_shared_irq.c
@@ -24,8 +24,8 @@
* @param isr_func Pointer to the ISR function for the device.
* @param isr_dev Pointer to the device that will service the interrupt.
*/
-static int isr_register(struct device *dev, isr_t isr_func,
- struct device *isr_dev)
+static int isr_register(const struct device *dev, isr_t isr_func,
+ const struct device *isr_dev)
{
struct shared_irq_runtime *clients = dev->data;
const struct shared_irq_config *config = dev->config;
@@ -46,7 +46,8 @@
* @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 enable(struct device *dev, struct device *isr_dev)
+static inline int enable(const struct device *dev,
+ const struct device *isr_dev)
{
struct shared_irq_runtime *clients = dev->data;
const struct shared_irq_config *config = dev->config;
@@ -78,7 +79,8 @@
* @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 disable(struct device *dev, struct device *isr_dev)
+static inline int disable(const struct device *dev,
+ const struct device *isr_dev)
{
struct shared_irq_runtime *clients = dev->data;
const struct shared_irq_config *config = dev->config;
@@ -96,7 +98,7 @@
return -EIO;
}
-void shared_irq_isr(struct device *dev)
+void shared_irq_isr(const struct device *dev)
{
struct shared_irq_runtime *clients = dev->data;
const struct shared_irq_config *config = dev->config;
@@ -116,7 +118,7 @@
};
-int shared_irq_initialize(struct device *dev)
+int shared_irq_initialize(const struct device *dev)
{
const struct shared_irq_config *config = dev->config;
config->config();