65
65
#include <linux/mailbox_controller.h>
66
66
#include <linux/mailbox_client.h>
67
67
#include <linux/io-64-nonatomic-lo-hi.h>
68
+ #include <acpi/pcc.h>
68
69
69
70
#include "mailbox.h"
70
71
@@ -267,6 +268,8 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
267
268
if (chan -> txdone_method == TXDONE_BY_POLL && cl -> knows_txdone )
268
269
chan -> txdone_method |= TXDONE_BY_ACK ;
269
270
271
+ spin_unlock_irqrestore (& chan -> lock , flags );
272
+
270
273
if (pcc_doorbell_irq [subspace_id ] > 0 ) {
271
274
int rc ;
272
275
@@ -275,12 +278,11 @@ struct mbox_chan *pcc_mbox_request_channel(struct mbox_client *cl,
275
278
if (unlikely (rc )) {
276
279
dev_err (dev , "failed to register PCC interrupt %d\n" ,
277
280
pcc_doorbell_irq [subspace_id ]);
281
+ pcc_mbox_free_channel (chan );
278
282
chan = ERR_PTR (rc );
279
283
}
280
284
}
281
285
282
- spin_unlock_irqrestore (& chan -> lock , flags );
283
-
284
286
return chan ;
285
287
}
286
288
EXPORT_SYMBOL_GPL (pcc_mbox_request_channel );
@@ -304,20 +306,19 @@ void pcc_mbox_free_channel(struct mbox_chan *chan)
304
306
return ;
305
307
}
306
308
309
+ if (pcc_doorbell_irq [id ] > 0 )
310
+ devm_free_irq (chan -> mbox -> dev , pcc_doorbell_irq [id ], chan );
311
+
307
312
spin_lock_irqsave (& chan -> lock , flags );
308
313
chan -> cl = NULL ;
309
314
chan -> active_req = NULL ;
310
315
if (chan -> txdone_method == (TXDONE_BY_POLL | TXDONE_BY_ACK ))
311
316
chan -> txdone_method = TXDONE_BY_POLL ;
312
317
313
- if (pcc_doorbell_irq [id ] > 0 )
314
- devm_free_irq (chan -> mbox -> dev , pcc_doorbell_irq [id ], chan );
315
-
316
318
spin_unlock_irqrestore (& chan -> lock , flags );
317
319
}
318
320
EXPORT_SYMBOL_GPL (pcc_mbox_free_channel );
319
321
320
-
321
322
/**
322
323
* pcc_send_data - Called from Mailbox Controller code. Used
323
324
* here only to ring the channel doorbell. The PCC client
0 commit comments