Skip to content

Commit

Permalink
genirq: Namespace cleanup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Gleixner committed Feb 19, 2011
1 parent 43abe43 commit a0cd9ca
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 38 deletions.
14 changes: 11 additions & 3 deletions include/linux/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,24 @@ static inline void enable_irq_lockdep_irqrestore(unsigned int irq, unsigned long
}

/* IRQ wakeup (PM) control: */
extern int set_irq_wake(unsigned int irq, unsigned int on);
extern int irq_set_irq_wake(unsigned int irq, unsigned int on);

#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
/* Please do not use: Use the replacement functions instead */
static inline int set_irq_wake(unsigned int irq, unsigned int on)
{
return irq_set_irq_wake(irq, on);
}
#endif

static inline int enable_irq_wake(unsigned int irq)
{
return set_irq_wake(irq, 1);
return irq_set_irq_wake(irq, 1);
}

static inline int disable_irq_wake(unsigned int irq)
{
return set_irq_wake(irq, 0);
return irq_set_irq_wake(irq, 0);
}

#else /* !CONFIG_GENERIC_HARDIRQS */
Expand Down
79 changes: 65 additions & 14 deletions include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ set_irq_handler(unsigned int irq, irq_flow_handler_t handle)
* IRQ_NOREQUEST and IRQ_NOPROBE)
*/
static inline void
set_irq_chained_handler(unsigned int irq,
irq_flow_handler_t handle)
set_irq_chained_handler(unsigned int irq, irq_flow_handler_t handle)
{
__set_irq_handler(irq, handle, 1, NULL);
}
Expand All @@ -312,12 +311,12 @@ static inline void irq_clear_status_flags(unsigned int irq, unsigned long clr)
irq_modify_status(irq, clr, 0);
}

static inline void set_irq_noprobe(unsigned int irq)
static inline void irq_set_noprobe(unsigned int irq)
{
irq_modify_status(irq, 0, IRQ_NOPROBE);
}

static inline void set_irq_probe(unsigned int irq)
static inline void irq_set_probe(unsigned int irq)
{
irq_modify_status(irq, IRQ_NOPROBE, 0);
}
Expand All @@ -338,14 +337,14 @@ static inline void dynamic_irq_init(unsigned int irq)
}

/* Set/get chip/data for an IRQ: */
extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
extern int set_irq_data(unsigned int irq, void *data);
extern int set_irq_chip_data(unsigned int irq, void *data);
extern int set_irq_type(unsigned int irq, unsigned int type);
extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
extern int irq_set_chip(unsigned int irq, struct irq_chip *chip);
extern int irq_set_handler_data(unsigned int irq, void *data);
extern int irq_set_chip_data(unsigned int irq, void *data);
extern int irq_set_irq_type(unsigned int irq, unsigned int type);
extern int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry);
extern struct irq_data *irq_get_irq_data(unsigned int irq);

static inline struct irq_chip *get_irq_chip(unsigned int irq)
static inline struct irq_chip *irq_get_chip(unsigned int irq)
{
struct irq_data *d = irq_get_irq_data(irq);
return d ? d->chip : NULL;
Expand All @@ -356,7 +355,7 @@ static inline struct irq_chip *irq_data_get_irq_chip(struct irq_data *d)
return d->chip;
}

static inline void *get_irq_chip_data(unsigned int irq)
static inline void *irq_get_chip_data(unsigned int irq)
{
struct irq_data *d = irq_get_irq_data(irq);
return d ? d->chip_data : NULL;
Expand All @@ -367,18 +366,18 @@ static inline void *irq_data_get_irq_chip_data(struct irq_data *d)
return d->chip_data;
}

static inline void *get_irq_data(unsigned int irq)
static inline void *irq_get_handler_data(unsigned int irq)
{
struct irq_data *d = irq_get_irq_data(irq);
return d ? d->handler_data : NULL;
}

static inline void *irq_data_get_irq_data(struct irq_data *d)
static inline void *irq_data_get_irq_handler_data(struct irq_data *d)
{
return d->handler_data;
}

static inline struct msi_desc *get_irq_msi(unsigned int irq)
static inline struct msi_desc *irq_get_msi_desc(unsigned int irq)
{
struct irq_data *d = irq_get_irq_data(irq);
return d ? d->msi_desc : NULL;
Expand All @@ -389,6 +388,58 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
return d->msi_desc;
}

#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
/* Please do not use: Use the replacement functions instead */
static inline int set_irq_chip(unsigned int irq, struct irq_chip *chip)
{
return irq_set_chip(irq, chip);
}
static inline int set_irq_data(unsigned int irq, void *data)
{
return irq_set_handler_data(irq, data);
}
static inline int set_irq_chip_data(unsigned int irq, void *data)
{
return irq_set_chip_data(irq, data);
}
static inline int set_irq_type(unsigned int irq, unsigned int type)
{
return irq_set_irq_type(irq, type);
}
static inline int set_irq_msi(unsigned int irq, struct msi_desc *entry)
{
return irq_set_msi_desc(irq, entry);
}
static inline struct irq_chip *get_irq_chip(unsigned int irq)
{
return irq_get_chip(irq);
}
static inline void *get_irq_chip_data(unsigned int irq)
{
return irq_get_chip_data(irq);
}
static inline void *get_irq_data(unsigned int irq)
{
return irq_get_handler_data(irq);
}
static inline void *irq_data_get_irq_data(struct irq_data *d)
{
return irq_data_get_irq_handler_data(d);
}
static inline struct msi_desc *get_irq_msi(unsigned int irq)
{
return irq_get_msi_desc(irq);
}
static inline void set_irq_noprobe(unsigned int irq)
{
irq_set_noprobe(irq);
}
static inline void set_irq_probe(unsigned int irq)
{
irq_set_probe(irq);
}
#endif

int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node);
void irq_free_descs(unsigned int irq, unsigned int cnt);
int irq_reserve_irqs(unsigned int from, unsigned int cnt);
Expand Down
44 changes: 40 additions & 4 deletions include/linux/irqdesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,46 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)

#ifdef CONFIG_GENERIC_HARDIRQS

#define get_irq_desc_chip(desc) ((desc)->irq_data.chip)
#define get_irq_desc_chip_data(desc) ((desc)->irq_data.chip_data)
#define get_irq_desc_data(desc) ((desc)->irq_data.handler_data)
#define get_irq_desc_msi(desc) ((desc)->irq_data.msi_desc)
static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc)
{
return desc->irq_data.chip;
}

static inline void *irq_desc_get_chip_data(struct irq_desc *desc)
{
return desc->irq_data.chip_data;
}

static inline void *irq_desc_get_handler_data(struct irq_desc *desc)
{
return desc->irq_data.handler_data;
}

static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
{
return desc->irq_data.msi_desc;
}

#ifndef CONFIG_GENERIC_HARDIRQS_NO_COMPAT
static inline struct irq_chip *get_irq_desc_chip(struct irq_desc *desc)
{
return irq_desc_get_chip(desc);
}
static inline void *get_irq_desc_data(struct irq_desc *desc)
{
return irq_desc_get_handler_data(desc);
}

static inline void *get_irq_desc_chip_data(struct irq_desc *desc)
{
return irq_desc_get_chip_data(desc);
}

static inline struct msi_desc *get_irq_desc_msi(struct irq_desc *desc)
{
return irq_desc_get_msi_desc(desc);
}
#endif

/*
* Architectures call this to let the generic IRQ layer
Expand Down
28 changes: 14 additions & 14 deletions kernel/irq/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
#include "internals.h"

/**
* set_irq_chip - set the irq chip for an irq
* irq_set_chip - set the irq chip for an irq
* @irq: irq number
* @chip: pointer to irq chip description structure
*/
int set_irq_chip(unsigned int irq, struct irq_chip *chip)
int irq_set_chip(unsigned int irq, struct irq_chip *chip)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand All @@ -43,14 +43,14 @@ int set_irq_chip(unsigned int irq, struct irq_chip *chip)

return 0;
}
EXPORT_SYMBOL(set_irq_chip);
EXPORT_SYMBOL(irq_set_chip);

/**
* set_irq_type - set the irq trigger type for an irq
* irq_set_type - set the irq trigger type for an irq
* @irq: irq number
* @type: IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
*/
int set_irq_type(unsigned int irq, unsigned int type)
int irq_set_irq_type(unsigned int irq, unsigned int type)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand All @@ -72,16 +72,16 @@ int set_irq_type(unsigned int irq, unsigned int type)
chip_bus_sync_unlock(desc);
return ret;
}
EXPORT_SYMBOL(set_irq_type);
EXPORT_SYMBOL(irq_set_irq_type);

/**
* set_irq_data - set irq type data for an irq
* irq_set_handler_data - set irq handler data for an irq
* @irq: Interrupt number
* @data: Pointer to interrupt specific data
*
* Set the hardware irq controller data for an irq
*/
int set_irq_data(unsigned int irq, void *data)
int irq_set_handler_data(unsigned int irq, void *data)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand All @@ -97,16 +97,16 @@ int set_irq_data(unsigned int irq, void *data)
raw_spin_unlock_irqrestore(&desc->lock, flags);
return 0;
}
EXPORT_SYMBOL(set_irq_data);
EXPORT_SYMBOL(irq_set_handler_data);

/**
* set_irq_msi - set MSI descriptor data for an irq
* irq_set_msi_desc - set MSI descriptor data for an irq
* @irq: Interrupt number
* @entry: Pointer to MSI descriptor data
*
* Set the MSI descriptor entry for an irq
*/
int set_irq_msi(unsigned int irq, struct msi_desc *entry)
int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand All @@ -126,13 +126,13 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry)
}

/**
* set_irq_chip_data - set irq chip data for an irq
* irq_set_chip_data - set irq chip data for an irq
* @irq: Interrupt number
* @data: Pointer to chip specific data
*
* Set the hardware irq chip data for an irq
*/
int set_irq_chip_data(unsigned int irq, void *data)
int irq_set_chip_data(unsigned int irq, void *data)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand All @@ -154,7 +154,7 @@ int set_irq_chip_data(unsigned int irq, void *data)

return 0;
}
EXPORT_SYMBOL(set_irq_chip_data);
EXPORT_SYMBOL(irq_set_chip_data);

struct irq_data *irq_get_irq_data(unsigned int irq)
{
Expand Down
6 changes: 3 additions & 3 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
}

/**
* set_irq_wake - control irq power management wakeup
* irq_set_irq_wake - control irq power management wakeup
* @irq: interrupt to control
* @on: enable/disable power management wakeup
*
Expand All @@ -445,7 +445,7 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
* Wakeup mode lets this IRQ wake the system from sleep
* states like "suspend to RAM".
*/
int set_irq_wake(unsigned int irq, unsigned int on)
int irq_set_irq_wake(unsigned int irq, unsigned int on)
{
struct irq_desc *desc = irq_to_desc(irq);
unsigned long flags;
Expand Down Expand Up @@ -480,7 +480,7 @@ int set_irq_wake(unsigned int irq, unsigned int on)
chip_bus_sync_unlock(desc);
return ret;
}
EXPORT_SYMBOL(set_irq_wake);
EXPORT_SYMBOL(irq_set_irq_wake);

/*
* Internal function that tells the architecture code whether a
Expand Down

0 comments on commit a0cd9ca

Please sign in to comment.