attribute_c...emove_device(9)
π NAME
attribute_container_remove_device β okay bestie, this one makes a device eligible for removal β¨ like it's basically handing the device its walking papers π
β¨ SYNOPSIS
void attribute_container_remove_device (struct device *dev , void
(*fn)(struct attribute_container *, struct device *, struct device *) );
π ARGUMENTS
devβ the generic device, your main character in this whole operation πfnβ a function you get to call to remove the device, like your little helper for the deed π«Ά
π¦ DESCRIPTION
Okay so this routine triggers device removal π₯ that's the whole vibe, that's the assignment.
If fn is NULL, then it's simply done via device_unregister β easy, no extra steps. But (and this is the part where you gotta listen, ngl) if something still has a reference to the classdev, then the memory occupied will not be freed until the classdev is released π like the memory is just sitting there waiting, iconic but also kind of a hostage situation lowkey.
Now, if you want a two phase release β you know, remove from visibility and then delete the device β then you should use this routine with a fn that calls device_del, and then use attribute_container_device_trigger to do the final put on the classdev. Two steps, two vibes, absolutely slay π
β¨
πΈ 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_add_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)
fr fr that's the whole page, no cap π this lil masterpiece lives in ./drivers/base and it's dated October 2026 β go off, kernel docs, you ate πβ
π¦ 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