diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 11:37:52 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-07-26 11:37:52 +0200 |
| commit | 5a5fefba28a52feffadf2b810b2f935934aa7b0b (patch) | |
| tree | 4583579a3b964091455344969a3e9641fb8fef33 /kapi | |
| parent | ad43e9c9eac69b862789f2e132201cd5ceebaffa (diff) | |
| download | kernel-5a5fefba28a52feffadf2b810b2f935934aa7b0b.tar.xz kernel-5a5fefba28a52feffadf2b810b2f935934aa7b0b.zip | |
kapi/device: allow removing devices from busses
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/bus.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index 26b46830..13951e46 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -37,6 +37,9 @@ namespace kapi::devices //! @param protocol The bus protocol to use. bus(kstd::string const & name, bus_protocol & protocol); + //! Tear down this bus recursively. + ~bus() override; + //! Attach a child device to this bus. //! //! Whenever a device is attached to a bus, the bus takes sole ownership of the device. @@ -44,6 +47,12 @@ namespace kapi::devices //! @param child The child device to attach. auto add_child(kstd::shared_ptr<device> child) -> void; + //! Detach a child device from this bus and tear it down. + //! + //! @param child The device to detach. + //! @return true iff. the child was found an removed, false otherwise. + auto remove_child(device & child) -> bool; + //! Get the children attached to this bus. //! //! @return A vector of all children attached to this bus. @@ -54,6 +63,8 @@ namespace kapi::devices auto query_facet(kapi::capabilities::facet_id facet) -> void * override; private: + auto do_remove_child(device & child) -> void; + bus_protocol * m_protocol{}; kstd::vector<kstd::shared_ptr<device>> m_devices{}; }; |
