aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/devices
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-07-24 00:55:57 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-07-24 00:55:57 +0200
commit7d241968ff4feb83bc23636df3a7ddb80f4bb4a9 (patch)
tree82ebfa2184ffa00b4bccb1a6ba77cf82a54ee251 /kernel/kapi/devices
parentb334a8494bef50c5b90adc1f101464fc8c4c971a (diff)
downloadkernel-7d241968ff4feb83bc23636df3a7ddb80f4bb4a9.tar.xz
kernel-7d241968ff4feb83bc23636df3a7ddb80f4bb4a9.zip
kapi/device: remove init()
Diffstat (limited to 'kernel/kapi/devices')
-rw-r--r--kernel/kapi/devices/bus.cpp40
-rw-r--r--kernel/kapi/devices/bus.tests.cpp10
-rw-r--r--kernel/kapi/devices/interface_registry.tests.cpp5
3 files changed, 0 insertions, 55 deletions
diff --git a/kernel/kapi/devices/bus.cpp b/kernel/kapi/devices/bus.cpp
index 25e35733..db693eac 100644
--- a/kernel/kapi/devices/bus.cpp
+++ b/kernel/kapi/devices/bus.cpp
@@ -5,11 +5,9 @@
#include <kapi/system.hpp>
#include <kstd/memory.hpp>
-#include <kstd/print.hpp>
#include <kstd/string.hpp>
#include <kstd/vector.hpp>
-#include <algorithm>
#include <span>
#include <utility>
@@ -19,30 +17,6 @@ namespace kapi::devices
: device{name}
{}
- auto bus::init() -> bool
- {
- if (m_init_was_called.test_and_set())
- {
- kstd::println(kstd::print_sink::stderr, "[OS:DEV] Bus {} already initialized", name());
- return true;
- }
-
- if (!enumerate_old())
- {
- kstd::println(kstd::print_sink::stderr, "[OS:DEV] Bus {} enumeration failed", name());
- return false;
- }
-
- auto child_status = std::ranges::fold_left(m_devices, true, [&](bool acc, auto & child) -> bool {
- kstd::println("[OS:DEV] Initializing child device {}@{}", child->name(), name());
- return child->init() && acc;
- });
-
- m_initialized.test_and_set();
-
- return child_status;
- }
-
auto bus::add_child(kstd::shared_ptr<device> child) -> void
{
child->set_parent(kstd::static_pointer_cast<bus>(shared_from_this()));
@@ -56,15 +30,6 @@ namespace kapi::devices
attached->set_state(state::present);
driver_registry::get().device_attached(attached);
-
- if (m_initialized.test())
- {
- kstd::println("[OS:DEV] Initializing child device {}@{}", attached->name(), name());
- if (!attached->init())
- {
- kapi::system::panic("[OS:DEV] Failed to initialize child device");
- }
- }
}
[[nodiscard]] auto bus::children() const -> std::span<kstd::shared_ptr<device> const>
@@ -77,9 +42,4 @@ namespace kapi::devices
return nullptr;
}
- auto bus::enumerate_old() -> bool
- {
- return true;
- }
-
} // namespace kapi::devices \ No newline at end of file
diff --git a/kernel/kapi/devices/bus.tests.cpp b/kernel/kapi/devices/bus.tests.cpp
index d5a2d1cf..9f95513b 100644
--- a/kernel/kapi/devices/bus.tests.cpp
+++ b/kernel/kapi/devices/bus.tests.cpp
@@ -16,11 +16,6 @@ namespace
struct test_device final : kapi::devices::device
{
using kapi::devices::device::device;
-
- auto init() -> bool override
- {
- return true;
- }
};
struct flagging_device final : kapi::devices::device
@@ -35,11 +30,6 @@ namespace
*m_destroyed_flag = true;
}
- auto init() -> bool override
- {
- return true;
- }
-
private:
bool * m_destroyed_flag;
};
diff --git a/kernel/kapi/devices/interface_registry.tests.cpp b/kernel/kapi/devices/interface_registry.tests.cpp
index aea7776c..78cd7ecf 100644
--- a/kernel/kapi/devices/interface_registry.tests.cpp
+++ b/kernel/kapi/devices/interface_registry.tests.cpp
@@ -35,11 +35,6 @@ namespace
, m_const_device{&const_device}
{}
- auto init() -> bool override
- {
- return true;
- }
-
[[nodiscard]] constexpr auto get_value() const noexcept -> int override
{
return m_value;