[PATCH] irqdomain: fix compiling when IRQ_DOMAIN unset

From: Stefan Christ
Date: Sun Nov 13 2016 - 11:21:27 EST


When config option IRQ_DOMAIN is unset, compiling the file
'drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c' fails:

CC drivers/gpu/drm/amd/amdgpu/amdgpu_irq.o
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c: In function âamdgpu_irq_dispatchâ:
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:345:3: error: implicit declaration of
function âirq_find_mappingâ [-Werror=implicit-function-declaration]
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c: In function âamdgpu_irq_add_domainâ:
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:529:2: error: implicit declaration of
function âirq_domain_add_linearâ [-Werror=implicit-function-declaration]
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c: In function âamdgpu_irq_remove_domainâ:
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:550:3: error: implicit declaration of
function âirq_domain_removeâ [-Werror=implicit-function-declaration]
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c: In function âamdgpu_irq_create_mappingâ:
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c:569:2: error: implicit declaration of
function âirq_create_mappingâ [-Werror=implicit-function-declaration]

Adding the functions stubs in the header file so it compiles cleanly.
Maybe the drm driver 'amdgpu' should select the config option IRQ_DOMAIN
if it cannot work without it. But I don't know if that's necessary.

Signed-off-by: Stefan Christ <contact@xxxxxxxxxxxxxxx>
---
include/linux/irqdomain.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index ffb8460..1c79a0d 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -480,6 +480,24 @@ static inline bool irq_domain_is_ipi_single(struct irq_domain *domain)
#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */

#else /* CONFIG_IRQ_DOMAIN */
+static inline int irq_find_mapping(struct irq_domain *host,
+ irq_hw_number_t hwirq)
+{
+ return 0;
+}
+static inline struct irq_domain *irq_domain_add_linear(
+ struct device_node *of_node, unsigned int size,
+ const struct irq_domain_ops *ops,
+ void *host_data)
+{
+ return NULL;
+}
+static inline void irq_domain_remove(struct irq_domain *host) { }
+static inline unsigned int irq_create_mapping(struct irq_domain *host,
+ irq_hw_number_t hwirq)
+{
+ return 0;
+}
static inline void irq_dispose_mapping(unsigned int virq) { }
static inline void irq_domain_activate_irq(struct irq_data *data) { }
static inline void irq_domain_deactivate_irq(struct irq_data *data) { }
--
2.7.3