usb_driver_claim_interface(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… usb_driver_claim_interface(9) β€” like, the Kernel API Manual entry you actually wanna read 🫢

okay bestie, so this is a page from the Kernel API Manual, and it's about binding a driver to an interface. yes, that kind of binding. sit down, hydrate, let's go ✨


🌸 NAME 🌸

usb_driver_claim_interface β€” bind a driver to an interface

like literally what it says on the tin, no cap πŸ’–


✨ SYNOPSIS ✨

int usb_driver_claim_interface (struct usb_driver *driver , struct
usb_interface *iface , void *data );

three args, one int coming back at you, that's the whole vibe πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • driver β€” the driver that's getting bound. it's the main character here, obviously πŸ‘‘
  • iface β€” the interface it will be bound to. important detail bestie: this must be in the usb device's active configuration. if it's not, that's a whole situation πŸ’€
  • data β€” the driver data associated with that interface. this is your stuff, do whatever, it's yours πŸ“

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea 🍡 β€” this function is for usb device drivers that need to claim more than one interface on a device when probing. like, greedy? no. necessary? yes. the current examples are audio and acm, so that's the energy we're working with πŸ”₯

and listen β€” no device driver should directly modify internal usb_interface or usb_device structure members. none. not even a little. don't touch the internals, that's not your business, that's giving "i can fix him" energy and it never works 😭

⚠️ also, callers must own the device lock. yes, mandatory. locking discipline is not a suggestion, it's a lifestyle πŸ’…

good news though: driver probe entries don't need extra locking because they already own it. but other call contexts? yeah, they may need to explicitly claim that lock. so check your context before you go touching things, iykyk πŸ™ˆ


🌈 RETURN 🌈

0 on success. that's it. that's the whole return section. slay, honestly πŸ’€


🧚 SEE ALSO 🧚

kernel file ./drivers/usb/core/driver.c, and the whole friend group:

that's the whole autopm cinematic universe fr fr 🌟


okay so that's the page!! and for legal reasons (and because it's cute) β€” this whole thing lives in ./drivers/usb/core, it's part of the Kernel API Manual, and it's dated October 2026 πŸŽ€ bye bestie, go own that device lock πŸ’–βœ¨

πŸ“¦ where this page comes from