55//! Copyright (C) The Asahi Linux Contributors
66
77use kernel:: {
8- bindings, c_str, device ,
8+ bindings, c_str,
99 iio:: common:: aop_sensors:: { AopSensorData , IIORegistration , MessageProcessor } ,
1010 module_platform_driver,
1111 of:: { self , Node } ,
1212 platform,
1313 prelude:: * ,
1414 soc:: apple:: aop:: { EPICService , AOP } ,
1515 sync:: Arc ,
16- types:: { ARef , ForeignOwnable } ,
16+ types:: ForeignOwnable ,
1717} ;
1818
1919const EPIC_SUBTYPE_SET_ALS_PROPERTY : u16 = 0x4 ;
2020
21- fn enable_als (
22- aop : & dyn AOP ,
23- dev : & ARef < device:: Device > ,
24- of : & Node ,
25- svc : & EPICService ,
26- ) -> Result < ( ) > {
21+ fn enable_als ( aop : & dyn AOP , dev : & platform:: Device , of : & Node , svc : & EPICService ) -> Result < ( ) > {
2722 if let Some ( prop) = of. find_property ( c_str ! ( "apple,als-calibration" ) ) {
2823 set_als_property ( aop, svc, 0xb , prop. value ( ) ) ?;
2924 set_als_property ( aop, svc, 0 , & 200000u32 . to_le_bytes ( ) ) ?;
3025 } else {
31- dev_warn ! ( dev, "ALS Calibration not found, will not enable it" ) ;
26+ dev_warn ! (
27+ dev. as_ref( ) ,
28+ "ALS Calibration not found, will not enable it"
29+ ) ;
3230 }
3331 Ok ( ( ) )
3432}
@@ -85,7 +83,7 @@ impl platform::Driver for IIOAopAlsDriver {
8583 pdev : & mut platform:: Device ,
8684 _info : Option < & ( ) > ,
8785 ) -> Result < Pin < KBox < IIOAopAlsDriver > > > {
88- let dev = pdev. get_device ( ) ;
86+ let dev = pdev. as_ref ( ) ;
8987 let parent = dev. parent ( ) . unwrap ( ) ;
9088 // SAFETY: our parent is AOP, and AopDriver is repr(transparent) for Arc<dyn Aop>
9189 let adata_ptr = unsafe { Pin :: < KBox < Arc < dyn AOP > > > :: borrow ( parent. get_drvdata ( ) ) } ;
@@ -98,9 +96,9 @@ impl platform::Driver for IIOAopAlsDriver {
9896 . get_child_by_name ( c_str ! ( "als" ) )
9997 . ok_or ( EIO ) ?;
10098 let ty = bindings:: BINDINGS_IIO_LIGHT ;
101- let data = AopSensorData :: new ( dev . clone ( ) , ty, MsgProc ( 40 ) ) ?;
99+ let data = AopSensorData :: new ( pdev . clone ( ) , ty, MsgProc ( 40 ) ) ?;
102100 adata. add_fakehid_listener ( service, data. clone ( ) ) ?;
103- enable_als ( adata. as_ref ( ) , & dev , & of, & service) ?;
101+ enable_als ( adata. as_ref ( ) , pdev , & of, & service) ?;
104102 let info_mask = 1 << bindings:: BINDINGS_IIO_CHAN_INFO_PROCESSED ;
105103 Ok ( KBox :: pin (
106104 IIOAopAlsDriver ( IIORegistration :: < MsgProc > :: new (
0 commit comments