mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andriy Shevchenko <andriy.shevchenko@intel.com>
To: Runyu Xiao <runyu.xiao@seu.edu.cn>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Karol Wrona" <k.wrona@samsung.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, "Jianhao Xu" <jianhao.xu@seu.edu.cn>
Subject: Re: [PATCH v2] iio: ssp: Serialize watchdog timer state changes
Date: Sun, 4 Oct 2026 11:40:26 +0300	[thread overview]
Message-ID: <asIQ-lnNBk8isPa0@ashevche-desk.local> (raw)
In-Reply-To: <20261004053927.1139035-1-runyu.xiao@seu.edu.cn>

On Sun, Oct 04, 2026 at 01:39:27PM +0800, Runyu Xiao wrote:
> The SSP watchdog timer rearms itself from its callback, but the driver uses
> timer_delete_sync() when the last sensor is disabled and during suspend.
> Those operations do not prevent a concurrent enable or callback from
> rearming the timer after deletion. The final remove path also used
> timer_delete_sync(), which does not permanently prevent rearming before the
> device state is released.
> 
> Protect watchdog state and the enable reference count with wdt_lock. The
> timer callback rearms only while the timer is enabled, and synchronous
> deletion drains an in-flight callback. Use timer_shutdown_sync() for final
> removal so later rearm attempts are rejected permanently.
> 
> A refresh work item can call ssp_sync_available_sensors() and
> ssp_enable_sensor() during suspend. If the enable count is zero when
> suspend checks it, that work can otherwise start the watchdog after the
> suspend stop. Track the suspended state under wdt_lock. Sensor enables may
> update the count without restarting the timer. Stop the watchdog before
> sending the suspend command, and restart it only after resume succeeds or
> suspend fails.
> 
> Cancel watchdog work after releasing wdt_lock because reset work can wait
> for the threaded IRQ handler, which may synchronously wait for refresh work
> that enables sensors. Remove MFD children before destroying the locks;
> IIO child teardown can disable an active sensor.

General rule of thumb is to defer a new version until the discussion is settled
down in the previous round(s).

...

> struct ssp_data {

>  	struct spi_device *spi;
>  	const struct ssp_sensorhub_info *sensorhub_info;
>  	struct timer_list wdt_timer;
> +	struct mutex wdt_lock; /* protects watchdog timer state */
> +	bool wdt_enabled;
> +	bool wdt_suspended;
>  	struct work_struct work_wdt;
>  	struct delayed_work work_refresh;

Same Q here, can you reduce the gap by 4 bytes by rearranging the new members?

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-10-04  8:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  7:03 [PATCH] " Runyu Xiao
2026-09-30  9:58 ` Andy Shevchenko
2026-10-04  5:39   ` Runyu Xiao
2026-10-04  8:37     ` Andriy Shevchenko
2026-10-04  9:31       ` Runyu Xiao
2026-10-04  5:39   ` [PATCH v2] " Runyu Xiao
2026-10-04  8:40     ` Andriy Shevchenko [this message]

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=asIQ-lnNBk8isPa0@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=jic23@kernel.org \
    --cc=k.wrona@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=runyu.xiao@seu.edu.cn \
    --cc=stable@vger.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

all inboxes | Powered by JetHome®