mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-26 23:33:22 +00:00
修复内核的clippy检查报错 (#637)
修复内核的clippy检查报错 --------- Co-authored-by: Samuel Dai <947309196@qq.com> Co-authored-by: Donkey Kane <109840258+xiaolin2004@users.noreply.github.com> Co-authored-by: themildwind <107623059+themildwind@users.noreply.github.com> Co-authored-by: GnoCiYeH <heyicong@dragonos.org> Co-authored-by: MemoryShore <105195940+MemoryShore@users.noreply.github.com> Co-authored-by: 曾俊 <110876916+ZZJJWarth@users.noreply.github.com> Co-authored-by: sun5etop <146408999+sun5etop@users.noreply.github.com> Co-authored-by: hmt <114841534+1037827920@users.noreply.github.com> Co-authored-by: laokengwt <143977175+laokengwt@users.noreply.github.com> Co-authored-by: TTaq <103996388+TTaq@users.noreply.github.com> Co-authored-by: Jomo <2512364506@qq.com> Co-authored-by: Samuel Dai <samuka007@qq.com> Co-authored-by: sspphh <112558065+sspphh@users.noreply.github.com>
This commit is contained in:
@ -25,12 +25,12 @@ static mut __MAMAGER: Option<VideoRefreshManager> = None;
|
||||
|
||||
pub fn video_refresh_manager() -> &'static VideoRefreshManager {
|
||||
return unsafe {
|
||||
&__MAMAGER
|
||||
__MAMAGER
|
||||
.as_ref()
|
||||
.expect("Video refresh manager has not been initialized yet!")
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
///管理显示刷新变量的结构体
|
||||
pub struct VideoRefreshManager {
|
||||
device_buffer: RwLock<ScmBufferInfo>,
|
||||
@ -69,11 +69,7 @@ impl VideoRefreshManager {
|
||||
let res = self
|
||||
.running
|
||||
.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst);
|
||||
if res.is_ok() {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return res.is_ok();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,7 +148,7 @@ impl VideoRefreshManager {
|
||||
}
|
||||
return Err(SystemError::EINVAL);
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
#[allow(dead_code)]
|
||||
pub fn refresh_target(&self) -> RwLockReadGuard<'_, Option<Arc<SpinLock<Box<[u32]>>>>> {
|
||||
let x = self.refresh_target.read();
|
||||
@ -244,6 +240,7 @@ impl TimerFunction for VideoRefreshExecutor {
|
||||
* @brief 交给定时器执行的任务,此方法不应手动调用
|
||||
* @return Ok(())
|
||||
*/
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn run(&mut self) -> Result<(), SystemError> {
|
||||
// 获得Manager
|
||||
let manager = video_refresh_manager();
|
||||
@ -276,7 +273,7 @@ impl TimerFunction for VideoRefreshExecutor {
|
||||
let refresh_target = refresh_target.unwrap();
|
||||
|
||||
if let ScmBuffer::DeviceBuffer(vaddr) = manager.device_buffer().buf {
|
||||
let p = vaddr.as_ptr() as *mut u8;
|
||||
let p: *mut u8 = vaddr.as_ptr();
|
||||
let mut target_guard = None;
|
||||
for _ in 0..2 {
|
||||
if let Ok(guard) = refresh_target.as_ref().unwrap().try_lock_irqsave() {
|
||||
|
Reference in New Issue
Block a user