Linux SPI subsystem development
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Vishwaroop A <va@nvidia.com>
Cc: linux-spi@vger.kernel.org, smangipudi@nvidia.com,
	jonathanh@nvidia.com, thierry.reding@gmail.com, corbet@lwn.net,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH v3 1/2] spi: add new_device/delete_device sysfs interface
Date: Tue, 5 May 2026 10:24:21 +0900	[thread overview]
Message-ID: <aflGxdXEq51Cp_vK@sirena.co.uk> (raw)
In-Reply-To: <20260504074037.704833-2-va@nvidia.com>

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

On Mon, May 04, 2026 at 07:40:36AM +0000, Vishwaroop A wrote:
> Development boards such as the Jetson AGX Orin expose SPI buses
> on expansion headers (e.g. the 40-pin header) so that users can
> connect and interact with SPI peripherals from userspace. The
> standard way to get /dev/spidevB.C character device nodes for
> this purpose is to register spi_device instances backed by the
> spidev driver.

> +static ssize_t
> +new_device_store(struct device *dev, struct device_attribute *attr,
> +		 const char *buf, size_t count)
> +{

> +	mutex_lock(&ctlr->add_lock);
> +	status = __spi_add_device(spi, NULL);

This takes add_lock in a sysfs operation but spi_unregister_controller()
also does that while it's calling device_del on the controller's device
which will result in the sysfs files for the controller being deleted.
That'll deadlock...

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

  reply	other threads:[~2026-05-05  1:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04  7:40 [PATCH v3 0/2] spi: add sysfs interface for userspace device instantiation Vishwaroop A
2026-05-04  7:40 ` [PATCH v3 1/2] spi: add new_device/delete_device sysfs interface Vishwaroop A
2026-05-05  1:24   ` Mark Brown [this message]
2026-05-04  7:40 ` [PATCH v3 2/2] docs: spi: add documentation for userspace device instantiation Vishwaroop A

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=aflGxdXEq51Cp_vK@sirena.co.uk \
    --to=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=jonathanh@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=smangipudi@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=va@nvidia.com \
    /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