Re: [PATCH v5 11/21] gpu: host1x: Add job release callback

Thierry Reding
2021-03-23T11:56:07Z

[-- Attachment #1: Type: text/plain, Size: 1540 bytes --]

On Mon, Jan 11, 2021 at 03:00:09PM +0200, Mikko Perttunen wrote:
> 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>
> ---
> drivers/gpu/host1x/job.c | 3 +++
> include/linux/host1x.h | 4 ++++
> 2 files changed, 7 insertions(+)
>
> 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 81ca70066c76..d48cab563d5c 100644
> --- a/include/linux/host1x.h
> +++ b/include/linux/host1x.h
> @@ -265,6 +265,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;

It's not clean to me what the user_data is used for. It's not used in
this patch at all, but perhaps it'll become relevant later on. I guess
I'll see.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]