[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3rteX8N2A-K-8bmvWaUhLJjXLV_8JNLCY0ezBzkQODUg@mail.gmail.com>
Date: Thu, 25 Aug 2022 14:29:21 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Arminder Singh <arminders208@...look.com>
Cc: linux-kernel@...r.kernel.org, Sven Peter <sven@...npeter.dev>,
Alyssa Rosenzweig <alyssa@...enzweig.io>,
Hector Martin <marcan@...can.st>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH] i2c: pasemi: Add IRQ support for Apple Silicon
On Sat, Aug 20, 2022 at 9:45 PM Arminder Singh <arminders208@...look.com> wrote:
>
> I also fixed a quick checkpatch warning on line 303. "i ++" is now "i++".
In general, anything that is mentioned in the changelog as "also done this"
is worth splitting into a separate patch, or dropping from the patch, to
make reviewing easier.
In this case, I would just not do the trivial change. Alternatively you
can consider doing a larger patch for coding style cleanup on the
patch, as there are possibly other issues as well. Usually it's not worth
changing things unless they hurt readability.
> @@ -80,14 +81,21 @@ static int pasemi_smb_waitready(struct pasemi_smbus *smbus)
> {
> int timeout = 10;
> unsigned int status;
> + unsigned int bitmask = SMSTA_XEN | SMSTA_MTN;
>
> + if (smbus->use_irq) {
> + reinit_completion(&smbus->irq_completion);
> + reg_write(smbus, REG_IMASK, bitmask);
> + wait_for_completion_timeout(&smbus->irq_completion, msecs_to_jiffies(10));
> status = reg_read(smbus, REG_SMSTA);
> }
>
> +
> /* Got NACK? */
> if (status & SMSTA_MTN)
> return -ENXIO;
...
> @@ -356,3 +366,12 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus)
>
> return 0;
> }
> +
> +irqreturn_t pasemi_irq_handler(int irq, void *dev_id)
> +{
> + struct pasemi_smbus *smbus = (struct pasemi_smbus *)dev_id;
> +
> + reg_write(smbus, REG_IMASK, 0);
> + complete(&smbus->irq_completion);
> + return IRQ_HANDLED;
> +}
I think the completion structure gets out of sync if you run into a
timeout here,
so a subsequent wait_for_completion will never complete after we missed one
interrupt.
Since this already causes a bus reset, I think you can just do
reinit_completion() at the end of pasemi_reset() to avoid this.
Arnd
Powered by blists - more mailing lists