public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Mikko Perttunen <mperttunen@nvidia.com>,
	ldewangan@nvidia.com, thierry.reding@gmail.com,
	jonathanh@nvidia.com, wsa@kernel.org
Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] i2c: tegra: Wait for config load atomically while in ISR
Date: Tue, 12 Jan 2021 09:48:20 +0300	[thread overview]
Message-ID: <cb37f001-da0d-fcef-dea8-258caf5687fe@gmail.com> (raw)
In-Reply-To: <a3b6944a-7c1e-54bf-664d-0ee6a6de4deb@gmail.com>

11.01.2021 22:31, Dmitry Osipenko пишет:
> 11.01.2021 19:08, Mikko Perttunen пишет:
>> Upon a communication error, the interrupt handler can call
>> tegra_i2c_disable_packet_mode. This causes a sleeping poll to happen
>> unless the current transaction was marked atomic. Fix this by
>> making the poll happen atomically if we are in an IRQ.
>>
>> This matches the behavior prior to the patch mentioned
>> in the Fixes tag.
>>
>> Fixes: ede2299f7101 ("i2c: tegra: Support atomic transfers")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
>> ---
>> v2:
>> * Use in_irq() instead of passing a flag from the ISR.
>>   Thanks to Dmitry for the suggestion.
>> * Update commit message.
>> ---
>>  drivers/i2c/busses/i2c-tegra.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
>> index 6f08c0c3238d..0727383f4940 100644
>> --- a/drivers/i2c/busses/i2c-tegra.c
>> +++ b/drivers/i2c/busses/i2c-tegra.c
>> @@ -533,7 +533,7 @@ static int tegra_i2c_poll_register(struct tegra_i2c_dev *i2c_dev,
>>  	void __iomem *addr = i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg);
>>  	u32 val;
>>  
>> -	if (!i2c_dev->atomic_mode)
>> +	if (!i2c_dev->atomic_mode && !in_irq())
>>  		return readl_relaxed_poll_timeout(addr, val, !(val & mask),
>>  						  delay_us, timeout_us);
>>  
>>
> 
> Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
> 

Perhaps a follow up change could be to use a threaded interrupt context,
I'll type a patch for that.

  reply	other threads:[~2021-01-12  6:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 16:08 [PATCH v2] i2c: tegra: Wait for config load atomically while in ISR Mikko Perttunen
2021-01-11 19:31 ` Dmitry Osipenko
2021-01-12  6:48   ` Dmitry Osipenko [this message]
2021-01-11 21:40 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb37f001-da0d-fcef-dea8-258caf5687fe@gmail.com \
    --to=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mperttunen@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox