summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Perttunen <mperttunen@nvidia.com>2021-06-10 14:04:44 +0300
committerThierry Reding <treding@nvidia.com>2021-08-10 14:41:02 +0200
commit17a298e9ac7c011e64a9c0b6f807b43f9af22eac (patch)
tree6102c1eca9012643d6613db2ff08cdf26a142560
parentc78f837ae3d1e532ff4eb90155b42d7a2e892a3f (diff)
downloadlinux-next-17a298e9ac7c011e64a9c0b6f807b43f9af22eac.tar.gz
gpu: host1x: Add job release callback
Add a callback field to the job structure, to be called just before the job is to be freed. This allows the job's submitter to clean up any of its own state, like decrement runtime PM refcounts. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/host1x/job.c3
-rw-r--r--include/linux/host1x.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index 8f59b34672c2..09097e19c0d0 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -79,6 +79,9 @@ static void job_free(struct kref *ref)
{
struct host1x_job *job = container_of(ref, struct host1x_job, ref);
+ if (job->release)
+ job->release(job);
+
if (job->waiter)
host1x_intr_put_ref(job->syncpt->host, job->syncpt->id,
job->waiter, false);
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 8da088ad0b5e..57271ab1fee8 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -268,6 +268,10 @@ struct host1x_job {
/* Fast-forward syncpoint increments on job timeout */
bool syncpt_recovery;
+
+ /* Callback called when job is freed */
+ void (*release)(struct host1x_job *job);
+ void *user_data;
};
struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,