Linux USB
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: gadget: remove legacy g_target and its f_tcm hooks
@ 2026-12-03  8:15 Slawomir Stepien
  2026-12-03  8:15 ` [PATCH 1/3] usb: gadget: legacy: remove the tcm_usb_gadget (g_target) driver Slawomir Stepien
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Slawomir Stepien @ 2026-12-03  8:15 UTC (permalink / raw)
  To: gregkh, bigeasy, nab; +Cc: Slawomir Stepien, linux-usb, linux-kernel

This series removes the legacy g_target gadget driver (tcm_usb_gadget)
and the f_tcm code that existed only to support it, as discussed on v1
of the f_tcm TPG fixes:

  https://lore.kernel.org/all/2026112324-trailside-hanky-1986@gregkh/

g_target is the only user of the dependent-module handling in f_tcm,
which pins the module with try_module_get()/module_put() while a TPG
exists, and of the tcm_register_callback/tcm_unregister_callback hooks.
The same gadget can be built with the configfs TCM function, which has
been available since v4.5. Patch 1 shows the equivalent configfs setup.
No defconfig enables CONFIG_USB_GADGET_TARGET.

1. Remove the g_target driver.
2. Drop the dependent-module support (has_dep, dependent,
   try_module_get()/module_put()).
3. Call usbg_attach()/usbg_detach() directly instead of through the
   callbacks, and remove them from struct f_tcm_opts.

This applies on top of the f_tcm TPG lifetime fixes (v2), which have not
been merged yet:

  https://lore.kernel.org/all/20261123142513.204652-1-sst@poczta.fm/

The base-commit and prerequisite-patch-id lines below identify that v2
series. The two series together apply cleanly to usb-next.

Tested on top of v2 with dummy_hcd, KASAN and lockdep:
- link the function before the TPG exists;
- rmdir of an enabled, bound TPG;
- recreate the TPG and rebind;
- rmdir of functions/tcm.0 while a TPG exists (-EBUSY).
No new warnings.

AI assistance: these patches, the changelogs and this cover letter were
written with Claude (claude-opus-5-5), which also ran the tests above.

Slawomir Stepien (3):
  usb: gadget: legacy: remove the tcm_usb_gadget (g_target) driver
  usb: gadget: f_tcm: drop dependent-module support
  usb: gadget: f_tcm: call attach/detach directly instead of through
    callbacks

 drivers/usb/gadget/function/f_tcm.c        |  81 +++-------
 drivers/usb/gadget/function/u_tcm.h        |  20 +--
 drivers/usb/gadget/legacy/Kconfig          |  12 --
 drivers/usb/gadget/legacy/Makefile         |   2 -
 drivers/usb/gadget/legacy/tcm_usb_gadget.c | 173 ---------------------
 5 files changed, 22 insertions(+), 266 deletions(-)
 delete mode 100644 drivers/usb/gadget/legacy/tcm_usb_gadget.c


base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
prerequisite-patch-id: 19bf9bc67cbbdcbaa7414733bb961f376fe0e847
prerequisite-patch-id: 7f7d6361238d694c8229831d2e123e38d56c6f29
prerequisite-patch-id: 607e018c2241a10807fcc29ac4152bce400f2170
-- 
2.56.1


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

end of thread, other threads:[~2026-12-03  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  8:15 [PATCH 0/3] usb: gadget: remove legacy g_target and its f_tcm hooks Slawomir Stepien
2026-12-03  8:15 ` [PATCH 1/3] usb: gadget: legacy: remove the tcm_usb_gadget (g_target) driver Slawomir Stepien
2026-12-03  8:15 ` [PATCH 2/3] usb: gadget: f_tcm: drop dependent-module support Slawomir Stepien
2026-12-03  8:15 ` [PATCH 3/3] usb: gadget: f_tcm: call attach/detach directly instead of through callbacks Slawomir Stepien
2026-12-03  8:31 ` [PATCH 0/3] usb: gadget: remove legacy g_target and its f_tcm hooks sashiko-bot

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