@@ -1224,7 +1224,8 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
* for the single interrupt case.
*/
if (affd)
- irq_create_affinity_masks(1, affd);
+ irq_affinity_calc_sets(1, affd);
+
pci_intx(dev, 1);
return 1;
}
@@ -340,6 +340,7 @@ irq_create_affinity_masks(unsigned int nvec, struct irq_affinity *affd);
unsigned int irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
const struct irq_affinity *affd);
+int irq_affinity_calc_sets(unsigned int affvecs, struct irq_affinity *affd);
#else /* CONFIG_SMP */
@@ -391,6 +392,12 @@ irq_calc_affinity_vectors(unsigned int minvec, unsigned int maxvec,
return maxvec;
}
+static inline int irq_affinity_calc_sets(unsigned int affvecs,
+ struct irq_affinity *affd)
+{
+ return 0;
+}
+
#endif /* CONFIG_SMP */
/*
@@ -405,6 +405,22 @@ static void default_calc_sets(struct irq_affinity *affd, unsigned int affvecs)
affd->set_size[0] = affvecs;
}
+int irq_affinity_calc_sets(unsigned int affvecs, struct irq_affinity *affd)
+{
+ /*
+ * Simple invocations do not provide a calc_sets() callback. Call
+ * the generic one.
+ */
+ if (affd->calc_sets)
+ affd->calc_sets(affd, affvecs);
+ else
+ default_calc_sets(affd, affvecs);
+
+ if (WARN_ON_ONCE(affd->nr_sets > IRQ_AFFINITY_MAX_SETS))
+ return -ERANGE;
+ return 0;
+}
+
/**
* irq_create_affinity_masks - Create affinity masks for multiqueue spreading
* @nvecs: The total number of vectors
@@ -429,17 +445,7 @@ irq_create_affinity_masks(unsigned int nvecs, struct irq_affinity *affd)
else
affvecs = 0;
- /*
- * Simple invocations do not provide a calc_sets() callback. Install
- * the generic one.
- */
- if (!affd->calc_sets)
- affd->calc_sets = default_calc_sets;
-
- /* Recalculate the sets */
- affd->calc_sets(affd, affvecs);
-
- if (WARN_ON_ONCE(affd->nr_sets > IRQ_AFFINITY_MAX_SETS))
+ if (irq_affinity_calc_sets(affvecs, affd))
return NULL;
/* Nothing to assign? */