Skip to content

Commit f45963d

Browse files
committed
acpi: provide new function directly on PlatformInfo too
1 parent 67d01ea commit f45963d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

acpi/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ where
336336
/// Like `platform_info_in`, but uses the global allocator.
337337
#[cfg(feature = "alloc")]
338338
pub fn platform_info(&self) -> AcpiResult<PlatformInfo<alloc::alloc::Global>> {
339-
PlatformInfo::new_in(self, alloc::alloc::Global)
339+
PlatformInfo::new(self)
340340
}
341341

342342
/// Convenience method for contructing a [`PlatformInfo`](crate::platform::PlatformInfo). This is one of the

acpi/src/platform/mod.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
madt::Madt,
77
AcpiError,
88
AcpiHandler,
9+
AcpiResult,
910
AcpiTables,
1011
ManagedSlice,
1112
PowerProfile,
@@ -100,11 +101,21 @@ where
100101
*/
101102
}
102103

104+
#[cfg(feature = "alloc")]
105+
impl<'a> PlatformInfo<'a, alloc::alloc::Global> {
106+
pub fn new<H>(tables: &AcpiTables<H>) -> AcpiResult<Self>
107+
where
108+
H: AcpiHandler,
109+
{
110+
Self::new_in(tables, alloc::alloc::Global)
111+
}
112+
}
113+
103114
impl<'a, A> PlatformInfo<'a, A>
104115
where
105116
A: Allocator + Clone,
106117
{
107-
pub fn new_in<H>(tables: &AcpiTables<H>, allocator: A) -> crate::AcpiResult<Self>
118+
pub fn new_in<H>(tables: &AcpiTables<H>, allocator: A) -> AcpiResult<Self>
108119
where
109120
H: AcpiHandler,
110121
{

0 commit comments

Comments
 (0)