All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU
@ 2012-05-14 10:23 Bob Liu
  2012-05-14 11:31 ` Laurent Pinchart
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Liu @ 2012-05-14 10:23 UTC (permalink / raw)
  To: linux-media
  Cc: laurent.pinchart, mchehab, linux-uvc-devel, uclinux-dist-devel, Bob Liu

Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after framework
updated to use videobuf2.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 drivers/media/video/uvc/uvc_queue.c |   30 ------------------------------
 drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
 2 files changed, 1 insertions(+), 31 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c
index 518f77d..30be060 100644
--- a/drivers/media/video/uvc/uvc_queue.c
+++ b/drivers/media/video/uvc/uvc_queue.c
@@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
 	return allocated;
 }
 
-#ifndef CONFIG_MMU
-/*
- * Get unmapped area.
- *
- * NO-MMU arch need this function to make mmap() work correctly.
- */
-unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
-		unsigned long pgoff)
-{
-	struct uvc_buffer *buffer;
-	unsigned int i;
-	unsigned long ret;
-
-	mutex_lock(&queue->mutex);
-	for (i = 0; i < queue->count; ++i) {
-		buffer = &queue->buffer[i];
-		if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
-			break;
-	}
-	if (i == queue->count) {
-		ret = -EINVAL;
-		goto done;
-	}
-	ret = (unsigned long)buf->mem;
-done:
-	mutex_unlock(&queue->mutex);
-	return ret;
-}
-#endif
-
 /*
  * Enable or disable the video buffers queue.
  *
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 2ae4f88..506d3d6 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
 
 	uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
 
-	return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
+	return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
 }
 #endif
 
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU
  2012-05-14 10:23 [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU Bob Liu
@ 2012-05-14 11:31 ` Laurent Pinchart
  2012-05-15  1:01   ` Bob Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Pinchart @ 2012-05-14 11:31 UTC (permalink / raw)
  To: Bob Liu; +Cc: linux-media, mchehab, linux-uvc-devel, uclinux-dist-devel

Hi Bob,

On Monday 14 May 2012 18:23:59 Bob Liu wrote:
> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
> framework updated to use videobuf2.

Thank you for the patch, but I'm afraid you're too late. The fix is already 
queued for v3.5 :-)

> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
>  drivers/media/video/uvc/uvc_queue.c |   30 ------------------------------
>  drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
>  2 files changed, 1 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/media/video/uvc/uvc_queue.c
> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
> --- a/drivers/media/video/uvc/uvc_queue.c
> +++ b/drivers/media/video/uvc/uvc_queue.c
> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>  	return allocated;
>  }
> 
> -#ifndef CONFIG_MMU
> -/*
> - * Get unmapped area.
> - *
> - * NO-MMU arch need this function to make mmap() work correctly.
> - */
> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
> -		unsigned long pgoff)
> -{
> -	struct uvc_buffer *buffer;
> -	unsigned int i;
> -	unsigned long ret;
> -
> -	mutex_lock(&queue->mutex);
> -	for (i = 0; i < queue->count; ++i) {
> -		buffer = &queue->buffer[i];
> -		if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
> -			break;
> -	}
> -	if (i == queue->count) {
> -		ret = -EINVAL;
> -		goto done;
> -	}
> -	ret = (unsigned long)buf->mem;
> -done:
> -	mutex_unlock(&queue->mutex);
> -	return ret;
> -}
> -#endif
> -
>  /*
>   * Enable or disable the video buffers queue.
>   *
> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
> --- a/drivers/media/video/uvc/uvc_v4l2.c
> +++ b/drivers/media/video/uvc/uvc_v4l2.c
> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
> file *file,
> 
>  	uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
> 
> -	return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
> +	return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);

Just for the record you would have needed to take the queue->mutex around the 
vb2_get_unmapped_area() call here.

>  }
>  #endif

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU
  2012-05-14 11:31 ` Laurent Pinchart
@ 2012-05-15  1:01   ` Bob Liu
  2012-05-15  6:15     ` Bob Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Liu @ 2012-05-15  1:01 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, mchehab, linux-uvc-devel, uclinux-dist-devel

Hi Laurent,

On Mon, May 14, 2012 at 7:31 PM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> Hi Bob,
>
> On Monday 14 May 2012 18:23:59 Bob Liu wrote:
>> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
>> framework updated to use videobuf2.
>
> Thank you for the patch, but I'm afraid you're too late. The fix is already
> queued for v3.5 :-)

It doesn't matter.

>
>> Signed-off-by: Bob Liu <lliubbo@gmail.com>
>> ---
>>  drivers/media/video/uvc/uvc_queue.c |   30 ------------------------------
>>  drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
>>  2 files changed, 1 insertions(+), 31 deletions(-)
>>
>> diff --git a/drivers/media/video/uvc/uvc_queue.c
>> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
>> --- a/drivers/media/video/uvc/uvc_queue.c
>> +++ b/drivers/media/video/uvc/uvc_queue.c
>> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>>       return allocated;
>>  }
>>
>> -#ifndef CONFIG_MMU
>> -/*
>> - * Get unmapped area.
>> - *
>> - * NO-MMU arch need this function to make mmap() work correctly.
>> - */
>> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
>> -             unsigned long pgoff)
>> -{
>> -     struct uvc_buffer *buffer;
>> -     unsigned int i;
>> -     unsigned long ret;
>> -
>> -     mutex_lock(&queue->mutex);
>> -     for (i = 0; i < queue->count; ++i) {
>> -             buffer = &queue->buffer[i];
>> -             if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
>> -                     break;
>> -     }
>> -     if (i == queue->count) {
>> -             ret = -EINVAL;
>> -             goto done;
>> -     }
>> -     ret = (unsigned long)buf->mem;
>> -done:
>> -     mutex_unlock(&queue->mutex);
>> -     return ret;
>> -}
>> -#endif
>> -
>>  /*
>>   * Enable or disable the video buffers queue.
>>   *
>> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
>> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
>> --- a/drivers/media/video/uvc/uvc_v4l2.c
>> +++ b/drivers/media/video/uvc/uvc_v4l2.c
>> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
>> file *file,
>>
>>       uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
>>
>> -     return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
>> +     return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
>
> Just for the record you would have needed to take the queue->mutex around the
> vb2_get_unmapped_area() call here.
>

okay, i'll send out v2 soon, please queue it for next window.
Thank you.

>>  }
>>  #endif
>
> --
> Regards,
>
> Laurent Pinchart
>

-- 
Regards,
--Bob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU
  2012-05-15  1:01   ` Bob Liu
@ 2012-05-15  6:15     ` Bob Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Bob Liu @ 2012-05-15  6:15 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-media, mchehab, linux-uvc-devel, uclinux-dist-devel

Hi Laurent,

On Tue, May 15, 2012 at 9:01 AM, Bob Liu <lliubbo@gmail.com> wrote:
> Hi Laurent,
>
> On Mon, May 14, 2012 at 7:31 PM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>> Hi Bob,
>>
>> On Monday 14 May 2012 18:23:59 Bob Liu wrote:
>>> Fix uvc_v4l2_get_unmapped_area() for NOMMU arch like blackfin after
>>> framework updated to use videobuf2.
>>
>> Thank you for the patch, but I'm afraid you're too late. The fix is already
>> queued for v3.5 :-)
>
> It doesn't matter.

Sorry for my misunderstanding. I've seen the fix in the queue for v3.5.
Please ignore my noise.

>
>>
>>> Signed-off-by: Bob Liu <lliubbo@gmail.com>
>>> ---
>>>  drivers/media/video/uvc/uvc_queue.c |   30 ------------------------------
>>>  drivers/media/video/uvc/uvc_v4l2.c  |    2 +-
>>>  2 files changed, 1 insertions(+), 31 deletions(-)
>>>
>>> diff --git a/drivers/media/video/uvc/uvc_queue.c
>>> b/drivers/media/video/uvc/uvc_queue.c index 518f77d..30be060 100644
>>> --- a/drivers/media/video/uvc/uvc_queue.c
>>> +++ b/drivers/media/video/uvc/uvc_queue.c
>>> @@ -237,36 +237,6 @@ int uvc_queue_allocated(struct uvc_video_queue *queue)
>>>       return allocated;
>>>  }
>>>
>>> -#ifndef CONFIG_MMU
>>> -/*
>>> - * Get unmapped area.
>>> - *
>>> - * NO-MMU arch need this function to make mmap() work correctly.
>>> - */
>>> -unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
>>> -             unsigned long pgoff)
>>> -{
>>> -     struct uvc_buffer *buffer;
>>> -     unsigned int i;
>>> -     unsigned long ret;
>>> -
>>> -     mutex_lock(&queue->mutex);
>>> -     for (i = 0; i < queue->count; ++i) {
>>> -             buffer = &queue->buffer[i];
>>> -             if ((buffer->buf.m.offset >> PAGE_SHIFT) == pgoff)
>>> -                     break;
>>> -     }
>>> -     if (i == queue->count) {
>>> -             ret = -EINVAL;
>>> -             goto done;
>>> -     }
>>> -     ret = (unsigned long)buf->mem;
>>> -done:
>>> -     mutex_unlock(&queue->mutex);
>>> -     return ret;
>>> -}
>>> -#endif
>>> -
>>>  /*
>>>   * Enable or disable the video buffers queue.
>>>   *
>>> diff --git a/drivers/media/video/uvc/uvc_v4l2.c
>>> b/drivers/media/video/uvc/uvc_v4l2.c index 2ae4f88..506d3d6 100644
>>> --- a/drivers/media/video/uvc/uvc_v4l2.c
>>> +++ b/drivers/media/video/uvc/uvc_v4l2.c
>>> @@ -1067,7 +1067,7 @@ static unsigned long uvc_v4l2_get_unmapped_area(struct
>>> file *file,
>>>
>>>       uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
>>>
>>> -     return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
>>> +     return vb2_get_unmapped_area(&stream->queue, addr, len, pgoff, flags);
>>
>> Just for the record you would have needed to take the queue->mutex around the
>> vb2_get_unmapped_area() call here.
>>
>
> okay, i'll send out v2 soon, please queue it for next window.
> Thank you.
>
>>>  }
>>>  #endif
>>
>> --
>> Regards,
>>
>> Laurent Pinchart
>>
>
> --
> Regards,
> --Bob

-- 
Regards,
--Bob

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-15  6:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-14 10:23 [PATCH] drivers:media:video:uvc: fix uvc_v4l2_get_unmapped_area for NOMMU Bob Liu
2012-05-14 11:31 ` Laurent Pinchart
2012-05-15  1:01   ` Bob Liu
2012-05-15  6:15     ` Bob Liu

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.