aboutsummaryrefslogtreecommitdiff
path: root/kernel/kapi/devices/device.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-09-09 23:02:20 +0200
committerFelix Morgner <felix.morgner@ost.ch>2026-09-09 23:02:20 +0200
commitb99b79d8080cc1491f96069677d9ce0b7775a4f0 (patch)
tree1f7a4534926a79ee6376770c63cccd2aa9e37442 /kernel/kapi/devices/device.cpp
parent9438d08cc7a7f814d8d1b0cb13f4db176fc53aeb (diff)
downloadkernel-b99b79d8080cc1491f96069677d9ce0b7775a4f0.tar.xz
kernel-b99b79d8080cc1491f96069677d9ce0b7775a4f0.zip
chore: replace some naked pointers
The coding guidelines explicitly prohibit the use of "naked"/C-style pointers. However, there were some prominent examples in the kapi and the core kernel source. This changeset replaces them with the appropriate smart pointer types.
Diffstat (limited to 'kernel/kapi/devices/device.cpp')
-rw-r--r--kernel/kapi/devices/device.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/kapi/devices/device.cpp b/kernel/kapi/devices/device.cpp
index 2576e20a..3a3b7cc1 100644
--- a/kernel/kapi/devices/device.cpp
+++ b/kernel/kapi/devices/device.cpp
@@ -23,12 +23,12 @@ namespace kapi::devices
: m_name(name)
{}
- auto device::facet(kapi::capabilities::facet_id facet) noexcept -> void *
+ auto device::facet(kapi::capabilities::facet_id facet) noexcept -> kstd::observer_ptr<void>
{
return query_facet(facet);
}
- auto device::facet(kapi::capabilities::facet_id facet) const noexcept -> void const *
+ auto device::facet(kapi::capabilities::facet_id facet) const noexcept -> kstd::observer_ptr<void const>
{
return const_cast<device *>(this)->query_facet(facet);
}
@@ -61,10 +61,10 @@ namespace kapi::devices
m_state = state;
}
- auto device::bound_driver() const noexcept -> driver *
+ auto device::bound_driver() const noexcept -> kstd::shared_ptr<driver>
{
auto guard = kstd::lock_guard{m_lock};
- return m_driver.lock().get();
+ return m_driver.lock();
}
auto device::bind_driver(kstd::weak_ptr<struct driver> driver) -> void
@@ -114,7 +114,7 @@ namespace kapi::devices
m_resources = std::move(resources);
}
- auto device::query_facet(kapi::capabilities::facet_id) -> void *
+ auto device::query_facet(kapi::capabilities::facet_id) -> kstd::observer_ptr<void>
{
return nullptr;
}