From ad43e9c9eac69b862789f2e132201cd5ceebaffa Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sun, 26 Jul 2026 10:28:44 +0200 Subject: kapi: move protocol pointer to base bus --- kapi/kapi/devices/bus.hpp | 12 ++++++++++-- kapi/kapi/devices/bus_protocol.hpp | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'kapi') diff --git a/kapi/kapi/devices/bus.hpp b/kapi/kapi/devices/bus.hpp index 0d679c4e..26b46830 100644 --- a/kapi/kapi/devices/bus.hpp +++ b/kapi/kapi/devices/bus.hpp @@ -4,6 +4,7 @@ // IWYU pragma: private, include #include +#include #include #include @@ -28,7 +29,13 @@ namespace kapi::devices //! Construct a bus with the given name. //! //! @param name The name of the bus. - explicit bus(kstd::string const & name); + bus(kstd::string const & name); + + //! Construct a bus with the given name and protocol. + //! + //! @param name The name of the bus. + //! @param protocol The bus protocol to use. + bus(kstd::string const & name, bus_protocol & protocol); //! Attach a child device to this bus. //! @@ -47,7 +54,8 @@ namespace kapi::devices auto query_facet(kapi::capabilities::facet_id facet) -> void * override; private: - kstd::vector> m_devices; + bus_protocol * m_protocol{}; + kstd::vector> m_devices{}; }; //! @} diff --git a/kapi/kapi/devices/bus_protocol.hpp b/kapi/kapi/devices/bus_protocol.hpp index cc1f2e5b..5d63a388 100644 --- a/kapi/kapi/devices/bus_protocol.hpp +++ b/kapi/kapi/devices/bus_protocol.hpp @@ -4,7 +4,6 @@ // IWYU pragma: private, include #include -#include #include #include @@ -15,6 +14,8 @@ namespace kapi::devices { + struct bus; + //! Bus specific behavior. //! //! A bus protocol defines how a bus discovers its attached children, and how drivers are matched against devices. It -- cgit v1.2.3