diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-10 05:36:33 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-19 06:58:06 -0500 |
commit | a0cd9ca2b907d7ee26575e7b63ac92dad768a75e (patch) | |
tree | 4b46f7951b9cd76531caf6d4d68d687e1b622336 | |
parent | 43abe43ce0619d744c7a5bb15cce075e532b53b7 (diff) |
genirq: Namespace cleanup
The irq namespace has become quite convoluted. My bad. Clean it up
and deprecate the old functions. All new functions follow the scheme:
irq number based:
irq_set/get/xxx/_xxx(unsigned int irq, ...)
irq_data based:
irq_data_set/get/xxx/_xxx(struct irq_data *d, ....)
irq_desc based:
irq_desc_get_xxx(struct irq_desc *desc)
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/interrupt.h | 14 | ||||
-rw-r--r-- | include/linux/irq.h | 79 | ||||
-rw-r--r-- | include/linux/irqdesc.h | 44 | ||||
-rw-r--r-- | kernel/irq/chip.c | 28 | ||||
-rw-r--r-- | kernel/irq/manage.c | 6 |
5 files changed, 133 insertions, 38 deletions
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 56b7c97aaf0a..7834726dd95b 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -346,16 +346,24 @@ static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /* IRQ wakeup (PM) control: */ | 348 | /* IRQ wakeup (PM) control: */ |
349 | extern int set_irq_wake(unsigned int irq, unsigned int on); | 349 | extern int irq_set_irq_wake(unsigned int irq, unsigned int on); |
350 | |||
351 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
352 | /* Please do not use: Use the replacement functions instead */ | ||
353 | static inline int set_irq_wake(unsigned int irq, unsigned int on) | ||
354 | { | ||
355 | return irq_set_irq_wake(irq, on); | ||
356 | } | ||
357 | #endif | ||
350 | 358 | ||
351 | static inline int enable_irq_wake(unsigned int irq) | 359 | static inline int enable_irq_wake(unsigned int irq) |
352 | { | 360 | { |
353 | return set_irq_wake(irq, 1); | 361 | return irq_set_irq_wake(irq, 1); |
354 | } | 362 | } |
355 | 363 | ||
356 | static inline int disable_irq_wake(unsigned int irq) | 364 | static inline int disable_irq_wake(unsigned int irq) |
357 | { | 365 | { |
358 | return set_irq_wake(irq, 0); | 366 | return irq_set_irq_wake(irq, 0); |
359 | } | 367 | } |
360 | 368 | ||
361 | #else /* !CONFIG_GENERIC_HARDIRQS */ | 369 | #else /* !CONFIG_GENERIC_HARDIRQS */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 80fcb53057bc..e9f847d56c4d 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -292,8 +292,7 @@ set_irq_handler(unsigned int irq, irq_flow_handler_t handle) | |||
292 | * IRQ_NOREQUEST and IRQ_NOPROBE) | 292 | * IRQ_NOREQUEST and IRQ_NOPROBE) |
293 | */ | 293 | */ |
294 | static inline void | 294 | static inline void |
295 | set_irq_chained_handler(unsigned int irq, | 295 | set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle) |
296 | irq_flow_handler_t handle) | ||
297 | { | 296 | { |
298 | __set_irq_handler(irq, handle, 1, NULL); | 297 | __set_irq_handler(irq, handle, 1, NULL); |
299 | } | 298 | } |
@@ -312,12 +311,12 @@ static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr) | |||
312 | irq_modify_status(irq, clr, 0); | 311 | irq_modify_status(irq, clr, 0); |
313 | } | 312 | } |
314 | 313 | ||
315 | static inline void set_irq_noprobe(unsigned int irq) | 314 | static inline void irq_set_noprobe(unsigned int irq) |
316 | { | 315 | { |
317 | irq_modify_status(irq, 0, IRQ_NOPROBE); | 316 | irq_modify_status(irq, 0, IRQ_NOPROBE); |
318 | } | 317 | } |
319 | 318 | ||
320 | static inline void set_irq_probe(unsigned int irq) | 319 | static inline void irq_set_probe(unsigned int irq) |
321 | { | 320 | { |
322 | irq_modify_status(irq, IRQ_NOPROBE, 0); | 321 | irq_modify_status(irq, IRQ_NOPROBE, 0); |
323 | } | 322 | } |
@@ -338,14 +337,14 @@ static inline void dynamic_irq_init(unsigned int irq) | |||
338 | } | 337 | } |
339 | 338 | ||
340 | /* Set/get chip/data for an IRQ: */ | 339 | /* Set/get chip/data for an IRQ: */ |
341 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); | 340 | extern int irq_set_chip(unsigned int irq, struct irq_chip *chip); |
342 | extern int set_irq_data(unsigned int irq, void *data); | 341 | extern int irq_set_handler_data(unsigned int irq, void *data); |
343 | extern int set_irq_chip_data(unsigned int irq, void *data); | 342 | extern int irq_set_chip_data(unsigned int irq, void *data); |
344 | extern int set_irq_type(unsigned int irq, unsigned int type); | 343 | extern int irq_set_irq_type(unsigned int irq, unsigned int type); |
345 | extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | 344 | extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry); |
346 | extern struct irq_data *irq_get_irq_data(unsigned int irq); | 345 | extern struct irq_data *irq_get_irq_data(unsigned int irq); |
347 | 346 | ||
348 | static inline struct irq_chip *get_irq_chip(unsigned int irq) | 347 | static inline struct irq_chip *irq_get_chip(unsigned int irq) |
349 | { | 348 | { |
350 | struct irq_data *d = irq_get_irq_data(irq); | 349 | struct irq_data *d = irq_get_irq_data(irq); |
351 | return d ? d->chip : NULL; | 350 | return d ? d->chip : NULL; |
@@ -356,7 +355,7 @@ static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d) | |||
356 | return d->chip; | 355 | return d->chip; |
357 | } | 356 | } |
358 | 357 | ||
359 | static inline void *get_irq_chip_data(unsigned int irq) | 358 | static inline void *irq_get_chip_data(unsigned int irq) |
360 | { | 359 | { |
361 | struct irq_data *d = irq_get_irq_data(irq); | 360 | struct irq_data *d = irq_get_irq_data(irq); |
362 | return d ? d->chip_data : NULL; | 361 | return d ? d->chip_data : NULL; |
@@ -367,18 +366,18 @@ static inline void *irq_data_get_irq_chip_data(struct irq_data *d) | |||
367 | return d->chip_data; | 366 | return d->chip_data; |
368 | } | 367 | } |
369 | 368 | ||
370 | static inline void *get_irq_data(unsigned int irq) | 369 | static inline void *irq_get_handler_data(unsigned int irq) |
371 | { | 370 | { |
372 | struct irq_data *d = irq_get_irq_data(irq); | 371 | struct irq_data *d = irq_get_irq_data(irq); |
373 | return d ? d->handler_data : NULL; | 372 | return d ? d->handler_data : NULL; |
374 | } | 373 | } |
375 | 374 | ||
376 | static inline void *irq_data_get_irq_data(struct irq_data *d) | 375 | static inline void *irq_data_get_irq_handler_data(struct irq_data *d) |
377 | { | 376 | { |
378 | return d->handler_data; | 377 | return d->handler_data; |
379 | } | 378 | } |
380 | 379 | ||
381 | static inline struct msi_desc *get_irq_msi(unsigned int irq) | 380 | static inline struct msi_desc *irq_get_msi_desc(unsigned int irq) |
382 | { | 381 | { |
383 | struct irq_data *d = irq_get_irq_data(irq); | 382 | struct irq_data *d = irq_get_irq_data(irq); |
384 | return d ? d->msi_desc : NULL; | 383 | return d ? d->msi_desc : NULL; |
@@ -389,6 +388,58 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d) | |||
389 | return d->msi_desc; | 388 | return d->msi_desc; |
390 | } | 389 | } |
391 | 390 | ||
391 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
392 | /* Please do not use: Use the replacement functions instead */ | ||
393 | static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip) | ||
394 | { | ||
395 | return irq_set_chip(irq, chip); | ||
396 | } | ||
397 | static inline int set_irq_data(unsigned int irq, void *data) | ||
398 | { | ||
399 | return irq_set_handler_data(irq, data); | ||
400 | } | ||
401 | static inline int set_irq_chip_data(unsigned int irq, void *data) | ||
402 | { | ||
403 | return irq_set_chip_data(irq, data); | ||
404 | } | ||
405 | static inline int set_irq_type(unsigned int irq, unsigned int type) | ||
406 | { | ||
407 | return irq_set_irq_type(irq, type); | ||
408 | } | ||
409 | static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry) | ||
410 | { | ||
411 | return irq_set_msi_desc(irq, entry); | ||
412 | } | ||
413 | static inline struct irq_chip *get_irq_chip(unsigned int irq) | ||
414 | { | ||
415 | return irq_get_chip(irq); | ||
416 | } | ||
417 | static inline void *get_irq_chip_data(unsigned int irq) | ||
418 | { | ||
419 | return irq_get_chip_data(irq); | ||
420 | } | ||
421 | static inline void *get_irq_data(unsigned int irq) | ||
422 | { | ||
423 | return irq_get_handler_data(irq); | ||
424 | } | ||
425 | static inline void *irq_data_get_irq_data(struct irq_data *d) | ||
426 | { | ||
427 | return irq_data_get_irq_handler_data(d); | ||
428 | } | ||
429 | static inline struct msi_desc *get_irq_msi(unsigned int irq) | ||
430 | { | ||
431 | return irq_get_msi_desc(irq); | ||
432 | } | ||
433 | static inline void set_irq_noprobe(unsigned int irq) | ||
434 | { | ||
435 | irq_set_noprobe(irq); | ||
436 | } | ||
437 | static inline void set_irq_probe(unsigned int irq) | ||
438 | { | ||
439 | irq_set_probe(irq); | ||
440 | } | ||
441 | #endif | ||
442 | |||
392 | int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); | 443 | int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node); |
393 | void irq_free_descs(unsigned int irq, unsigned int cnt); | 444 | void irq_free_descs(unsigned int irq, unsigned int cnt); |
394 | int irq_reserve_irqs(unsigned int from, unsigned int cnt); | 445 | int irq_reserve_irqs(unsigned int from, unsigned int cnt); |
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index bfef56dadddb..64794dec93b6 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h | |||
@@ -98,10 +98,46 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node) | |||
98 | 98 | ||
99 | #ifdef CONFIG_GENERIC_HARDIRQS | 99 | #ifdef CONFIG_GENERIC_HARDIRQS |
100 | 100 | ||
101 | #define get_irq_desc_chip(desc) ((desc)->irq_data.chip) | 101 | static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) |
102 | #define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data) | 102 | { |
103 | #define get_irq_desc_data(desc) ((desc)->irq_data.handler_data) | 103 | return desc->irq_data.chip; |
104 | #define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc) | 104 | } |
105 | |||
106 | static inline void *irq_desc_get_chip_data(struct irq_desc *desc) | ||
107 | { | ||
108 | return desc->irq_data.chip_data; | ||
109 | } | ||
110 | |||
111 | static inline void *irq_desc_get_handler_data(struct irq_desc *desc) | ||
112 | { | ||
113 | return desc->irq_data.handler_data; | ||
114 | } | ||
115 | |||
116 | static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) | ||
117 | { | ||
118 | return desc->irq_data.msi_desc; | ||
119 | } | ||
120 | |||
121 | #ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT | ||
122 | static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc) | ||
123 | { | ||
124 | return irq_desc_get_chip(desc); | ||
125 | } | ||
126 | static inline void *get_irq_desc_data(struct irq_desc *desc) | ||
127 | { | ||
128 | return irq_desc_get_handler_data(desc); | ||
129 | } | ||
130 | |||
131 | static inline void *get_irq_desc_chip_data(struct irq_desc *desc) | ||
132 | { | ||
133 | return irq_desc_get_chip_data(desc); | ||
134 | } | ||
135 | |||
136 | static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc) | ||
137 | { | ||
138 | return irq_desc_get_msi_desc(desc); | ||
139 | } | ||
140 | #endif | ||
105 | 141 | ||
106 | /* | 142 | /* |
107 | * Architectures call this to let the generic IRQ layer | 143 | * Architectures call this to let the generic IRQ layer |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 9639ab8bece0..622b55ac0e09 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -19,11 +19,11 @@ | |||
19 | #include "internals.h" | 19 | #include "internals.h" |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * set_irq_chip - set the irq chip for an irq | 22 | * irq_set_chip - set the irq chip for an irq |
23 | * @irq: irq number | 23 | * @irq: irq number |
24 | * @chip: pointer to irq chip description structure | 24 | * @chip: pointer to irq chip description structure |
25 | */ | 25 | */ |
26 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) | 26 | int irq_set_chip(unsigned int irq, struct irq_chip *chip) |
27 | { | 27 | { |
28 | struct irq_desc *desc = irq_to_desc(irq); | 28 | struct irq_desc *desc = irq_to_desc(irq); |
29 | unsigned long flags; | 29 | unsigned long flags; |
@@ -43,14 +43,14 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip) | |||
43 | 43 | ||
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | EXPORT_SYMBOL(set_irq_chip); | 46 | EXPORT_SYMBOL(irq_set_chip); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * set_irq_type - set the irq trigger type for an irq | 49 | * irq_set_type - set the irq trigger type for an irq |
50 | * @irq: irq number | 50 | * @irq: irq number |
51 | * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h | 51 | * @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h |
52 | */ | 52 | */ |
53 | int set_irq_type(unsigned int irq, unsigned int type) | 53 | int irq_set_irq_type(unsigned int irq, unsigned int type) |
54 | { | 54 | { |
55 | struct irq_desc *desc = irq_to_desc(irq); | 55 | struct irq_desc *desc = irq_to_desc(irq); |
56 | unsigned long flags; | 56 | unsigned long flags; |
@@ -72,16 +72,16 @@ int set_irq_type(unsigned int irq, unsigned int type) | |||
72 | chip_bus_sync_unlock(desc); | 72 | chip_bus_sync_unlock(desc); |
73 | return ret; | 73 | return ret; |
74 | } | 74 | } |
75 | EXPORT_SYMBOL(set_irq_type); | 75 | EXPORT_SYMBOL(irq_set_irq_type); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * set_irq_data - set irq type data for an irq | 78 | * irq_set_handler_data - set irq handler data for an irq |
79 | * @irq: Interrupt number | 79 | * @irq: Interrupt number |
80 | * @data: Pointer to interrupt specific data | 80 | * @data: Pointer to interrupt specific data |
81 | * | 81 | * |
82 | * Set the hardware irq controller data for an irq | 82 | * Set the hardware irq controller data for an irq |
83 | */ | 83 | */ |
84 | int set_irq_data(unsigned int irq, void *data) | 84 | int irq_set_handler_data(unsigned int irq, void *data) |
85 | { | 85 | { |
86 | struct irq_desc *desc = irq_to_desc(irq); | 86 | struct irq_desc *desc = irq_to_desc(irq); |
87 | unsigned long flags; | 87 | unsigned long flags; |
@@ -97,16 +97,16 @@ int set_irq_data(unsigned int irq, void *data) | |||
97 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 97 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
100 | EXPORT_SYMBOL(set_irq_data); | 100 | EXPORT_SYMBOL(irq_set_handler_data); |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * set_irq_msi - set MSI descriptor data for an irq | 103 | * irq_set_msi_desc - set MSI descriptor data for an irq |
104 | * @irq: Interrupt number | 104 | * @irq: Interrupt number |
105 | * @entry: Pointer to MSI descriptor data | 105 | * @entry: Pointer to MSI descriptor data |
106 | * | 106 | * |
107 | * Set the MSI descriptor entry for an irq | 107 | * Set the MSI descriptor entry for an irq |
108 | */ | 108 | */ |
109 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) | 109 | int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry) |
110 | { | 110 | { |
111 | struct irq_desc *desc = irq_to_desc(irq); | 111 | struct irq_desc *desc = irq_to_desc(irq); |
112 | unsigned long flags; | 112 | unsigned long flags; |
@@ -126,13 +126,13 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * set_irq_chip_data - set irq chip data for an irq | 129 | * irq_set_chip_data - set irq chip data for an irq |
130 | * @irq: Interrupt number | 130 | * @irq: Interrupt number |
131 | * @data: Pointer to chip specific data | 131 | * @data: Pointer to chip specific data |
132 | * | 132 | * |
133 | * Set the hardware irq chip data for an irq | 133 | * Set the hardware irq chip data for an irq |
134 | */ | 134 | */ |
135 | int set_irq_chip_data(unsigned int irq, void *data) | 135 | int irq_set_chip_data(unsigned int irq, void *data) |
136 | { | 136 | { |
137 | struct irq_desc *desc = irq_to_desc(irq); | 137 | struct irq_desc *desc = irq_to_desc(irq); |
138 | unsigned long flags; | 138 | unsigned long flags; |
@@ -154,7 +154,7 @@ int set_irq_chip_data(unsigned int irq, void *data) | |||
154 | 154 | ||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | EXPORT_SYMBOL(set_irq_chip_data); | 157 | EXPORT_SYMBOL(irq_set_chip_data); |
158 | 158 | ||
159 | struct irq_data *irq_get_irq_data(unsigned int irq) | 159 | struct irq_data *irq_get_irq_data(unsigned int irq) |
160 | { | 160 | { |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index a400db220cf3..b1b4da9446e6 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -434,7 +434,7 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | /** | 436 | /** |
437 | * set_irq_wake - control irq power management wakeup | 437 | * irq_set_irq_wake - control irq power management wakeup |
438 | * @irq: interrupt to control | 438 | * @irq: interrupt to control |
439 | * @on: enable/disable power management wakeup | 439 | * @on: enable/disable power management wakeup |
440 | * | 440 | * |
@@ -445,7 +445,7 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on) | |||
445 | * Wakeup mode lets this IRQ wake the system from sleep | 445 | * Wakeup mode lets this IRQ wake the system from sleep |
446 | * states like "suspend to RAM". | 446 | * states like "suspend to RAM". |
447 | */ | 447 | */ |
448 | int set_irq_wake(unsigned int irq, unsigned int on) | 448 | int irq_set_irq_wake(unsigned int irq, unsigned int on) |
449 | { | 449 | { |
450 | struct irq_desc *desc = irq_to_desc(irq); | 450 | struct irq_desc *desc = irq_to_desc(irq); |
451 | unsigned long flags; | 451 | unsigned long flags; |
@@ -480,7 +480,7 @@ int set_irq_wake(unsigned int irq, unsigned int on) | |||
480 | chip_bus_sync_unlock(desc); | 480 | chip_bus_sync_unlock(desc); |
481 | return ret; | 481 | return ret; |
482 | } | 482 | } |
483 | EXPORT_SYMBOL(set_irq_wake); | 483 | EXPORT_SYMBOL(irq_set_irq_wake); |
484 | 484 | ||
485 | /* | 485 | /* |
486 | * Internal function that tells the architecture code whether a | 486 | * Internal function that tells the architecture code whether a |