@@ -40,6 +40,7 @@ struct PL061DataInner {
4040}
4141
4242struct PL061Data {
43+ dev : device:: Device ,
4344 inner : SpinLock < PL061DataInner > ,
4445}
4546
@@ -148,7 +149,8 @@ impl irq::Chip for PL061Device {
148149 if trigger & ( irq:: Type :: LEVEL_HIGH | irq:: Type :: LEVEL_LOW ) != 0
149150 && trigger & ( irq:: Type :: EDGE_RISING | irq:: Type :: EDGE_FALLING ) != 0
150151 {
151- pr_err ! (
152+ dev_err ! (
153+ data. dev,
152154 "trying to configure line {} for both level and edge detection, choose one!\n " ,
153155 offset
154156 ) ;
@@ -176,7 +178,8 @@ impl irq::Chip for PL061Device {
176178 gpioiev &= !bit;
177179 }
178180 irq_data. set_level_handler ( ) ;
179- pr_debug ! (
181+ dev_dbg ! (
182+ data. dev,
180183 "line {}: IRQ on {} level\n " ,
181184 offset,
182185 if polarity { "HIGH" } else { "LOW" }
@@ -187,7 +190,7 @@ impl irq::Chip for PL061Device {
187190 // Select both edges, settings this makes GPIOEV be ignored.
188191 gpioibe |= bit;
189192 irq_data. set_edge_handler ( ) ;
190- pr_debug ! ( "line {}: IRQ on both edges\n " , offset) ;
193+ dev_dbg ! ( data . dev , "line {}: IRQ on both edges\n " , offset) ;
191194 } else if trigger & ( irq:: Type :: EDGE_RISING | irq:: Type :: EDGE_FALLING ) != 0 {
192195 let rising = trigger & irq:: Type :: EDGE_RISING != 0 ;
193196
@@ -202,7 +205,8 @@ impl irq::Chip for PL061Device {
202205 gpioiev &= !bit;
203206 }
204207 irq_data. set_edge_handler ( ) ;
205- pr_debug ! (
208+ dev_dbg ! (
209+ data. dev,
206210 "line {}: IRQ on {} edge\n " ,
207211 offset,
208212 if rising { "RISING" } else { "FALLING}" }
@@ -213,7 +217,7 @@ impl irq::Chip for PL061Device {
213217 gpioibe &= !bit;
214218 gpioiev &= !bit;
215219 irq_data. set_bad_handler ( ) ;
216- pr_warn ! ( "no trigger selected for line {}\n " , offset) ;
220+ dev_warn ! ( data . dev , "no trigger selected for line {}\n " , offset) ;
217221 }
218222
219223 pl061. base . writeb ( gpiois, GPIOIS ) ;
@@ -278,6 +282,7 @@ impl amba::Driver for PL061Device {
278282 parent_irq: irq,
279283 } ,
280284 PL061Data {
285+ dev: device:: Device :: from_dev( dev) ,
281286 // SAFETY: We call `spinlock_init` below.
282287 inner: unsafe { SpinLock :: new( PL061DataInner :: default ( ) ) } ,
283288 } ,
@@ -297,7 +302,7 @@ impl amba::Driver for PL061Device {
297302 . as_pinned_mut ( )
298303 . register :: < Self > ( PL061_GPIO_NR , None , dev, data. clone ( ) , irq) ?;
299304
300- pr_info ! ( "PL061 GPIO chip registered\n " ) ;
305+ dev_info ! ( data . dev , "PL061 GPIO chip registered\n " ) ;
301306
302307 Ok ( data)
303308 }
0 commit comments