diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index 20340825cc4db4429b95bd032f758fd8b8fc65d8..bb4af54c0386c958c6855b957bff552c380657bd 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -350,7 +350,7 @@ static int uacce_fops_open(struct inode *inode, struct file *filep) init_waitqueue_head(&q->wait); filep->private_data = q; q->state = UACCE_Q_INIT; - q->private_data = filep; + q->mapping = filep->f_mapping; mutex_init(&q->mutex); list_add(&q->list, &uacce->queues); mutex_unlock(&uacce->mutex); @@ -1047,8 +1047,6 @@ void uacce_remove(struct uacce_device *uacce) mutex_lock(&uacce->mutex); /* ensure no open queue remains */ list_for_each_entry_safe(q, next_q, &uacce->queues, list) { - struct file *filep = q->private_data; - /* * Taking q->mutex ensures that fops do not use the defunct * uacce->ops after the queue is disabled. @@ -1062,7 +1060,7 @@ void uacce_remove(struct uacce_device *uacce) * unmap remaining mapping from user space, preventing user still * access the mmaped area while parent device is already removed */ - unmap_mapping_range(filep->f_mapping, 0, 0, 1); + unmap_mapping_range(q->mapping, 0, 0, 1); } /* disable sva now since no opened queues */ diff --git a/include/linux/uacce.h b/include/linux/uacce.h index 9b0c04a9cff79d2db89a9335bc1293e8bc3c28ca..8a4bb77b1bc88b5c568dca9872f59b95d66f5094 100644 --- a/include/linux/uacce.h +++ b/include/linux/uacce.h @@ -115,7 +115,7 @@ enum uacce_q_state { * @state: queue state machine * @pasid: pasid associated to the mm * @handle: iommu_sva handle returned by iommu_sva_bind_device() - * @private_data: private data for saving filep + * @mapping: user space mapping of the queue */ struct uacce_queue { struct uacce_device *uacce; @@ -130,7 +130,7 @@ struct uacce_queue { enum uacce_q_state state; u32 pasid; struct iommu_sva *handle; - void *private_data; + struct address_space *mapping; }; /**