forked from DragonOS-Community/DragonOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
完善设备驱动模型,基于kset、kobj来维护对象之间的关系 (DragonOS-Community#401)
* 使用kobj和kset管理/sys文件夹下的对象 * 修改notifier,把action从u64换为泛型。 * 完善设备驱动模型,基于kset、kobj来维护对象之间的关系
- Loading branch information
Showing
46 changed files
with
3,465 additions
and
1,503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
use alloc::sync::Arc; | ||
|
||
use crate::driver::base::device::Device; | ||
|
||
/// 参考: https://opengrok.ringotek.cn/xref/linux-6.1.9/drivers/acpi/glue.c#352 | ||
pub fn acpi_device_notify(_dev: &Arc<dyn Device>) { | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ use crate::{ | |
}; | ||
|
||
mod c_adapter; | ||
pub mod glue; | ||
pub mod old; | ||
|
||
extern crate acpi; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use super::init::driver_init; | ||
|
||
#[no_mangle] | ||
unsafe extern "C" fn rs_driver_init() -> i32 { | ||
let result = driver_init() | ||
.map(|_| 0) | ||
.unwrap_or_else(|e| e.to_posix_errno()); | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use alloc::{string::ToString, sync::Arc}; | ||
|
||
use crate::syscall::SystemError; | ||
|
||
use super::kset::KSet; | ||
|
||
/// `/sys/class`的kset | ||
static mut CLASS_KSET_INSTANCE: Option<Arc<KSet>> = None; | ||
|
||
#[inline(always)] | ||
#[allow(dead_code)] | ||
pub fn sys_class_kset() -> Arc<KSet> { | ||
unsafe { CLASS_KSET_INSTANCE.clone().unwrap() } | ||
} | ||
|
||
/// 初始化`/sys/class`的kset | ||
pub(super) fn classes_init() -> Result<(), SystemError> { | ||
let class_kset = KSet::new("class".to_string()); | ||
class_kset | ||
.register(None) | ||
.expect("register class kset failed"); | ||
unsafe { | ||
CLASS_KSET_INSTANCE = Some(class_kset); | ||
} | ||
return Ok(()); | ||
} |
Oops, something went wrong.