Messages in this thread | | | Date | Mon, 19 Jul 2021 11:41:56 +0200 | From | Christoph Hellwig <> | Subject | Re: [PATCH] genirq/affinity: add helper of irq_affinity_calc_sets |
| |
On Thu, Jul 15, 2021 at 07:18:27PM +0800, Ming Lei wrote: > + WARN_ON_ONCE(irq_affinity_calc_sets(1, affd));
Hiding actual functionality inside a WARN_ON is nasty.
> +int irq_affinity_calc_sets(unsigned int affvecs, struct irq_affinity *affd) > +{ > + /* > + * 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);
I'm not sure a function like this should have side effects. Either we move the assign to an init function with a single caller, or do an if / else here.
| |