attribute_co...r_add_device(9)
π attribute_co...r_add_device(9) π
okay bestie, welcome to this Kernel API Manual moment β yes, the title is literally attribute_co...r_add_device(9), and weβre about to make attribute_container_add_device make sense. π«Ά
πΈ NAME πΈ
attribute_container_add_device β see if any container is interested in dev. π
β¨ SYNOPSIS β¨
void attribute_container_add_device (struct device *dev , int (*fn)(struct attribute_container *, struct device *, struct device *) );
π ARGUMENTS π
devβ device to add attributes to. π οΈfnβ function to trigger addition of class device. π
π DESCRIPTION π
So this function allocates storage for the class device(s) that are gonna be attached to dev β one for each matching attribute_container. No cap. π
If no fn is provided, the code will simply register the class device via device_add. easy peasy. β¨
If a function is provided, it is expected to add the class device at the appropriate time. One of the things that might be necessary is to allocate and initialise the classdev and then add it a later time. To do this, call this routine for allocation and initialisation and then use attribute_container_device_trigger to call device_add on it. π
Note: after this, the class device contains a reference todevwhich is not relinquished until the release of theclassdev. Keep that in mind, bestie β that reference is staying put until theclassdevgets released. π
π₯ SEE ALSO π₯
- Kernel file
./drivers/base/attribute_container.c attribute_container_classdev_to_container(9)attribute_container_register(9)attribute_container_unregister(9)attribute_container_remove_device(9)attribute_container_device_trigger_safe(9)attribute_container_device_trigger(9)attribute_container_add_attrs(9)attribute_container_add_class_device(9)attribute_container_remove_attrs(9)attribute_container_class_device_del(9)attribute_container_find_class_device(9)
okay thatβs the whole vibe π
signed off from ./drivers/base, October 2026, in the Kernel API Manual β mwah! πβ¨
π¦ 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