Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
manage.c File Reference
#include <linux/irq.h>
#include <linux/kthread.h>
#include <linux/module.h>
#include <linux/random.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/task_work.h>
#include "internals.h"

Go to the source code of this file.

Macros

#define pr_fmt(fmt)   "genirq: " fmt
 

Functions

void synchronize_irq (unsigned int irq)
 
 EXPORT_SYMBOL (synchronize_irq)
 
void __disable_irq (struct irq_desc *desc, unsigned int irq, bool suspend)
 
void disable_irq_nosync (unsigned int irq)
 
 EXPORT_SYMBOL (disable_irq_nosync)
 
void disable_irq (unsigned int irq)
 
 EXPORT_SYMBOL (disable_irq)
 
void __enable_irq (struct irq_desc *desc, unsigned int irq, bool resume)
 
void enable_irq (unsigned int irq)
 
 EXPORT_SYMBOL (enable_irq)
 
int irq_set_irq_wake (unsigned int irq, unsigned int on)
 
 EXPORT_SYMBOL (irq_set_irq_wake)
 
int can_request_irq (unsigned int irq, unsigned long irqflags)
 
int __irq_set_trigger (struct irq_desc *desc, unsigned int irq, unsigned long flags)
 
int setup_irq (unsigned int irq, struct irqaction *act)
 
 EXPORT_SYMBOL_GPL (setup_irq)
 
void remove_irq (unsigned int irq, struct irqaction *act)
 
 EXPORT_SYMBOL_GPL (remove_irq)
 
void free_irq (unsigned int irq, void *dev_id)
 
 EXPORT_SYMBOL (free_irq)
 
int request_threaded_irq (unsigned int irq, irq_handler_t handler, irq_handler_t thread_fn, unsigned long irqflags, const char *devname, void *dev_id)
 
 EXPORT_SYMBOL (request_threaded_irq)
 
: An ascii name for the claiming device

request_any_context_irq - allocate an interrupt line : Interrupt line to allocate : Function to be called when the IRQ occurs. Threaded handler for threaded interrupts. : Interrupt type flags

: A cookie passed back to the handler function

This call allocates interrupt resources and enables the interrupt line and IRQ handling. It selects either a hardirq or threaded handling method depending on the context.

On failure, it returns a negative value. On success, it returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.

int request_any_context_irq (unsigned int irq, irq_handler_t handler, unsigned long flags, const char *name, void *dev_id)
 
 EXPORT_SYMBOL_GPL (request_any_context_irq)
 
void enable_percpu_irq (unsigned int irq, unsigned int type)
 
void disable_percpu_irq (unsigned int irq)
 
void remove_percpu_irq (unsigned int irq, struct irqaction *act)
 
void free_percpu_irq (unsigned int irq, void __percpu *dev_id)
 
int setup_percpu_irq (unsigned int irq, struct irqaction *act)
 
int request_percpu_irq (unsigned int irq, irq_handler_t handler, const char *devname, void __percpu *dev_id)
 

Macro Definition Documentation

#define pr_fmt (   fmt)    "genirq: " fmt

Definition at line 10 of file manage.c.

Function Documentation

void __disable_irq ( struct irq_desc desc,
unsigned int  irq,
bool  suspend 
)

Definition at line 359 of file manage.c.

void __enable_irq ( struct irq_desc desc,
unsigned int  irq,
bool  resume 
)

Definition at line 419 of file manage.c.

int __irq_set_trigger ( struct irq_desc desc,
unsigned int  irq,
unsigned long  flags 
)

Definition at line 565 of file manage.c.

int can_request_irq ( unsigned int  irq,
unsigned long  irqflags 
)

Definition at line 547 of file manage.c.

void disable_irq ( unsigned int  irq)

disable_irq - disable an irq and wait for completion : Interrupt to disable

Disable the selected interrupt line. Enables and Disables are nested. This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.

This function may be called - with care - from IRQ context.

Definition at line 412 of file manage.c.

void disable_irq_nosync ( unsigned int  irq)

disable_irq_nosync - disable an irq without waiting : Interrupt to disable

Disable the selected interrupt line. Disables and Enables are nested. Unlike disable_irq(), this function does not ensure existing instances of the IRQ handler have completed before returning.

This function may be called from IRQ context.

Definition at line 394 of file manage.c.

void disable_percpu_irq ( unsigned int  irq)

Definition at line 1491 of file manage.c.

void enable_irq ( unsigned int  irq)

enable_irq - enable handling of an irq : Interrupt to enable

Undoes the effect of one call to disable_irq(). If this matches the last disable, processing of interrupts on this IRQ line is re-enabled.

This function may be called from IRQ context only when desc->irq_data.chip->bus_lock and desc->chip->bus_sync_unlock are NULL !

Definition at line 463 of file manage.c.

void enable_percpu_irq ( unsigned int  irq,
unsigned int  type 
)

Definition at line 1465 of file manage.c.

EXPORT_SYMBOL ( synchronize_irq  )
EXPORT_SYMBOL ( disable_irq_nosync  )
EXPORT_SYMBOL ( disable_irq  )
EXPORT_SYMBOL ( enable_irq  )
EXPORT_SYMBOL ( irq_set_irq_wake  )
EXPORT_SYMBOL ( free_irq  )
EXPORT_SYMBOL ( request_threaded_irq  )
EXPORT_SYMBOL_GPL ( setup_irq  )
EXPORT_SYMBOL_GPL ( remove_irq  )
EXPORT_SYMBOL_GPL ( request_any_context_irq  )
void free_irq ( unsigned int  irq,
void dev_id 
)

free_irq - free an interrupt allocated with request_irq : Interrupt line to free : Device identity to free

Remove an interrupt handler. The handler is removed and if the interrupt line is no longer in use by any driver it is disabled. On a shared IRQ the caller must ensure the interrupt is disabled on the card it drives before calling this function. The function does not return until any executing interrupts for this IRQ have completed.

This function must not be called from interrupt context.

Definition at line 1297 of file manage.c.

void free_percpu_irq ( unsigned int  irq,
void __percpu dev_id 
)

free_percpu_irq - free an interrupt allocated with request_percpu_irq : Interrupt line to free : Device identity to free

Remove a percpu interrupt handler. The handler is removed, but the interrupt line is not disabled. This must be done on each CPU before calling this function. The function does not return until any executing interrupts for this IRQ have completed.

This function must not be called from interrupt context.

Definition at line 1574 of file manage.c.

int irq_set_irq_wake ( unsigned int  irq,
unsigned int  on 
)

irq_set_irq_wake - control irq power management wakeup : interrupt to control : enable/disable power management wakeup

Enable/disable power management wakeup mode, which is disabled by default. Enables and disables must match, just as they match for non-wakeup mode support.

Wakeup mode lets this IRQ wake the system from sleep states like "suspend to RAM".

Definition at line 506 of file manage.c.

void remove_irq ( unsigned int  irq,
struct irqaction act 
)

remove_irq - free an interrupt : Interrupt line to free : irqaction for the interrupt

Used to remove interrupts statically setup by the early boot process.

Definition at line 1274 of file manage.c.

void remove_percpu_irq ( unsigned int  irq,
struct irqaction act 
)

remove_percpu_irq - free a per-cpu interrupt : Interrupt line to free : irqaction for the interrupt

Used to remove interrupts statically setup by the early boot process.

Definition at line 1554 of file manage.c.

int request_any_context_irq ( unsigned int  irq,
irq_handler_t  handler,
unsigned long  flags,
const char name,
void dev_id 
)

Definition at line 1445 of file manage.c.

int request_percpu_irq ( unsigned int  irq,
irq_handler_t  handler,
const char devname,
void __percpu dev_id 
)

request_percpu_irq - allocate a percpu interrupt line : Interrupt line to allocate : Function to be called when the IRQ occurs. : An ascii name for the claiming device : A percpu cookie passed back to the handler function

This call allocates interrupt resources, but doesn't automatically enable the interrupt. It has to be done on each CPU using enable_percpu_irq().

Dev_id must be globally unique. It is a per-cpu variable, and the handler gets called with the interrupted CPU's instance of that variable.

Definition at line 1622 of file manage.c.

int request_threaded_irq ( unsigned int  irq,
irq_handler_t  handler,
irq_handler_t  thread_fn,
unsigned long  irqflags,
const char devname,
void dev_id 
)

request_threaded_irq - allocate an interrupt line : Interrupt line to allocate : Function to be called when the IRQ occurs. Primary handler for threaded interrupts If NULL and thread_fn != NULL the default primary handler is installed : Function called from the irq handler thread If NULL, no irq thread is created : Interrupt type flags : An ascii name for the claiming device : A cookie passed back to the handler function

This call allocates interrupt resources and enables the interrupt line and IRQ handling. From the point this call is made your handler function may be invoked. Since your handler function must clear any interrupt the board raises, you must take care both to initialise your hardware and to set up the interrupt handler in the right order.

If you want to set up a threaded irq handler for your device then you need to supply and . is still called in hard interrupt context and has to check whether the interrupt originates from the device. If yes it needs to disable the interrupt on the device and return IRQ_WAKE_THREAD which will wake up the handler thread and run . This split handler design is necessary to support shared interrupts.

Dev_id must be globally unique. Normally the address of the device data structure is used as the cookie. Since the handler receives this value it makes sense to use it.

If your interrupt is shared you must pass a non NULL dev_id as this is required when freeing the interrupt.

Flags:

IRQF_SHARED Interrupt is shared IRQF_TRIGGER_* Specify active edge(s) or level

Definition at line 1357 of file manage.c.

int setup_irq ( unsigned int  irq,
struct irqaction act 
)

setup_irq - setup an interrupt : Interrupt line to setup : irqaction for the interrupt

Used to statically setup interrupts in the early boot process.

Definition at line 1170 of file manage.c.

int setup_percpu_irq ( unsigned int  irq,
struct irqaction act 
)

setup_percpu_irq - setup a per-cpu interrupt : Interrupt line to setup : irqaction for the interrupt

Used to statically setup per-cpu interrupts in the early boot process.

Definition at line 1593 of file manage.c.

void synchronize_irq ( unsigned int  irq)

synchronize_irq - wait for pending IRQ handlers (on other CPUs) : interrupt number to wait for

This function waits for any pending IRQ handlers for this interrupt to complete before returning. If you use this function while holding a resource the IRQ handler may need you will deadlock.

This function may be called - with care - from IRQ context.

Definition at line 44 of file manage.c.