devm_spi_ne...llary_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

devm_spi_new_ancillary_device β€” register a managed ancillary SPI device, bestie ✨

okay so real quick, this is the kernel API manual for it, and yes we're gonna get through it together 🫢


🌸 SYNOPSIS 🌸

struct spi_device * devm_spi_new_ancillary_device (struct spi_device
*spi , u8 chip_select );

like, it takes two things and hands you back a struct spi_device *, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • spi β€” pointer to the main SPI device, aka the one that's registering the ancillary device πŸ‘‘ it's giving parent energy
  • chip_select β€” a u8, the Chip Select of the ancillary device. yes it's a u8. no we will not be questioning it πŸ“

✨ DESCRIPTION ✨

So what does it actually do? It registers an ancillary SPI device β€” and the example in the docs is honestly so good: some chips have a chip-select for normal device usage, and another one for setup/firmware upload. like, two CS pins, one chip, main character energy fr fr πŸ”₯

This is the managed version of spi_new_ancillary_device β€” that's what the devm_ prefix is telling you, iykyk. The ancillary device gets unregistered automatically when the parent SPI device is unregistered. no manual cleanup, no leaked devices, we love a self-cleaning situation πŸ§šπŸ’œ

⚠️ lowkey important: this may only be called from the main SPI device's probe routine. that's the rule. don't be out here calling it from just anywhere 😭

πŸ’€ RETURN πŸ’€

  • Pointer to the new ancillary device on success πŸŽ‰
  • ERR_PTR on failure πŸ™ˆ (so yeah, check it β€” IS_ERR/PTR_ERR are your besties here, that's just how ERR_PTR works)

🌈 SEE ALSO 🌈

Kernel file ./drivers/spi/spi.c β€” and here's the full squad, every single one, no cap:

__spi_register_driver(9), spi_alloc_device(9), spi_add_device(9), spi_new_device(9), spi_unregister_device(9), spi_register_board_info(9), spi_res_alloc(9), spi_res_free(9), spi_res_add(9), spi_res_release(9), spi_finalize_current_transfer(9), __spi_pump_messages(9), spi_pump_messages(9), spi_take_timestamp_pre(9), spi_take_timestamp_post(9), spi_set_thread_rt(9), spi_get_next_queued_message(9), spi_finalize_current_message(9), spi_queued_transfer(9), spi_flush_queue(9), of_register_spi_devices(9), spi_new_ancillary_device(9), acpi_spi_count_resources(9), acpi_spi_device_alloc(9), spi_target_abort(9), __spi_alloc_controller(9), __devm_spi_alloc_controller(9), spi_get_gpio_descs(9), spi_register_controller(9), devm_spi_register_controller(9), spi_unregister_controller(9), spi_replace_transfers(9), spi_split_transfers_maxsize(9), spi_split_transfers_maxwords(9), spi_set_cs_timing(9), spi_setup(9), spi_optimize_message(9), spi_unoptimize_message(9), devm_spi_optimize_message(9), spi_async(9), spi_sync(9), spi_sync_locked(9), spi_bus_lock(9), spi_bus_unlock(9), spi_write_then_read(9)

like... that's the whole friend group, go say hi πŸ’–


✨ and that's the page!! ✨ sourced from ./drivers/spi, dated October 2026, and it's the devm_spi_ne...llary_device(9) page β€” yes the title is truncated in the header, that's just how it's printed, don't @ me πŸ’…πŸŽ€ see u in the next manpage bestie πŸ¦‹

πŸ“¦ where this page comes from