aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/irq.h62
-rw-r--r--kernel/irq/chip.c8
2 files changed, 66 insertions, 4 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index e7e7ac83edd8..bea40556c5a6 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -85,6 +85,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
85#endif 85#endif
86 86
87struct msi_desc; 87struct msi_desc;
88struct irq_2_iommu;
88 89
89/** 90/**
90 * struct irq_data - per irq and irq chip data passed down to chip functions 91 * struct irq_data - per irq and irq chip data passed down to chip functions
@@ -332,11 +333,64 @@ extern int set_irq_data(unsigned int irq, void *data);
332extern int set_irq_chip_data(unsigned int irq, void *data); 333extern int set_irq_chip_data(unsigned int irq, void *data);
333extern int set_irq_type(unsigned int irq, unsigned int type); 334extern int set_irq_type(unsigned int irq, unsigned int type);
334extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); 335extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
336extern struct irq_data *irq_get_irq_data(unsigned int irq);
335 337
336#define get_irq_chip(irq) (irq_to_desc(irq)->irq_data.chip) 338static inline struct irq_chip *get_irq_chip(unsigned int irq)
337#define get_irq_chip_data(irq) (irq_to_desc(irq)->irq_data.chip_data) 339{
338#define get_irq_data(irq) (irq_to_desc(irq)->irq_data.handler_data) 340 struct irq_data *d = irq_get_irq_data(irq);
339#define get_irq_msi(irq) (irq_to_desc(irq)->irq_data.msi_desc) 341 return d ? d->chip : NULL;
342}
343
344static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d)
345{
346 return d->chip;
347}
348
349static inline void *get_irq_chip_data(unsigned int irq)
350{
351 struct irq_data *d = irq_get_irq_data(irq);
352 return d ? d->chip_data : NULL;
353}
354
355static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
356{
357 return d->chip_data;
358}
359
360static inline void *get_irq_data(unsigned int irq)
361{
362 struct irq_data *d = irq_get_irq_data(irq);
363 return d ? d->handler_data : NULL;
364}
365
366static inline void *irq_data_get_irq_data(struct irq_data *d)
367{
368 return d->handler_data;
369}
370
371static inline struct msi_desc *get_irq_msi(unsigned int irq)
372{
373 struct irq_data *d = irq_get_irq_data(irq);
374 return d ? d->msi_desc : NULL;
375}
376
377static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
378{
379 return d->msi_desc;
380}
381
382#ifdef CONFIG_INTR_REMAP
383static inline struct irq_2_iommu *get_irq_iommu(unsigned int irq)
384{
385 struct irq_data *d = irq_get_irq_data(irq);
386 return d ? d->irq_2_iommu : NULL;
387}
388
389static inline struct irq_2_iommu *irq_data_get_iommu(struct irq_data *d)
390{
391 return d->irq_2_iommu;
392}
393#endif
340 394
341#endif /* CONFIG_GENERIC_HARDIRQS */ 395#endif /* CONFIG_GENERIC_HARDIRQS */
342 396
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 2b1f6906b824..659be326c8e8 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -256,6 +256,14 @@ int set_irq_chip_data(unsigned int irq, void *data)
256} 256}
257EXPORT_SYMBOL(set_irq_chip_data); 257EXPORT_SYMBOL(set_irq_chip_data);
258 258
259struct irq_data *irq_get_irq_data(unsigned int irq)
260{
261 struct irq_desc *desc = irq_to_desc(irq);
262
263 return desc ? &desc->irq_data : NULL;
264}
265EXPORT_SYMBOL_GPL(irq_get_irq_data);
266
259/** 267/**
260 * set_irq_nested_thread - Set/Reset the IRQ_NESTED_THREAD flag of an irq 268 * set_irq_nested_thread - Set/Reset the IRQ_NESTED_THREAD flag of an irq
261 * 269 *