return ret;
}
-static void amdxdna_drm_close(struct drm_device *ddev, struct drm_file *filp)
+static void amdxdna_client_cleanup(struct amdxdna_client *client)
{
- struct amdxdna_client *client = filp->driver_priv;
- struct amdxdna_dev *xdna = to_xdna_dev(ddev);
-
- XDNA_DBG(xdna, "closing pid %d", client->pid);
-
+ list_del(&client->node);
+ amdxdna_hwctx_remove_all(client);
xa_destroy(&client->hwctx_xa);
cleanup_srcu_struct(&client->hwctx_srcu);
mutex_destroy(&client->mm_lock);
+
if (client->dev_heap)
drm_gem_object_put(to_gobj(client->dev_heap));
iommu_sva_unbind_device(client->sva);
- XDNA_DBG(xdna, "pid %d closed", client->pid);
kfree(client);
}
-static int amdxdna_flush(struct file *f, fl_owner_t id)
+static void amdxdna_drm_close(struct drm_device *ddev, struct drm_file *filp)
{
- struct drm_file *filp = f->private_data;
struct amdxdna_client *client = filp->driver_priv;
- struct amdxdna_dev *xdna = client->xdna;
+ struct amdxdna_dev *xdna = to_xdna_dev(ddev);
int idx;
- XDNA_DBG(xdna, "PID %d flushing...", client->pid);
+ XDNA_DBG(xdna, "closing pid %d", client->pid);
+
if (!drm_dev_enter(&xdna->ddev, &idx))
- return 0;
+ return;
mutex_lock(&xdna->dev_lock);
- list_del_init(&client->node);
- amdxdna_hwctx_remove_all(client);
+ amdxdna_client_cleanup(client);
mutex_unlock(&xdna->dev_lock);
drm_dev_exit(idx);
- return 0;
}
static int amdxdna_drm_get_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
.owner = THIS_MODULE,
.open = accel_open,
.release = drm_release,
- .flush = amdxdna_flush,
.unlocked_ioctl = drm_ioctl,
.compat_ioctl = drm_compat_ioctl,
.poll = drm_poll,
client = list_first_entry_or_null(&xdna->client_list,
struct amdxdna_client, node);
while (client) {
- list_del_init(&client->node);
- amdxdna_hwctx_remove_all(client);
+ amdxdna_client_cleanup(client);
client = list_first_entry_or_null(&xdna->client_list,
struct amdxdna_client, node);