@@ -172,12 +172,11 @@ static void pnv_ocxl_fixup_actag(struct pci_dev *dev)
172
172
if (phb -> type != PNV_PHB_NPU_OCAPI )
173
173
return ;
174
174
175
- mutex_lock (& links_list_lock );
175
+ guard ( mutex ) (& links_list_lock );
176
176
177
177
link = find_link (dev );
178
178
if (!link ) {
179
179
dev_warn (& dev -> dev , "couldn't update actag information\n" );
180
- mutex_unlock (& links_list_lock );
181
180
return ;
182
181
}
183
182
@@ -206,7 +205,6 @@ static void pnv_ocxl_fixup_actag(struct pci_dev *dev)
206
205
dev_dbg (& dev -> dev , "total actags for function: %d\n" ,
207
206
link -> fn_desired_actags [PCI_FUNC (dev -> devfn )]);
208
207
209
- mutex_unlock (& links_list_lock );
210
208
}
211
209
DECLARE_PCI_FIXUP_HEADER (PCI_ANY_ID , PCI_ANY_ID , pnv_ocxl_fixup_actag );
212
210
@@ -253,12 +251,11 @@ int pnv_ocxl_get_actag(struct pci_dev *dev, u16 *base, u16 *enabled,
253
251
{
254
252
struct npu_link * link ;
255
253
256
- mutex_lock (& links_list_lock );
254
+ guard ( mutex ) (& links_list_lock );
257
255
258
256
link = find_link (dev );
259
257
if (!link ) {
260
258
dev_err (& dev -> dev , "actag information not found\n" );
261
- mutex_unlock (& links_list_lock );
262
259
return - ENODEV ;
263
260
}
264
261
/*
@@ -274,7 +271,6 @@ int pnv_ocxl_get_actag(struct pci_dev *dev, u16 *base, u16 *enabled,
274
271
* enabled = link -> fn_actags [PCI_FUNC (dev -> devfn )].count ;
275
272
* supported = link -> fn_desired_actags [PCI_FUNC (dev -> devfn )];
276
273
277
- mutex_unlock (& links_list_lock );
278
274
return 0 ;
279
275
}
280
276
EXPORT_SYMBOL_GPL (pnv_ocxl_get_actag );
@@ -293,12 +289,11 @@ int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *count)
293
289
*
294
290
* We only support one AFU-carrying function for now.
295
291
*/
296
- mutex_lock (& links_list_lock );
292
+ guard ( mutex ) (& links_list_lock );
297
293
298
294
link = find_link (dev );
299
295
if (!link ) {
300
296
dev_err (& dev -> dev , "actag information not found\n" );
301
- mutex_unlock (& links_list_lock );
302
297
return - ENODEV ;
303
298
}
304
299
@@ -309,7 +304,6 @@ int pnv_ocxl_get_pasid_count(struct pci_dev *dev, int *count)
309
304
break ;
310
305
}
311
306
312
- mutex_unlock (& links_list_lock );
313
307
dev_dbg (& dev -> dev , "%d PASIDs available for function\n" ,
314
308
rc ? 0 : * count );
315
309
return rc ;
0 commit comments