[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADBw62pFb6aEegTRXS3Y9DeJDTrW4mSHND4nw4p8Qtv-Yk+SNg@mail.gmail.com>
Date: Wed, 1 Jul 2020 22:10:19 +0800
From: Baolin Wang <baolin.wang7@...il.com>
To: Lee Jones <lee.jones@...aro.org>
Cc: linux-arm-kernel@...ts.infradead.org,
LKML <linux-kernel@...r.kernel.org>,
Orson Zhai <orsonzhai@...il.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
Johan Hovold <johan@...nel.org>
Subject: Re: [PATCH] mfd: sprd-sc27xx-spi: Fix-up bogus IRQ register offset
and mask setting
On Wed, Jul 1, 2020 at 5:15 PM Lee Jones <lee.jones@...aro.org> wrote:
>
> 'i / pdata->num_irqs' always equates to 0 and 'BIT(i % pdata->num_irqs)'
> always ends up being BIT(i) here, so make that clearer in the code. If
> the code base needs to support more than 32 IRQs in the future, this will
> have to be reworked, but lets just keep it simple for as long as we can.
>
> This fixes the following W=1 warning:
>
> drivers/mfd/sprd-sc27xx-spi.c:255 sprd_pmic_probe() debug: sval_binop_unsigned: divide by zero
>
> Cc: Orson Zhai <orsonzhai@...il.com>
> Cc: Chunyan Zhang <zhang.lyra@...il.com>
> Cc: Johan Hovold <johan@...nel.org>
> Suggested-by: Baolin Wang <baolin.wang7@...il.com>
> Signed-off-by: Lee Jones <lee.jones@...aro.org>
Thanks.
Reviewed-by: Baolin Wang <baolin.wang7@...il.com>
>
> diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
> index c305e941e435c..4a1a61e1a86ea 100644
> --- a/drivers/mfd/sprd-sc27xx-spi.c
> +++ b/drivers/mfd/sprd-sc27xx-spi.c
> @@ -251,10 +251,8 @@ static int sprd_pmic_probe(struct spi_device *spi)
> return -ENOMEM;
>
> ddata->irq_chip.irqs = ddata->irqs;
> - for (i = 0; i < pdata->num_irqs; i++) {
> - ddata->irqs[i].reg_offset = i / pdata->num_irqs;
> - ddata->irqs[i].mask = BIT(i % pdata->num_irqs);
> - }
> + for (i = 0; i < pdata->num_irqs; i++)
> + ddata->irqs[i].mask = BIT(i);
>
> ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq,
> IRQF_ONESHOT | IRQF_NO_SUSPEND, 0,
--
Baolin Wang
Powered by blists - more mailing lists