diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2015-06-23 09:01:30 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2015-06-26 15:32:30 -0400 |
| commit | bbc9d21fc0071c245c19077155ea371092ff0db8 (patch) | |
| tree | 24bee30d2d536090dc8177a3e9166ef7d999d6ba /include/linux | |
| parent | 304adf8a8fff972f633bf52b3d160682d3f3d5d2 (diff) | |
genirq: Implement irq_set_handler_locked()/irq_set_chip_handler_name_locked()
The main use case for the exisiting __irq_set_*_locked() inlines is to
replace the handler [,chip and name] of an interrupt from a region
which has the irq descriptor lock held, e.g. from the irq_set_type()
callback. The first argument is the irq number, so the functions need
so perform a pointless lookup of the interrupt descriptor for those
cases which have the irq_data pointer handy.
Provide new functions which take an irq_data pointer instead of the
interrupt number, so the lookup of the interrupt descriptor can be
avoided.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Conflicts:
include/linux/irqdesc.h
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/irqdesc.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index a72bfd94ea10..624a668e61f1 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
| @@ -190,6 +190,47 @@ __irq_set_chip_handler_name_locked(unsigned int irq, struct irq_chip *chip, | |||
| 190 | desc->name = name; | 190 | desc->name = name; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | /** | ||
| 194 | * irq_set_handler_locked - Set irq handler from a locked region | ||
| 195 | * @data: Pointer to the irq_data structure which identifies the irq | ||
| 196 | * @handler: Flow control handler function for this interrupt | ||
| 197 | * | ||
| 198 | * Sets the handler in the irq descriptor associated to @data. | ||
| 199 | * | ||
| 200 | * Must be called with irq_desc locked and valid parameters. Typical | ||
| 201 | * call site is the irq_set_type() callback. | ||
| 202 | */ | ||
| 203 | static inline void irq_set_handler_locked(struct irq_data *data, | ||
| 204 | irq_flow_handler_t handler) | ||
| 205 | { | ||
| 206 | struct irq_desc *desc = irq_data_to_desc(data); | ||
| 207 | |||
| 208 | desc->handle_irq = handler; | ||
| 209 | } | ||
| 210 | |||
| 211 | /** | ||
| 212 | * irq_set_chip_handler_name_locked - Set chip, handler and name from a locked region | ||
| 213 | * @data: Pointer to the irq_data structure for which the chip is set | ||
| 214 | * @chip: Pointer to the new irq chip | ||
| 215 | * @handler: Flow control handler function for this interrupt | ||
| 216 | * @name: Name of the interrupt | ||
| 217 | * | ||
| 218 | * Replace the irq chip at the proper hierarchy level in @data and | ||
| 219 | * sets the handler and name in the associated irq descriptor. | ||
| 220 | * | ||
| 221 | * Must be called with irq_desc locked and valid parameters. | ||
| 222 | */ | ||
| 223 | static inline void | ||
| 224 | irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip, | ||
| 225 | irq_flow_handler_t handler, const char *name) | ||
| 226 | { | ||
| 227 | struct irq_desc *desc = irq_data_to_desc(data); | ||
| 228 | |||
| 229 | desc->handle_irq = handler; | ||
| 230 | desc->name = name; | ||
| 231 | data->chip = chip; | ||
| 232 | } | ||
| 233 | |||
| 193 | static inline int irq_balancing_disabled(unsigned int irq) | 234 | static inline int irq_balancing_disabled(unsigned int irq) |
| 194 | { | 235 | { |
| 195 | struct irq_desc *desc; | 236 | struct irq_desc *desc; |
