cron job: media_tree daily build: ERRORS

2016-12-26 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Tue Dec 27 05:00:12 CET 2016
media-tree git hash:bd361f5de2b338218c276d17a510701a16075deb
media_build git hash:   1606032398b1d79149c1507be2029e1a00d8dff0
v4l-utils git hash: c9aacef24d152007c7344b691da0cc90788395a7
gcc version:i686-linux-gcc (GCC) 6.2.0
sparse version: v0.5.0-3553-g78b2ea6
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.8.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: ERRORS
linux-3.11.1-i686: ERRORS
linux-3.12.67-i686: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0.9-i686: ERRORS
linux-4.1.33-i686: ERRORS
linux-4.2.8-i686: ERRORS
linux-4.3.6-i686: ERRORS
linux-4.4.22-i686: ERRORS
linux-4.5.7-i686: ERRORS
linux-4.6.7-i686: ERRORS
linux-4.7.5-i686: ERRORS
linux-4.8-i686: ERRORS
linux-4.9-i686: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: ERRORS
linux-3.11.1-x86_64: ERRORS
linux-3.12.67-x86_64: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0.9-x86_64: ERRORS
linux-4.1.33-x86_64: ERRORS
linux-4.2.8-x86_64: ERRORS
linux-4.3.6-x86_64: ERRORS
linux-4.4.22-x86_64: ERRORS
linux-4.5.7-x86_64: ERRORS
linux-4.6.7-x86_64: ERRORS
linux-4.7.5-x86_64: ERRORS
linux-4.8-x86_64: ERRORS
linux-4.9-x86_64: ERRORS
apps: WARNINGS
spec-git: ERRORS
sparse: WARNINGS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Tuesday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] [media] videobuf-dma-sg: Use kmalloc_array() in videobuf_dma_init_user_locked()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 19:46:56 +0100

* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "kmalloc_array".

  This issue was detected by using the Coccinelle software.

* Replace the specification of a data type by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index ba63ca57ed7e..ab3c1f6a2ca1 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -175,7 +175,9 @@ static int videobuf_dma_init_user_locked(struct 
videobuf_dmabuf *dma,
dma->offset = data & ~PAGE_MASK;
dma->size = size;
dma->nr_pages = last-first+1;
-   dma->pages = kmalloc(dma->nr_pages * sizeof(struct page *), GFP_KERNEL);
+   dma->pages = kmalloc_array(dma->nr_pages,
+  sizeof(*dma->pages),
+  GFP_KERNEL);
if (NULL == dma->pages)
return -ENOMEM;
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8] [media] videobuf-dma-sg: Add some spaces for better code readability in videobuf_dma_init_user_locked()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 21:16:51 +0100

Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index c8658530da57..9f560373d49d 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -171,10 +171,10 @@ static int videobuf_dma_init_user_locked(struct 
videobuf_dmabuf *dma,
}
 
first = (data  & PAGE_MASK) >> PAGE_SHIFT;
-   last  = ((data+size-1) & PAGE_MASK) >> PAGE_SHIFT;
+   last  = ((data + size - 1) & PAGE_MASK) >> PAGE_SHIFT;
dma->offset = data & ~PAGE_MASK;
dma->size = size;
-   dma->nr_pages = last-first+1;
+   dma->nr_pages = last - first + 1;
dma->pages = kmalloc_array(dma->nr_pages,
   sizeof(*dma->pages),
   GFP_KERNEL);
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/8] [media] videobuf-dma-sg: Delete an unnecessary return statement in videobuf_vm_close()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 21:09:01 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement here.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 070ba10bbdbc..c8658530da57 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -427,7 +427,6 @@ static void videobuf_vm_close(struct vm_area_struct *vma)
videobuf_queue_unlock(q);
kfree(map);
}
-   return;
 }
 
 /*
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] [media] videobuf-dma-sg: Improve a size determination in __videobuf_mmap_mapper()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 20:56:41 +0100

Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index d09ddf2e56fe..070ba10bbdbc 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -618,7 +618,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
last = first;
 
/* create mapping + update buffer list */
-   map = kmalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
+   map = kmalloc(sizeof(*map), GFP_KERNEL);
if (!map) {
retval = -ENOMEM;
goto done;
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] [media] videobuf-dma-sg: Move two assignments for error codes in __videobuf_mmap_mapper()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 20:48:50 +0100

Move two assignments for the local variable "retval" so that these statements
will only be executed if a previous action failed in this function.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index 9ccdc11aa016..d09ddf2e56fe 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -596,8 +596,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
unsigned int first, last, size = 0, i;
int retval;
 
-   retval = -EINVAL;
-
BUG_ON(!mem);
MAGIC_CHECK(mem->magic, MAGIC_SG_MEM);
 
@@ -613,16 +611,18 @@ static int __videobuf_mmap_mapper(struct videobuf_queue 
*q,
if (!size) {
dprintk(1, "mmap app bug: offset invalid [offset=0x%lx]\n",
(vma->vm_pgoff << PAGE_SHIFT));
+   retval = -EINVAL;
goto done;
}
 
last = first;
 
/* create mapping + update buffer list */
-   retval = -ENOMEM;
map = kmalloc(sizeof(struct videobuf_mapping), GFP_KERNEL);
-   if (!map)
+   if (!map) {
+   retval = -ENOMEM;
goto done;
+   }
 
size = 0;
for (i = first; i <= last; i++) {
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] [media] videobuf-dma-sg: Adjust 24 checks for null values

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 20:30:19 +0100

Convert comparisons with the preprocessor symbol "NULL" or the value "0"
to condition checks without it.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 48 +++
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf-dma-sg.c 
b/drivers/media/v4l2-core/videobuf-dma-sg.c
index ab3c1f6a2ca1..9ccdc11aa016 100644
--- a/drivers/media/v4l2-core/videobuf-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf-dma-sg.c
@@ -70,12 +70,12 @@ static struct scatterlist *videobuf_vmalloc_to_sg(unsigned 
char *virt,
int i;
 
sglist = vzalloc(nr_pages * sizeof(*sglist));
-   if (NULL == sglist)
+   if (!sglist)
return NULL;
sg_init_table(sglist, nr_pages);
for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) {
pg = vmalloc_to_page(virt);
-   if (NULL == pg)
+   if (!pg)
goto err;
BUG_ON(PageHighMem(pg));
sg_set_page([i], pg, PAGE_SIZE, 0);
@@ -98,10 +98,10 @@ static struct scatterlist *videobuf_pages_to_sg(struct page 
**pages,
struct scatterlist *sglist;
int i;
 
-   if (NULL == pages[0])
+   if (!pages[0])
return NULL;
sglist = vmalloc(nr_pages * sizeof(*sglist));
-   if (NULL == sglist)
+   if (!sglist)
return NULL;
sg_init_table(sglist, nr_pages);
 
@@ -112,7 +112,7 @@ static struct scatterlist *videobuf_pages_to_sg(struct page 
**pages,
min_t(size_t, PAGE_SIZE - offset, size), offset);
size -= min_t(size_t, PAGE_SIZE - offset, size);
for (i = 1; i < nr_pages; i++) {
-   if (NULL == pages[i])
+   if (!pages[i])
goto nopage;
if (PageHighMem(pages[i]))
goto highmem;
@@ -178,7 +178,7 @@ static int videobuf_dma_init_user_locked(struct 
videobuf_dmabuf *dma,
dma->pages = kmalloc_array(dma->nr_pages,
   sizeof(*dma->pages),
   GFP_KERNEL);
-   if (NULL == dma->pages)
+   if (!dma->pages)
return -ENOMEM;
 
if (rw == READ)
@@ -233,14 +233,14 @@ static int videobuf_dma_init_kernel(struct 
videobuf_dmabuf *dma, int direction,
 
addr = dma_alloc_coherent(dma->dev, PAGE_SIZE,
  &(dma->dma_addr[i]), GFP_KERNEL);
-   if (addr == NULL)
+   if (!addr)
goto out_free_pages;
 
dma->vaddr_pages[i] = virt_to_page(addr);
}
dma->vaddr = vmap(dma->vaddr_pages, nr_pages, VM_MAP | VM_IOREMAP,
  PAGE_KERNEL);
-   if (NULL == dma->vaddr) {
+   if (!dma->vaddr) {
dprintk(1, "vmalloc_32(%d pages) failed\n", nr_pages);
goto out_free_pages;
}
@@ -277,7 +277,7 @@ static int videobuf_dma_init_overlay(struct videobuf_dmabuf 
*dma, int direction,
nr_pages, (unsigned long)addr);
dma->direction = direction;
 
-   if (0 == addr)
+   if (!addr)
return -EINVAL;
 
dma->bus_addr = addr;
@@ -289,7 +289,7 @@ static int videobuf_dma_init_overlay(struct videobuf_dmabuf 
*dma, int direction,
 static int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
 {
MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
-   BUG_ON(0 == dma->nr_pages);
+   BUG_ON(!dma->nr_pages);
 
if (dma->pages) {
dma->sglist = videobuf_pages_to_sg(dma->pages, dma->nr_pages,
@@ -301,7 +301,7 @@ static int videobuf_dma_map(struct device *dev, struct 
videobuf_dmabuf *dma)
}
if (dma->bus_addr) {
dma->sglist = vmalloc(sizeof(*dma->sglist));
-   if (NULL != dma->sglist) {
+   if (dma->sglist) {
dma->sglen = 1;
sg_dma_address(>sglist[0]) = dma->bus_addr
& PAGE_MASK;
@@ -309,14 +309,14 @@ static int videobuf_dma_map(struct device *dev, struct 
videobuf_dmabuf *dma)
sg_dma_len(>sglist[0]) = dma->nr_pages * PAGE_SIZE;
}
}
-   if (NULL == dma->sglist) {
+   if (!dma->sglist) {
dprintk(1, "scatterlist is NULL\n");
return -ENOMEM;
}
if (!dma->bus_addr) {
dma->sglen = dma_map_sg(dev, dma->sglist,
dma->nr_pages, dma->direction);
-   if (0 == dma->sglen) {
+   if (!dma->sglen) {
printk(KERN_WARNING
   "%s: videobuf_map_sg failed\n", __func__);
  

[PATCH 2/8] [media] v4l2-async: Delete an error message for a failed memory allocation in v4l2_async_notifier_unregister()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 19:19:49 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus fix the affected source code place.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/v4l2-async.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 277183f2d514..812d0b2a2f73 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -203,11 +203,6 @@ void v4l2_async_notifier_unregister(struct 
v4l2_async_notifier *notifier)
return;
 
dev = kmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
-   if (!dev) {
-   dev_err(notifier->v4l2_dev->dev,
-   "Failed to allocate device cache!\n");
-   }
-
mutex_lock(_lock);
 
list_del(>list);
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] [media] v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister()

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 18:14:33 +0100

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/media/v4l2-core/v4l2-async.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 5bada202b2d3..277183f2d514 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -202,7 +202,7 @@ void v4l2_async_notifier_unregister(struct 
v4l2_async_notifier *notifier)
if (!notifier->v4l2_dev)
return;
 
-   dev = kmalloc(n_subdev * sizeof(*dev), GFP_KERNEL);
+   dev = kmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
if (!dev) {
dev_err(notifier->v4l2_dev->dev,
"Failed to allocate device cache!\n");
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] [media] v4l2-core: Fine-tuning for some function implementations

2016-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Mon, 26 Dec 2016 21:30:12 +0100

Some update suggestions were taken into account
from static source code analysis.

Markus Elfring (8):
  v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister()
  v4l2-async: Delete an error message for a failed memory allocation in 
v4l2_async_notifier_unregister()
  videobuf-dma-sg: Use kmalloc_array() in videobuf_dma_init_user_locked()
  videobuf-dma-sg: Adjust 24 checks for null values
  videobuf-dma-sg: Move two assignments for error codes in 
__videobuf_mmap_mapper()
  videobuf-dma-sg: Improve a size determination in __videobuf_mmap_mapper()
  videobuf-dma-sg: Delete an unnecessary return statement in videobuf_vm_close()
  videobuf-dma-sg: Add some spaces for better code readability in 
videobuf_dma_init_user_locked()

 drivers/media/v4l2-core/v4l2-async.c  |  7 +---
 drivers/media/v4l2-core/videobuf-dma-sg.c | 65 ---
 2 files changed, 34 insertions(+), 38 deletions(-)

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Problem: "transfer buffer not dma capable"

2016-12-26 Thread bill murphy
On Dec 17th Piotr Chmura reported an oops when trying to watch tv with 
his siano device, which uses smsusb, in Kaffeine.


I was recently seeing a very similar oops with Linux 4.9.0-rc6+, but 
upon plugging in a Geniatech SU3 device (vid,pid / 0x1f4d,0x3000)


which uses dw2102. Compiling the 4.9.0-rc6+ kernel with this config 
setting disabled for now, as suggested here


https://github.com/LibreELEC/LibreELEC.tv/pull/1076 got rid of the oops 
for me, and the Geniatech device no longer experiences the


"transfer buffer not dma capable" oops. http://pastebin.com/JWdHUDac

Hope that helps someone else as it helped me.



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] [media] v4l: rcar_fdp1: use %4.4s to format a 4-byte string

2016-12-26 Thread Nicolas Iooss
Using %4s to format f->fmt.pix_mp.pixelformat in fdp1_try_fmt() and
fdp1_s_fmt() may lead to more characters being printed (when the byte
following field pixelformat is not zero).

Add ".4" to the format specifier to limit the number of printed
characters to four. The resulting format specifier "%4.4s" is also used
by other media drivers to print pixelformat value.

Signed-off-by: Nicolas Iooss 
---
 drivers/media/platform/rcar_fdp1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/rcar_fdp1.c 
b/drivers/media/platform/rcar_fdp1.c
index 674cc1309b43..42f25d241edd 100644
--- a/drivers/media/platform/rcar_fdp1.c
+++ b/drivers/media/platform/rcar_fdp1.c
@@ -1596,7 +1596,7 @@ static int fdp1_try_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
else
fdp1_try_fmt_capture(ctx, NULL, >fmt.pix_mp);
 
-   dprintk(ctx->fdp1, "Try %s format: %4s (0x%08x) %ux%u field %u\n",
+   dprintk(ctx->fdp1, "Try %s format: %4.4s (0x%08x) %ux%u field %u\n",
V4L2_TYPE_IS_OUTPUT(f->type) ? "output" : "capture",
(char *)>fmt.pix_mp.pixelformat, f->fmt.pix_mp.pixelformat,
f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.field);
@@ -1671,7 +1671,7 @@ static int fdp1_s_fmt(struct file *file, void *priv, 
struct v4l2_format *f)
 
fdp1_set_format(ctx, >fmt.pix_mp, f->type);
 
-   dprintk(ctx->fdp1, "Set %s format: %4s (0x%08x) %ux%u field %u\n",
+   dprintk(ctx->fdp1, "Set %s format: %4.4s (0x%08x) %ux%u field %u\n",
V4L2_TYPE_IS_OUTPUT(f->type) ? "output" : "capture",
(char *)>fmt.pix_mp.pixelformat, f->fmt.pix_mp.pixelformat,
f->fmt.pix_mp.width, f->fmt.pix_mp.height, f->fmt.pix_mp.field);
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: rc: refactor raw handler kthread

2016-12-26 Thread Heiner Kallweit
Am 02.08.2016 um 07:44 schrieb Heiner Kallweit:
> I think we can get rid of the spinlock protecting the kthread from being
> interrupted by a wakeup in certain parts.
> Even with the current implementation of the kthread the only lost wakeup
> scenario could happen if the wakeup occurs between the kfifo_len check
> and setting the state to TASK_INTERRUPTIBLE.
> 
> In the changed version we could lose a wakeup if it occurs between
> processing the fifo content and setting the state to TASK_INTERRUPTIBLE.
> This scenario is covered by an additional check for available events in
> the fifo and setting the state to TASK_RUNNING in this case.
> 
> In addition the changed version flushes the kfifo before ending
> when the kthread is stopped.
> 
> With this patch we gain:
> - Get rid of the spinlock
> - Simplify code
> - Don't grep / release the mutex for each individual event but just once
>   for the complete fifo content. This reduces overhead if a driver e.g.
>   triggers processing after writing the content of a hw fifo to the kfifo.
> 
> Signed-off-by: Heiner Kallweit 

Sean added a review comment and his "Tested-by" a month ago.
Anything else missing before it can be applied?

> ---
>  drivers/media/rc/rc-core-priv.h |  2 --
>  drivers/media/rc/rc-ir-raw.c| 46 
> +++--
>  2 files changed, 17 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
> index 585d5e5..577128a 100644
> --- a/drivers/media/rc/rc-core-priv.h
> +++ b/drivers/media/rc/rc-core-priv.h
> @@ -20,7 +20,6 @@
>  #define  MAX_IR_EVENT_SIZE   512
>  
>  #include 
> -#include 
>  #include 
>  
>  struct ir_raw_handler {
> @@ -37,7 +36,6 @@ struct ir_raw_handler {
>  struct ir_raw_event_ctrl {
>   struct list_headlist;   /* to keep track of raw 
> clients */
>   struct task_struct  *thread;
> - spinlock_t  lock;
>   /* fifo for the pulse/space durations */
>   DECLARE_KFIFO(kfifo, struct ir_raw_event, MAX_IR_EVENT_SIZE);
>   ktime_t last_event; /* when last event 
> occurred */
> diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
> index 205ecc6..71a3e17 100644
> --- a/drivers/media/rc/rc-ir-raw.c
> +++ b/drivers/media/rc/rc-ir-raw.c
> @@ -17,7 +17,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include "rc-core-priv.h"
>  
>  /* Used to keep track of IR raw clients, protected by ir_raw_handler_lock */
> @@ -35,32 +34,26 @@ static int ir_raw_event_thread(void *data)
>   struct ir_raw_handler *handler;
>   struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data;
>  
> - while (!kthread_should_stop()) {
> -
> - spin_lock_irq(>lock);
> -
> - if (!kfifo_len(>kfifo)) {
> - set_current_state(TASK_INTERRUPTIBLE);
> -
> - if (kthread_should_stop())
> - set_current_state(TASK_RUNNING);
> -
> - spin_unlock_irq(>lock);
> - schedule();
> - continue;
> + while (1) {
> + mutex_lock(_raw_handler_lock);
> + while (kfifo_out(>kfifo, , 1)) {
> + list_for_each_entry(handler, _raw_handler_list, list)
> + if (raw->dev->enabled_protocols &
> + handler->protocols || !handler->protocols)
> + handler->decode(raw->dev, ev);
> + raw->prev_ev = ev;
>   }
> + mutex_unlock(_raw_handler_lock);
>  
> - if(!kfifo_out(>kfifo, , 1))
> - dev_err(>dev->dev, "IR event FIFO is empty!\n");
> - spin_unlock_irq(>lock);
> + set_current_state(TASK_INTERRUPTIBLE);
>  
> - mutex_lock(_raw_handler_lock);
> - list_for_each_entry(handler, _raw_handler_list, list)
> - if (raw->dev->enabled_protocols & handler->protocols ||
> - !handler->protocols)
> - handler->decode(raw->dev, ev);
> - raw->prev_ev = ev;
> - mutex_unlock(_raw_handler_lock);
> + if (kthread_should_stop()) {
> + __set_current_state(TASK_RUNNING);
> + break;
> + } else if (!kfifo_is_empty(>kfifo))
> + set_current_state(TASK_RUNNING);
> +
> + schedule();
>   }
>  
>   return 0;
> @@ -219,14 +212,10 @@ EXPORT_SYMBOL_GPL(ir_raw_event_set_idle);
>   */
>  void ir_raw_event_handle(struct rc_dev *dev)
>  {
> - unsigned long flags;
> -
>   if (!dev->raw)
>   return;
>  
> - spin_lock_irqsave(>raw->lock, flags);
>   wake_up_process(dev->raw->thread);
> - spin_unlock_irqrestore(>raw->lock, flags);
>  }
>