All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Anand Moon" <linux.amoon@gmail.com>
Cc: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
	"Andi Shyti" <andi.shyti@kernel.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Yixun Lan" <dlan@kernel.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
	<spacemit@lists.linux.dev>, "Alex Elder" <elder@riscstar.com>
Subject: Re: [PATCH v1 1/2] i2c: spacemit: Avoid sleeping during bus reset in atomic context
Date: Tue, 10 Nov 2026 06:41:43 +0000	[thread overview]
Message-ID: <DMRBR0ARCU5N.1WRTDA5GN4OG5@linux.spacemit.com> (raw)
In-Reply-To: <20261110061429.2036-1-linux.amoon@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 834 bytes --]

On Tue, 10 Nov 2026 11:44:26 +0530, Anand Moon wrote:
> The spacemit_i2c_conditionally_reset_bus() function uses usleep_range()
> to wait after triggering a bus reset request. However, this function can
> be invoked during atomic I2C transfers (such as power-off or restart
> handlers running in atomic notifier chains), where sleeping is illegal.
>
> Replace the sleep operation with the driver's internal helper,
> spacemit_i2c_delay(), which conditionally uses udelay() when running in
> an atomic context, avoiding "scheduling while atomic" bugs.
This usleep_range() was left behind when the PIO path and
spacemit_i2c_delay() were added, so please add:
Fixes: 5dd75dac1b35 ("i2c: spacemit: introduce pio for k1")

Otherwise, LGTM.
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>

-- 
Troy Mitchell

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Anand Moon" <linux.amoon@gmail.com>
Cc: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>,
	"Andi Shyti" <andi.shyti@kernel.org>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Yixun Lan" <dlan@kernel.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-pm@vger.kernel.org>, <linux-riscv@lists.infradead.org>,
	<spacemit@lists.linux.dev>, "Alex Elder" <elder@riscstar.com>
Subject: Re: [PATCH v1 1/2] i2c: spacemit: Avoid sleeping during bus reset in atomic context
Date: Tue, 10 Nov 2026 06:41:43 +0000	[thread overview]
Message-ID: <DMRBR0ARCU5N.1WRTDA5GN4OG5@linux.spacemit.com> (raw)
In-Reply-To: <20261110061429.2036-1-linux.amoon@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 834 bytes --]

On Tue, 10 Nov 2026 11:44:26 +0530, Anand Moon wrote:
> The spacemit_i2c_conditionally_reset_bus() function uses usleep_range()
> to wait after triggering a bus reset request. However, this function can
> be invoked during atomic I2C transfers (such as power-off or restart
> handlers running in atomic notifier chains), where sleeping is illegal.
>
> Replace the sleep operation with the driver's internal helper,
> spacemit_i2c_delay(), which conditionally uses udelay() when running in
> an atomic context, avoiding "scheduling while atomic" bugs.
This usleep_range() was left behind when the PIO path and
spacemit_i2c_delay() were added, so please add:
Fixes: 5dd75dac1b35 ("i2c: spacemit: introduce pio for k1")

Otherwise, LGTM.
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>

-- 
Troy Mitchell

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2026-11-10  6:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  6:14 [PATCH v1 1/2] i2c: spacemit: Avoid sleeping during bus reset in atomic context Anand Moon
2026-11-10  6:14 ` Anand Moon
2026-11-10  6:14 ` [PATCH v1 2/2] power: reset: spacemit-p1: Use atomic I2C transfers for power-off and restart Anand Moon
2026-11-10  6:14   ` Anand Moon
2026-11-10 21:25   ` Aurelien Jarno
2026-11-10 21:25     ` Aurelien Jarno
2026-11-11  1:16     ` Troy Mitchell
2026-11-11  1:16       ` Troy Mitchell
2026-11-11  9:29       ` Aurelien Jarno
2026-11-11  9:29         ` Aurelien Jarno
2026-11-11 11:05         ` Anand Moon
2026-11-11 11:05           ` Anand Moon
2026-11-10  6:41 ` Troy Mitchell [this message]
2026-11-10  6:41   ` [PATCH v1 1/2] i2c: spacemit: Avoid sleeping during bus reset in atomic context Troy Mitchell
2026-11-10  6:49 ` Troy Mitchell
2026-11-10  6:49   ` Troy Mitchell
2026-11-10  7:04   ` Anand Moon
2026-11-10  7:04     ` Anand Moon
2026-11-10 20:49 ` Aurelien Jarno
2026-11-10 20:49   ` Aurelien Jarno
2026-11-10 21:15 ` Alex Elder
2026-11-10 21:15   ` Alex Elder

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=DMRBR0ARCU5N.1WRTDA5GN4OG5@linux.spacemit.com \
    --to=troy.mitchell@linux.spacemit.com \
    --cc=andi.shyti@kernel.org \
    --cc=aurelien@aurel32.net \
    --cc=dlan@kernel.org \
    --cc=elder@riscstar.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux.amoon@gmail.com \
    --cc=spacemit@lists.linux.dev \
    --cc=sre@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.