From: Vishwaroop A <va@nvidia.com>
To: <broonie@kernel.org>
Cc: <linux-spi@vger.kernel.org>, <jonathanh@nvidia.com>,
<thierry.reding@gmail.com>, <corbet@lwn.net>,
<linux-doc@vger.kernel.org>, <smangipudi@nvidia.com>,
<va@nvidia.com>
Subject: [PATCH v8 0/2] spi: add new_device/delete_device sysfs interface
Date: Tue, 28 Jul 2026 19:10:54 +0000 [thread overview]
Message-ID: <20260728191056.2337791-1-va@nvidia.com> (raw)
Add I2C-style new_device/delete_device sysfs attributes to SPI host
controllers, allowing userspace to instantiate and remove SPI devices
at runtime without device-tree changes.
Patch 1 adds the new_device/delete_device attributes and the supporting
infrastructure (userspace_clients list, manual sysfs group registration).
Patch 2 adds the ABI and user-facing documentation.
Changes since v7:
- Remove the redundant CONFIG_SPI_DYNAMIC guard around
spi_controller_groups[]. (Jon Hunter)
- Restore the original add_lock release point; the userspace sysfs
group is removed and drained before the lock is taken. (Jon Hunter)
- Remove the redundant dead flag and retain the base-tree
device_is_registered() teardown check. (Jon Hunter)
- Simplify parsing, diagnostics and comments. (Jon Hunter)
Changes since v6:
- new_device_store(): reject empty device names. (Mark Brown)
- Move sysfs userspace group registration out of the automatic
ctlr->dev.groups path; create it manually at the end of
spi_register_controller() and remove it at the start of
spi_unregister_controller(). (Mark Brown)
- Drop userspace_clients_lock; reuse the existing add_lock.
new_device_store() calls __spi_add_device() directly under
add_lock; delete_device_store() also takes add_lock.
new_device is DEVICE_ATTR_IGNORE_LOCKDEP alongside delete_device
to silence the class-level splat. (Jon Hunter)
- kernel-doc / inline comment updates for the new struct fields.
Changes since v5:
- Rebased on next-20260727 (v7.2-rc5); applies cleanly.
- kernel-doc entries for the new struct spi_controller /
struct spi_device fields.
- new_device_store(): reject chip_select > U8_MAX; parse with %u.
- new_device_store(): reject mode bits outside SPI_MODE_USER_MASK.
- new_device_store(): drop the unused 'n' / '%n' from sscanf().
Changes since v4:
- Removed spi_unregister_device() call from new_device_store()'s
controller-teardown error path.
Changes since v3:
- Replaced holding add_lock across __spi_add_device() + list
insertion with the design that eventually landed as v8: sysfs
group removed before add_lock is taken, so kernfs_drain()
serialises us with unregister.
Changes since v2:
- Gated sysfs attributes and locking on CONFIG_SPI_DYNAMIC.
Changes since v1:
- Added locking to prevent races between new_device_store() and
concurrent spi_unregister_controller().
Link: https://lore.kernel.org/linux-spi/20260728030541.2279518-1-va@nvidia.com/ # v7
Link: https://lore.kernel.org/linux-spi/cover.1784000000.git.va@nvidia.com/ # v6
Link: https://lore.kernel.org/linux-spi/20260517201602.498135-1-va@nvidia.com/ # v5
Link: https://lore.kernel.org/linux-tegra/909f0c92-d110-4253-903e-5c81e21e12c9@nvidia.com/
Vishwaroop A (2):
spi: add new_device/delete_device sysfs interface
docs: spi: add documentation for userspace device instantiation
.../ABI/testing/sysfs-class-spi-master | 34 +++
Documentation/spi/index.rst | 1 +
Documentation/spi/instantiating-devices.rst | 88 +++++++
drivers/spi/spi.c | 241 ++++++++++++++++++
include/linux/spi/spi.h | 18 ++
5 files changed, 382 insertions(+)
create mode 100644 Documentation/ABI/testing/sysfs-class-spi-master
create mode 100644 Documentation/spi/instantiating-devices.rst
base-commit: 0d33d21e47d9dc66f91e44da3fc9220c74d93df7
--
2.17.1
next reply other threads:[~2026-07-28 19:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 19:10 Vishwaroop A [this message]
2026-07-28 19:10 ` [PATCH v8 1/2] spi: add new_device/delete_device sysfs interface Vishwaroop A
2026-07-28 19:10 ` [PATCH v8 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=20260728191056.2337791-1-va@nvidia.com \
--to=va@nvidia.com \
--cc=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 \
/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