spi_register_board_info(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– spi_register_board_info(9) πŸ’–

okay so this is a page from the Kernel API Manual bestie, and it's all about spi_register_board_info β€” register SPI devices for a given board. yes that's the whole NAME. slay. ✨


🌸 SYNOPSIS 🌸

int spi_register_board_info (struct spi_board_info const *info ,
unsigned n );

that's it. that's the signature. copy it exactly, don't @ me πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • info β€” an array of chip descriptors. like, the whole lineup of your little SPI babies 🐣
  • n β€” how many descriptors are provided. so how many of those babies you're actually handing over. count carefully fr fr

πŸ’œ CONTEXT πŸ’œ

can sleep 😴 β€” so don't call this from somewhere spicy where sleeping is illegal, okay? context matters, iykyk.


πŸ”₯ DESCRIPTION πŸ”₯

okay so here's the vibe. Board-specific early init code calls this β€” probably during arch_initcall β€” with segments of the SPI device table. that's the move. 🫢

the way it works: any device nodes are created later, after the relevant parent SPI controller (bus_num) is defined. so you're not making devices yet, you're just putting the list on file. and bestie, we keep this table of devices forever β€” like, permanently, no take-backs β€” so that reloading a controller driver will not make Linux forget about these hard-wired devices. iconic behaviour honestly πŸ‘‘

other code can also call this too, no gatekeeping! e.g. a particular add-on board might provide SPI devices through its expansion connector, so code initializing that board would naturally declare its SPI devices. makes sense, you'd want the board to introduce its own devices. 🌈

⚠️ ok important warning time: the board info passed can safely be __initdata ... but be careful of any embedded pointers (platform_data, etc) β€” they're copied as-is. so no funny business with those pointers, they're not deep-copied, they're just... pointed at. 😭 don't let them dangle bestie.

⭐ RETURN ⭐

zero on success πŸŽ‰ else a negative error code πŸ’€ (which like, mood, but also: check it.)


πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file ./drivers/spi/spi.c β€” plus this absolute list of friends, in order, no skips:


and that's the page!! πŸ§šπŸ’–

cute little sign-off: this one lives in ./drivers/spi, dated October 2026, and it's spi_register_board_info(9) for the Kernel API Manual. go be obsessed with your board info. periodt. πŸ’…πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from