devm_spi_ne...llary_device(9)
π 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 energychip_selectβ au8, the Chip Select of the ancillary device. yes it's au8. 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_PTRon failure π (so yeah, check it βIS_ERR/PTR_ERRare your besties here, that's just howERR_PTRworks)
π 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms