[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9924dd54-dd8b-d130-9607-2bbbc65675d5@gmail.com>
Date: Sun, 15 Mar 2020 23:46:33 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] i2c: at91: support atomic write xfer
15.03.2020 21:27, Michał Mirosław пишет:
> Implement basic support for atomic write - enough to get a simple
> write to PMIC on shutdown. Only for chips having ALT_CMD register,
> eg. SAMA5D2.
>
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
Hello Michał,
...
> + ret = pm_runtime_get_sync(dev->dev);
> + if (ret < 0)
> + goto out;
Runtime PM can't be used while interrupts are disabled, unless
pm_runtime_irq_safe() is used and driver's RPM callback is IRQ-safe.
...
> + timeout = jiffies + (2 + msg->len) * HZ/1000;
> + for (;;) {
> + stat = at91_twi_read(dev, AT91_TWI_SR);
> + if (stat & AT91_TWI_TXCOMP)
> + break;
> + if (time_after(jiffies, timeout)) {
> + ret = -ETIMEDOUT;
> + goto out;
> + }
> + udelay(100);
> + }
Jiffies can't be used with the disabled interrupts because jiffies are
updated by timer's interrupt.
Either ktime() API or iterator-based loop should be used.
Powered by blists - more mailing lists