Skip to content

Commit

Permalink
genirq: Move status flag checks to core
Browse files Browse the repository at this point in the history
These checks are used by modules and prevent the removal of the export of
irq_to_desc(). Move the accessor into the core.

Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
KAGA-KOKO committed Dec 15, 2020
1 parent a313357 commit fdd0296
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
17 changes: 5 additions & 12 deletions include/linux/irqdesc.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,28 +223,21 @@ irq_set_chip_handler_name_locked(struct irq_data *data, struct irq_chip *chip,
data->chip = chip;
}

bool irq_check_status_bit(unsigned int irq, unsigned int bitmask);

static inline bool irq_balancing_disabled(unsigned int irq)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);
return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;
return irq_check_status_bit(irq, IRQ_NO_BALANCING_MASK);
}

static inline bool irq_is_percpu(unsigned int irq)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);
return desc->status_use_accessors & IRQ_PER_CPU;
return irq_check_status_bit(irq, IRQ_PER_CPU);
}

static inline bool irq_is_percpu_devid(unsigned int irq)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);
return desc->status_use_accessors & IRQ_PER_CPU_DEVID;
return irq_check_status_bit(irq, IRQ_PER_CPU_DEVID);
}

static inline void
Expand Down
20 changes: 20 additions & 0 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2839,3 +2839,23 @@ bool irq_has_action(unsigned int irq)
return res;
}
EXPORT_SYMBOL_GPL(irq_has_action);

/**
* irq_check_status_bit - Check whether bits in the irq descriptor status are set
* @irq: The linux irq number
* @bitmask: The bitmask to evaluate
*
* Returns: True if one of the bits in @bitmask is set
*/
bool irq_check_status_bit(unsigned int irq, unsigned int bitmask)
{
struct irq_desc *desc;
bool res = false;

rcu_read_lock();
desc = irq_to_desc(irq);
if (desc)
res = !!(desc->status_use_accessors & bitmask);
rcu_read_unlock();
return res;
}

0 comments on commit fdd0296

Please sign in to comment.