mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/13] USB: Make USB devices removable
@ 2026-08-31 13:20 Sascha Hauer
  2026-08-31 13:20 ` [PATCH 01/13] usb: don't report device removal after the device name is gone Sascha Hauer
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Sascha Hauer @ 2026-08-31 13:20 UTC (permalink / raw)
  To: BAREBOX

So far we assumed that USB devices are not disconnected during barebox
lifetime, so we would only ever add to the list of devices. This series
relaxes this assumption. USB storage devices can now be disconnected at
runtime and the disk devices associated with them properly unregister
and filesystems are unmounted. Accesses to files on dead devices are
caught and return an error. Re-plugging USB storage devices works as
well. We still don't detect changes to the USB topology automatically,
but a subsequent "usb" command will bring the barebox topology up to
date with the hardware state.

This has so far only been tested with USB storage devices, USB network
devices and keyboards likely still need some fixes, but as we assumed
USB devices to be non-removable we can still see this series as a new
feature currently limited to USB storage devices.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Sascha Hauer (13):
      usb: don't report device removal after the device name is gone
      fs: devfs: count an open partition as an open device
      block: propagate errors from blockdevice_unregister()
      fs: add cdev_umount_all()
      block: add blockdevice_unregister_removed()
      usb: storage: tear the disk down properly on disconnect
      usb: hub: cancel pending port scans of a removed device
      usb: reuse the addresses of removed devices
      usb: hub: detect disconnected devices
      usb: don't keep a dangling root device on enumeration failure
      usb: hub: limit the number of ports to USB_MAXCHILDREN
      usb: detect unplugged devices on transfer errors
      usb: storage: stop talking to a device that is gone

 common/block.c                  |  36 +++++++++-
 drivers/usb/core/hub.c          |  91 +++++++++++++++++++++++---
 drivers/usb/core/usb.c          | 141 +++++++++++++++++++++++++++++++++++++---
 drivers/usb/core/usb.h          |   2 +
 drivers/usb/storage/transport.c |   4 ++
 drivers/usb/storage/usb.c       |  31 ++++++++-
 fs/devfs-core.c                 |  14 +++-
 fs/fs.c                         |  31 +++++++++
 include/block.h                 |   1 +
 include/fs.h                    |   1 +
 include/linux/usb/usb.h         |  16 +++++
 11 files changed, 344 insertions(+), 24 deletions(-)
---
base-commit: 39ce98f9cb1cfd4a0601147a4dffa2319d73fc3f
change-id: 20260831-usb-device-lifetime-1c1233592d01

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-08-31 13:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 13:20 [PATCH 00/13] USB: Make USB devices removable Sascha Hauer
2026-08-31 13:20 ` [PATCH 01/13] usb: don't report device removal after the device name is gone Sascha Hauer
2026-08-31 13:20 ` [PATCH 02/13] fs: devfs: count an open partition as an open device Sascha Hauer
2026-08-31 13:20 ` [PATCH 03/13] block: propagate errors from blockdevice_unregister() Sascha Hauer
2026-08-31 13:20 ` [PATCH 04/13] fs: add cdev_umount_all() Sascha Hauer
2026-08-31 13:20 ` [PATCH 05/13] block: add blockdevice_unregister_removed() Sascha Hauer
2026-08-31 13:20 ` [PATCH 06/13] usb: storage: tear the disk down properly on disconnect Sascha Hauer
2026-08-31 13:20 ` [PATCH 07/13] usb: hub: cancel pending port scans of a removed device Sascha Hauer
2026-08-31 13:20 ` [PATCH 08/13] usb: reuse the addresses of removed devices Sascha Hauer
2026-08-31 13:20 ` [PATCH 09/13] usb: hub: detect disconnected devices Sascha Hauer
2026-08-31 13:20 ` [PATCH 10/13] usb: don't keep a dangling root device on enumeration failure Sascha Hauer
2026-08-31 13:20 ` [PATCH 11/13] usb: hub: limit the number of ports to USB_MAXCHILDREN Sascha Hauer
2026-08-31 13:20 ` [PATCH 12/13] usb: detect unplugged devices on transfer errors Sascha Hauer
2026-08-31 13:20 ` [PATCH 13/13] usb: storage: stop talking to a device that is gone Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox