1 use alloc::sync::Arc; 2 use intertrait::cast::CastArc; 3 4 use crate::driver::base::kobject::KObject; 5 6 use super::{sysfs::RtcGeneralDevice, RtcDevice}; 7 8 #[inline] kobj2rtc_device(kobj: Arc<dyn KObject>) -> Option<Arc<dyn RtcDevice>>9pub fn kobj2rtc_device(kobj: Arc<dyn KObject>) -> Option<Arc<dyn RtcDevice>> { 10 kobj.arc_any().cast::<dyn RtcDevice>().ok() 11 } 12 13 #[inline] kobj2rtc_general_device(kobj: Arc<dyn KObject>) -> Option<Arc<RtcGeneralDevice>>14pub fn kobj2rtc_general_device(kobj: Arc<dyn KObject>) -> Option<Arc<RtcGeneralDevice>> { 15 kobj.arc_any().downcast().ok() 16 } 17