All of lore.kernel.org
 help / color / mirror / Atom feed
From: hverkuil@xs4all.nl (Hans Verkuil)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] videobuf2-core: modify the num of users
Date: Thu, 14 Aug 2014 09:27:09 +0200	[thread overview]
Message-ID: <53EC64CD.8020709@xs4all.nl> (raw)
In-Reply-To: <1408000262-2774-1-git-send-email-panpan1.liu@samsung.com>

Hi,

I've got a few questions:

On 08/14/2014 09:11 AM, panpan liu wrote:
> If num_users returns 1 or more than 1, that means we are not the
> only user of the plane's memory.

Why do think this is wrong? When the buffer is allocated the refcount is set to 1,
so anyone mapping that buffer will increase the refcount making it 'in use'.

Seems perfectly OK to me.

So if your patch solves a problem for you, then I'd like to know what that problem
is. You might be solving it in the wrong place.

>
> Signed-off-by: panpan liu <panpan1.liu@samsung.com>
> ---
>   drivers/media/v4l2-core/videobuf2-core.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index c359006..d3a4b8f 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -625,7 +625,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
>   		 * case anyway. If num_users() returns more than 1,
>   		 * we are not the only user of the plane's memory.

And even if there was a bug, then your patch is incomplete because you didn't update
the comment.

>   		 */
> -		if (mem_priv && call_memop(vb, num_users, mem_priv) > 1)
> +		if (mem_priv && call_memop(vb, num_users, mem_priv) >= 1)
>   			return true;
>   	}
>   	return false;
>

Regards,

	Hans

WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil@xs4all.nl>
To: panpan liu <panpan1.liu@samsung.com>,
	kyungmin.park@samsung.com, k.debski@samsung.com,
	jtp.park@samsung.com, mchehab@redhat.com
Cc: linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org
Subject: Re: [PATCH] videobuf2-core: modify the num of users
Date: Thu, 14 Aug 2014 09:27:09 +0200	[thread overview]
Message-ID: <53EC64CD.8020709@xs4all.nl> (raw)
In-Reply-To: <1408000262-2774-1-git-send-email-panpan1.liu@samsung.com>

Hi,

I've got a few questions:

On 08/14/2014 09:11 AM, panpan liu wrote:
> If num_users returns 1 or more than 1, that means we are not the
> only user of the plane's memory.

Why do think this is wrong? When the buffer is allocated the refcount is set to 1,
so anyone mapping that buffer will increase the refcount making it 'in use'.

Seems perfectly OK to me.

So if your patch solves a problem for you, then I'd like to know what that problem
is. You might be solving it in the wrong place.

>
> Signed-off-by: panpan liu <panpan1.liu@samsung.com>
> ---
>   drivers/media/v4l2-core/videobuf2-core.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index c359006..d3a4b8f 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -625,7 +625,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb)
>   		 * case anyway. If num_users() returns more than 1,
>   		 * we are not the only user of the plane's memory.

And even if there was a bug, then your patch is incomplete because you didn't update
the comment.

>   		 */
> -		if (mem_priv && call_memop(vb, num_users, mem_priv) > 1)
> +		if (mem_priv && call_memop(vb, num_users, mem_priv) >= 1)
>   			return true;
>   	}
>   	return false;
>

Regards,

	Hans

  parent reply	other threads:[~2014-08-14  7:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-14  7:11 [PATCH] videobuf2-core: modify the num of users panpan liu
2014-08-14  7:11 ` panpan liu
2014-08-14  7:25 ` Pawel Osciak
2014-08-14  7:25   ` Pawel Osciak
2014-08-14  7:27 ` Hans Verkuil [this message]
2014-08-14  7:27   ` Hans Verkuil

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=53EC64CD.8020709@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.