Skip to content

Commit 2af9ca3

Browse files
committed
rust: factory: Add rros_release_element function
Diff: 1. In factory.rs: - Change the field `inside` and `dispose` in struct `RrosFactory`. - Implement methods `remove_element_device`, `is_public`, `__do_put_element`, `do_put_element_work`, `do_put_element_irq`, `do_put_element`, `put_element` for `RrosElement` - Modify the code used `inside`, because type has changed from `Option<RrosFactoryInside>` to `RrosFactoryInside`. - Add function `unbind_file_to_element` - Add function `rros_open_element` and `rros_release_element` 2. In sub factory(proxy/buf/poll,etc. .rs): Change the static factory creation. 3. In device.rs: Implement `unregister` for `Device` 4. In type.rs: Implement `hash_del` for `HlistNode` Status: 1. Compilation: Compile with clang-13.0.1 toolchain, `ARCH=arm64`, use `rros_defconfig`. 2. Functional test: Haven't started yet. 3. Eliminate warnings in factory.rs, most of them are dead_code warnings.
1 parent 32bd9f9 commit 2af9ca3

File tree

11 files changed

+412
-309
lines changed

11 files changed

+412
-309
lines changed

kernel/rros/clock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ pub static mut RROS_CLOCK_FACTORY: SpinLock<factory::RrosFactory> = unsafe {
546546
dispose: Some(clock_factory_dispose),
547547
attrs: None, //sysfs::attribute_group::new(),
548548
flags: factory::RrosFactoryType::Invalid,
549-
inside: Some(factory::RrosFactoryInside {
549+
inside: factory::RrosFactoryInside {
550550
type_: DeviceType::new(),
551551
class: None,
552552
cdev: None,
@@ -559,7 +559,7 @@ pub static mut RROS_CLOCK_FACTORY: SpinLock<factory::RrosFactory> = unsafe {
559559
name_hash: None,
560560
hash_lock: None,
561561
register: None,
562-
}),
562+
},
563563
})
564564
};
565565

@@ -1028,7 +1028,7 @@ impl FileOperations for ClockOps {
10281028
}
10291029
}
10301030

1031-
pub fn clock_factory_dispose(ele: factory::RrosElement) {}
1031+
pub fn clock_factory_dispose(ele: &mut factory::RrosElement) {}
10321032

10331033
fn timer_needs_enqueuing(timer: *mut RrosTimer) -> bool {
10341034
unsafe {

kernel/rros/control.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub static mut RROS_CONTROL_FACTORY: SpinLock<RrosFactory> = unsafe {
2828
dispose: None,
2929
attrs: None,
3030
flags: crate::factory::RrosFactoryType::SINGLE,
31-
inside: Some(RrosFactoryInside {
31+
inside: RrosFactoryInside {
3232
type_: DeviceType::new(),
3333
class: None,
3434
cdev: None,
@@ -41,7 +41,7 @@ pub static mut RROS_CONTROL_FACTORY: SpinLock<RrosFactory> = unsafe {
4141
name_hash: None,
4242
hash_lock: None,
4343
register: None,
44-
}),
44+
},
4545
})
4646
};
4747

0 commit comments

Comments
 (0)