Skip to contentSkip to conversation

genirq: Use cpumask_intersects()

PATCH Applied Costa Shulyupin 2 participants 2 messages Sep 6, 2024 – Sep 8, 2024 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq: Use cpumask_intersects()

Replace cpumask_any_and(a, b) >= nr_cpu_ids and cpumask_any_and(a, b) < nr_cpu_ids with the more readable !cpumask_intersects(a, b) and cpumask_intersects(a, b)

---
 kernel/irq/chip.c      | 2 +-
 kernel/irq/migration.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/irq/chip.c +1 -1
index dc94e0bf2c940..271e9139de77f 100644
@@ -198,7 +198,7 @@ __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
 
 	irqd_clr_managed_shutdown(d);
 
-	if (cpumask_any_and(aff, cpu_online_mask) >= nr_cpu_ids) {
+	if (!cpumask_intersects(aff, cpu_online_mask)) {
 		/*
 		 * Catch code which fiddles with enable_irq() on a managed
 		 * and potentially shutdown IRQ. Chained interrupt
kernel/irq/migration.c +2 -2
index 61ca924ef4b4c..eb150afd671f6 100644
@@ -26,7 +26,7 @@ bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear)
 	 * The outgoing CPU might be the last online target in a pending
 	 * interrupt move. If that's the case clear the pending move bit.
 	 */
-	if (cpumask_any_and(desc->pending_mask, cpu_online_mask) >= nr_cpu_ids) {
+	if (!cpumask_intersects(desc->pending_mask, cpu_online_mask)) {
 		irqd_clr_move_pending(data);
 		return false;
 	}
@@ -74,7 +74,7 @@ void irq_move_masked_irq(struct irq_data *idata)
 	 * For correct operation this depends on the caller
 	 * masking the irqs.
 	 */
-	if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) {
+	if (cpumask_intersects(desc->pending_mask, cpu_online_mask)) {
 		int ret;
 
 		ret = irq_do_set_affinity(data, desc->pending_mask, false);
Signature · 1 line
2.45.0
#1 lore raw
The following commit has been merged into the irq/core branch of tip:

The following commit has been merged into the irq/core branch of tip:

Commit-ID:     a6fe30d1e3657991c832702cecb44576128d7fa3
Gitweb:        https://git.kernel.org/tip/a6fe30d1e3657991c832702cecb44576128d7fa3
Author:        Costa Shulyupin <[email protected]>
AuthorDate:    Fri, 06 Sep 2024 20:01:40 +03:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Sun, 08 Sep 2024 16:06:51 +02:00

genirq: Use cpumask_intersects()

Replace cpumask_any_and(a, b) >= nr_cpu_ids and cpumask_any_and(a, b) < nr_cpu_ids with the more readable !cpumask_intersects(a, b) and cpumask_intersects(a, b)

---
 kernel/irq/chip.c      | 2 +-
 kernel/irq/migration.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
kernel/irq/chip.c +1 -1
index dc94e0b..271e913 100644
@@ -198,7 +198,7 @@ __irq_startup_managed(struct irq_desc *desc, const struct cpumask *aff,
 
 	irqd_clr_managed_shutdown(d);
 
-	if (cpumask_any_and(aff, cpu_online_mask) >= nr_cpu_ids) {
+	if (!cpumask_intersects(aff, cpu_online_mask)) {
 		/*
 		 * Catch code which fiddles with enable_irq() on a managed
 		 * and potentially shutdown IRQ. Chained interrupt
kernel/irq/migration.c +2 -2
index 61ca924..eb150af 100644
@@ -26,7 +26,7 @@ bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear)
 	 * The outgoing CPU might be the last online target in a pending
 	 * interrupt move. If that's the case clear the pending move bit.
 	 */
-	if (cpumask_any_and(desc->pending_mask, cpu_online_mask) >= nr_cpu_ids) {
+	if (!cpumask_intersects(desc->pending_mask, cpu_online_mask)) {
 		irqd_clr_move_pending(data);
 		return false;
 	}
@@ -74,7 +74,7 @@ void irq_move_masked_irq(struct irq_data *idata)
 	 * For correct operation this depends on the caller
 	 * masking the irqs.
 	 */
-	if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) {
+	if (cpumask_intersects(desc->pending_mask, cpu_online_mask)) {
 		int ret;
 
 		ret = irq_do_set_affinity(data, desc->pending_mask, false);