[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210719094156.GB431@lst.de>
Date: Mon, 19 Jul 2021 11:41:56 +0200
From: Christoph Hellwig <hch@....de>
To: Ming Lei <ming.lei@...hat.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
Bjorn Helgaas <helgaas@...nel.org>, linux-pci@...r.kernel.org,
Christoph Hellwig <hch@....de>
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.
Powered by blists - more mailing lists