@@ -108,8 +108,10 @@ int ntb_msi_setup_mws(struct ntb_dev *ntb)
108
108
if (!ntb -> msi )
109
109
return - EINVAL ;
110
110
111
- desc = first_msi_entry (& ntb -> pdev -> dev );
111
+ msi_lock_descs (& ntb -> pdev -> dev );
112
+ desc = msi_first_desc (& ntb -> pdev -> dev , MSI_DESC_ASSOCIATED );
112
113
addr = desc -> msg .address_lo + ((uint64_t )desc -> msg .address_hi << 32 );
114
+ msi_unlock_descs (& ntb -> pdev -> dev );
113
115
114
116
for (peer = 0 ; peer < ntb_peer_port_count (ntb ); peer ++ ) {
115
117
peer_widx = ntb_peer_highest_mw_idx (ntb , peer );
@@ -281,13 +283,15 @@ int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, irq_handler_t handler,
281
283
const char * name , void * dev_id ,
282
284
struct ntb_msi_desc * msi_desc )
283
285
{
286
+ struct device * dev = & ntb -> pdev -> dev ;
284
287
struct msi_desc * entry ;
285
288
int ret ;
286
289
287
290
if (!ntb -> msi )
288
291
return - EINVAL ;
289
292
290
- for_each_pci_msi_entry (entry , ntb -> pdev ) {
293
+ msi_lock_descs (dev );
294
+ msi_for_each_desc (entry , dev , MSI_DESC_ASSOCIATED ) {
291
295
if (irq_has_action (entry -> irq ))
292
296
continue ;
293
297
@@ -304,14 +308,17 @@ int ntbm_msi_request_threaded_irq(struct ntb_dev *ntb, irq_handler_t handler,
304
308
ret = ntbm_msi_setup_callback (ntb , entry , msi_desc );
305
309
if (ret ) {
306
310
devm_free_irq (& ntb -> dev , entry -> irq , dev_id );
307
- return ret ;
311
+ goto unlock ;
308
312
}
309
313
310
-
311
- return entry -> irq ;
314
+ ret = entry -> irq ;
315
+ goto unlock ;
312
316
}
317
+ ret = - ENODEV ;
313
318
314
- return - ENODEV ;
319
+ unlock :
320
+ msi_unlock_descs (dev );
321
+ return ret ;
315
322
}
316
323
EXPORT_SYMBOL (ntbm_msi_request_threaded_irq );
317
324
0 commit comments