File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -526,11 +526,7 @@ void iommufd_device_detach(struct iommufd_device *idev)
526
526
struct iommufd_hw_pagetable * hwpt ;
527
527
528
528
hwpt = iommufd_hw_pagetable_detach (idev );
529
- if (hwpt -> auto_domain )
530
- iommufd_object_destroy_user (idev -> ictx , & hwpt -> obj );
531
- else
532
- refcount_dec (& hwpt -> obj .users );
533
-
529
+ iommufd_hw_pagetable_put (idev -> ictx , hwpt );
534
530
refcount_dec (& idev -> obj .users );
535
531
}
536
532
EXPORT_SYMBOL_NS_GPL (iommufd_device_detach , IOMMUFD );
Original file line number Diff line number Diff line change @@ -260,6 +260,16 @@ struct iommufd_hw_pagetable *
260
260
iommufd_hw_pagetable_detach (struct iommufd_device * idev );
261
261
void iommufd_hw_pagetable_destroy (struct iommufd_object * obj );
262
262
263
+ static inline void iommufd_hw_pagetable_put (struct iommufd_ctx * ictx ,
264
+ struct iommufd_hw_pagetable * hwpt )
265
+ {
266
+ lockdep_assert_not_held (& hwpt -> ioas -> mutex );
267
+ if (hwpt -> auto_domain )
268
+ iommufd_object_destroy_user (ictx , & hwpt -> obj );
269
+ else
270
+ refcount_dec (& hwpt -> obj .users );
271
+ }
272
+
263
273
struct iommufd_group {
264
274
struct kref ref ;
265
275
struct mutex lock ;
You can’t perform that action at this time.
0 commit comments