dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/omap: add omap_gem_put_paddr_locked()
Date: Fri, 11 Aug 2017 17:09:39 +0300	[thread overview]
Message-ID: <5041020.1onIhTlkDQ@avalon> (raw)
In-Reply-To: <1494233482-23403-2-git-send-email-tomi.valkeinen@ti.com>

Hi Tomi,

Thank you for the patch.

On Monday 08 May 2017 11:51:21 Tomi Valkeinen wrote:
> Add omap_gem_put_paddr_locked() which is a version of
> omap_gem_put_paddr() that expects the caller to hold the struct_mutex.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_gem.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c
> b/drivers/gpu/drm/omapdrm/omap_gem.c index 68a75b829b71..5d73dccc1383
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -873,12 +873,12 @@ int omap_gem_get_paddr(struct drm_gem_object *obj,
>  /* Release physical address, when DMA is no longer being performed.. this
>   * could potentially unpin and unmap buffers from TILER
>   */
> -void omap_gem_put_paddr(struct drm_gem_object *obj)
> +
> +static void omap_gem_put_paddr_locked(struct drm_gem_object *obj)
>  {
>  	struct omap_gem_object *omap_obj = to_omap_bo(obj);
>  	int ret;
> 
> -	mutex_lock(&obj->dev->struct_mutex);
>  	if (omap_obj->paddr_cnt > 0) {
>  		omap_obj->paddr_cnt--;
>  		if (omap_obj->paddr_cnt == 0) {

You could now decrease the indentation level in this function by adding a few 
returns. This doesn't call for a v2, but as you'll have to rebase anyway due 
to the function name change, you can throw that change in at the same time :-)

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

On a side note, it might be worth it changing the count field to a refcount_t, 
this would give us a WARN_ON() if the pin/unpin calls are unbalanced.

> @@ -896,7 +896,12 @@ void omap_gem_put_paddr(struct drm_gem_object *obj)
>  			omap_obj->block = NULL;
>  		}
>  	}
> +}
> 
> +void omap_gem_put_paddr(struct drm_gem_object *obj)
> +{
> +	mutex_lock(&obj->dev->struct_mutex);
> +	omap_gem_put_paddr_locked(obj);
>  	mutex_unlock(&obj->dev->struct_mutex);
>  }

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-08-11 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-08  8:51 [PATCH 0/2] drm/omap: OMAP_BO flags Tomi Valkeinen
2017-05-08  8:51 ` [PATCH 1/2] drm/omap: add omap_gem_put_paddr_locked() Tomi Valkeinen
2017-05-09  7:23   ` Jyri Sarha
2017-08-11 14:09   ` Laurent Pinchart [this message]
2017-08-14 10:53     ` Tomi Valkeinen
2017-05-08  8:51 ` [PATCH 2/2] drm/omap: add OMAP_BO flags to affect buffer allocation Tomi Valkeinen
2017-08-11 14:23   ` Laurent Pinchart
2017-08-14 11:02     ` Tomi Valkeinen
2017-08-14 12:06       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5041020.1onIhTlkDQ@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jsarha@ti.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox