spi_new_device(9)
β¨ spi_new_device(9) β¨
okay so this is a page from the Kernel API Manual β the spi_new_device one, bestie. it's a kernel function, it lives in ./drivers/spi, and it's about to make a whole new SPI device appear out of thin air (well, out of structs). let's get into it π
πΈ NAME πΈ
spi_new_device β instantiate one new SPI device
like, literally, it births a single SPI device. one. singular. iconic behavior.
π¦ SYNOPSIS π¦
struct spi_device * spi_new_device (struct spi_controller *ctlr , struct
spi_board_info *chip );
so you hand it a controller and a board info struct, and it hands you back a struct spi_device *. the whole vibe in one line, no cap π«Ά
π ARGUMENTS π
ctlrβ the controller your device is connected to. that's the parent energy right there πchipβ describes the SPI device itself. all the deets about what you're bringing into the world β¨
π CONTEXT π
can sleep π΄
yes bestie, this one is allowed to sleep. so don't be calling it from somewhere sleepy-frowned-upon, iykyk.
π DESCRIPTION π
so on your typical mainboards, this function is purely internal β and honestly? it's not needed after board init has already created the hard-wired devices. like, the work is done, go home π
but here's the thing π some development platforms may not be able to use spi_register_board_info, and that's exactly why this one is exported. so for example a USB or parport based adapter driver could add devices β ones it would learn about out-of-band π§
periodt. that's the whole reason it exists in the public API.
β RETURN β
the new device, or NULL.
that's it. that's the return value. either you get your shiny new device or you get NULL and you gotta deal π
π§ SEE ALSO π§
the Kernel file ./drivers/spi/spi.c β and a truly legendary list of friends, all of them together, exactly like this:
__spi_register_driver(9)spi_alloc_device(9)spi_add_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)devm_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)
that's the whole group chat right there, no one left on read π
like and subscribe to ./drivers/spi for more, bestie π
and that's the page!! brought to you by the fine folks at ./drivers/spi, dated October 2026, and yeah β it's spi_new_device(9) all the way down. mwah ππ«Ά go instantiate something cute today πΈ
π¦ 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