* [PATCH] videobuf2-core: modify the num of users
@ 2014-08-14 7:11 panpan liu
2014-08-14 7:25 ` Pawel Osciak
2014-08-14 7:27 ` Hans Verkuil
0 siblings, 2 replies; 3+ messages in thread
From: panpan liu @ 2014-08-14 7:11 UTC (permalink / raw)
To: linux-arm-kernel
If num_users returns 1 or more than 1, that means we are not the
only user of the plane's memory.
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.
*/
- 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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] videobuf2-core: modify the num of users
2014-08-14 7:11 [PATCH] videobuf2-core: modify the num of users panpan liu
@ 2014-08-14 7:25 ` Pawel Osciak
2014-08-14 7:27 ` Hans Verkuil
1 sibling, 0 replies; 3+ messages in thread
From: Pawel Osciak @ 2014-08-14 7:25 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Aug 14, 2014 at 4:11 PM, panpan liu <panpan1.liu@samsung.com> wrote:
> If num_users returns 1 or more than 1, that means we are not the
> only user of the plane's memory.
>
> Signed-off-by: panpan liu <panpan1.liu@samsung.com>
NACK.
Please read the function documentation and how it is used. If the
number of users is 1, we are the only user and should be able to free
the queue. This will make us unable to do so.
> ---
> 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.
> */
> - 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;
> --
> 1.7.9.5
--
Thanks,
Pawel Osciak
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] videobuf2-core: modify the num of users
2014-08-14 7:11 [PATCH] videobuf2-core: modify the num of users panpan liu
2014-08-14 7:25 ` Pawel Osciak
@ 2014-08-14 7:27 ` Hans Verkuil
1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2014-08-14 7:27 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-14 7:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-14 7:11 [PATCH] videobuf2-core: modify the num of users panpan liu
2014-08-14 7:25 ` Pawel Osciak
2014-08-14 7:27 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).