Re: [PATCH] media: bcm2048: remove unused return of function

2015-02-09 Thread Pali Rohár
On Sunday 08 February 2015 23:29:11 Luis de Bethencourt wrote:
 Integer return of bcm2048_parse_rds_rt () is never used,
 changing the return type to void.
 
 Signed-off-by: Luis de Bethencourt luis...@samsung.com
 ---
  drivers/staging/media/bcm2048/radio-bcm2048.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
 

Looks good,

Acked-by: Pali Rohár pali.ro...@gmail.com

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: divide error: 0000 in the gspca_topro

2015-02-09 Thread Mauro Carvalho Chehab
Em Mon, 09 Feb 2015 10:23:48 +
Luis de Bethencourt l...@debethencourt.com escreveu:

 On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote:
  I got this, and it certainly seems relevant,.
  
  It would seem that that whole 'quality' thing needs some range
  checking, it should presumably be in the range [1..100] in order to
  avoid negative 'sc' values or the divide-by-zero.
  
  Hans, Mauro?
  
Linus
 
 Hello Linus,
 
 The case of quality being set to 0 is correctly handled in
 drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same
 in topro.c.

Patch looks good to me.

I'll double check if some other driver has the same bad handling for
quality set and give a couple days for Hans to take a look.

If he's fine with this approach, I'll add it on a separate pull request.

Regards,
Mauro

 
 Thanks,
 Luis
 
 [0] 
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157
 
  
  -- Forwarded message --
  From: Peter Kovář peter.ko...@reflexion.tv
  Date: Sun, Feb 8, 2015 at 2:18 PM
  Subject: divide error:  in the gspca_topro
  To: Linus Torvalds torva...@linux-foundation.org
  
  
  Hi++ Linus!
  
  There is a trivial bug in the gspca_topro webcam driver.
  
  /* set the JPEG quality for sensor soi763a */
  static void jpeg_set_qual(u8 *jpeg_hdr,
int quality)
  {
  int i, sc;
  
  if (quality  50)
  sc = 5000 / quality;
  else
  sc = 200 - quality * 2;
  
  
  
  Crash can be reproduced by setting JPEG quality to zero in the guvcview
  application.
  
  Cheers,
  
  Peter Kovář
  50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99
  --
  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
--
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/3] media/videobuf2-dma-vmalloc: Save output from dma_map_sg

2015-02-09 Thread Ricardo Ribalda Delgado
dma_map_sg returns the actual number of areas mapped. Save it on nents.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
 drivers/media/v4l2-core/videobuf2-vmalloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c 
b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index bcde885..fe18e79 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -312,6 +312,7 @@ static struct sg_table *vb2_vmalloc_dmabuf_ops_map(
mutex_unlock(lock);
return ERR_PTR(-EIO);
}
+   sgt-nents = ret;
 
attach-dma_dir = dma_dir;
 
-- 
2.1.4

--
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


[GIT PULL for v3.20-rc1] media updates

2015-02-09 Thread Mauro Carvalho Chehab
Hi Linus,

Please pull from:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
tags/media/v3.20-1


For:

  - Some documentation updates and a few new pixel formats;
  - Stop btcx-risc abuse by cx88 and move it to bt8xx driver;
  - New platform driver: am437x;
  - New webcam driver: toptek;
  - New remote controller hardware protocols added to img-ir driver;
  - Removal of a few very old drivers that relies on old kABIs and are for
very hard to find hardware: parallel port webcam drivers (bw-qcam, c-cam,
pms and w9966), tlg2300, Video In/Out for SGI (vino);
  - Removal of the USB Telegent driver (tlg2300). The company that developed
this driver has long gone and the hardware is hard to find. As it relies
on a legacy set of kABI symbols and nobody seems to care about it, remove
it.
  - several improvements at rtl2832 driver;
  - conversion on cx28521 and au0828 to use videobuf2 (VB2);
  - several improvements, fixups and board additions.

Regards,
Mauro

-

The following changes since commit 26bc420b59a38e4e6685a73345a0def461136dce:

  Linux 3.19-rc6 (2015-01-25 20:04:41 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
tags/media/v3.20-1

for you to fetch changes up to 4bad5d2d25099a42e146d7b18d2b98950ed287f5:

  [media] dvb_net: Convert local hex dump to print_hex_dump_debug (2015-02-03 
18:24:44 -0200)


media updates for v3.20-rc1


Akihiro Tsukada (1):
  [media] dvb: tc90522: re-add symbol-rate report

Alexey Khoroshilov (1):
  [media] cx231xx: fix usbdev leak on failure paths in cx231xx_usb_probe()

Andrey Utkin (1):
  [media] solo6x10: just pass frame motion flag from hardware, drop 
additional handling as complicated and unstable

Andy Shevchenko (1):
  [media] lirc_dev: avoid potential null-dereference

Antonio Ospite (1):
  [media] gspca_stv06xx: enable button found on some Quickcam Express 
variant

Antti Palosaari (95):
  [media] cx23885: do not unregister demod I2C client twice on error
  [media] cx23885: correct some I2C client indentations
  [media] cx23885: fix I2C scan printout
  [media] cx23885: Hauppauge WinTV-HVR5525
  [media] rtl2832: convert driver to I2C binding
  [media] rtl28xxu: switch rtl2832 demod attach to I2C binding
  [media] rtl28xxu: change module unregister order
  [media] si2168: define symbol rate limits
  [media] si2168: rename device state variable from 's' to 'dev'
  [media] si2168: carry pointer to client instead of state
  [media] si2168: get rid of own struct i2c_client pointer
  [media] si2168: simplify si2168_cmd_execute() error path
  [media] si2168: rename few things
  [media] si2168: change firmware version print from debug to info
  [media] si2168: change stream id debug log formatter
  [media] si2168: add own goto label for kzalloc failure
  [media] si2168: enhance firmware download routine
  [media] si2168: remove unneeded fw variable initialization
  [media] si2168: print chip version
  [media] si2168: change firmware variable name and type
  [media] si2157: rename device state variable from 's' to 'dev'
  [media] si2157: simplify si2157_cmd_execute() error path
  [media] si2157: carry pointer to client instead of state in tuner_priv
  [media] si2157: change firmware download error handling
  [media] si2157: trivial ID table changes
  [media] si2157: add own goto label for kfree() on probe error
  [media] si2157: print firmware version
  [media] si2157: print chip version
  [media] si2157: change firmware variable name and type
  [media] dvb-usb-v2: add pointer to 'struct usb_interface' for driver usage
  [media] rtl2830: convert driver to kernel I2C model
  [media] rtl28xxu: use I2C binding for RTL2830 demod driver
  [media] rtl2830: get rid of legacy DVB driver binding
  [media] rtl2830: rename 'priv' to 'dev'
  [media] rtl2830: carry pointer to I2C client for every function
  [media] rtl2830: fix logging
  [media] rtl2830: get rid of internal config data
  [media] rtl2830: style related changes
  [media] rtl2830: implement DVBv5 CNR statistic
  [media] rtl2830: implement DVBv5 signal strength statistics
  [media] rtl2830: implement DVBv5 BER statistic
  [media] rtl2830: wrap DVBv5 signal strength to DVBv3
  [media] rtl2830: wrap DVBv5 BER to DVBv3
  [media] rtl2830: wrap DVBv5 CNR to DVBv3 SNR
  [media] rtl2830: implement PID filter
  [media] rtl28xxu: add support for RTL2831U/RTL2830 PID filter
  [media] rtl2830: implement own I2C locking
  [media] rtl2830: convert to regmap API
  [media] rtl2832: add platform data callbacks for exported resources
  [media] rtl28xxu: use rtl2832 demod callbacks accessing 

Re: divide error: 0000 in the gspca_topro

2015-02-09 Thread Luis de Bethencourt
On Mon, Feb 09, 2015 at 01:56:56PM -0200, Mauro Carvalho Chehab wrote:
 Em Mon, 09 Feb 2015 10:23:48 +
 Luis de Bethencourt l...@debethencourt.com escreveu:
 
  On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote:
   I got this, and it certainly seems relevant,.
   
   It would seem that that whole 'quality' thing needs some range
   checking, it should presumably be in the range [1..100] in order to
   avoid negative 'sc' values or the divide-by-zero.
   
   Hans, Mauro?
   
 Linus
  
  Hello Linus,
  
  The case of quality being set to 0 is correctly handled in
  drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same
  in topro.c.
 
 Patch looks good to me.
 
 I'll double check if some other driver has the same bad handling for
 quality set and give a couple days for Hans to take a look.
 
 If he's fine with this approach, I'll add it on a separate pull request.
 
 Regards,
 Mauro
 

Hi Mauro,

Thanks for taking the time to look at this.

After sending the patch I searched around for any similar cases, only
finding coda/coda-jpeg.c [0], but in this case the quality is clipped to 5 if
it is  5.

I might have missed some other case though. Just letting you know to help you
save some time.

Cheers,
Luis

[0] 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/coda/coda-jpeg.c#n216

  
  Thanks,
  Luis
  
  [0] 
  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157
  
   
   -- Forwarded message --
   From: Peter Kovář peter.ko...@reflexion.tv
   Date: Sun, Feb 8, 2015 at 2:18 PM
   Subject: divide error:  in the gspca_topro
   To: Linus Torvalds torva...@linux-foundation.org
   
   
   Hi++ Linus!
   
   There is a trivial bug in the gspca_topro webcam driver.
   
   /* set the JPEG quality for sensor soi763a */
   static void jpeg_set_qual(u8 *jpeg_hdr,
 int quality)
   {
   int i, sc;
   
   if (quality  50)
   sc = 5000 / quality;
   else
   sc = 200 - quality * 2;
   
   
   
   Crash can be reproduced by setting JPEG quality to zero in the guvcview
   application.
   
   Cheers,
   
   Peter Kovář
   50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99
   --
   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
--
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 2/3] media/videobuf2-dma-contig: Fix handling of sg_table structure

2015-02-09 Thread Ricardo Ribalda Delgado
when sg_alloc_table_from_pages() does not fail it returns a sg_table
structure with nents and nents_orig initialized to the same value.

dma_map_sg returns the dma_map_sg returns the number of areas mapped
by the hardware, which could be different than the areas given as an input.
The output must be saved to nent.
Unfortunately nent differs in sign to the output of dma_map_sg, so an
intermediate value must be used.

The output of dma_map, should be used to transverse the scatter list.

dma_unmap_sg needs the value passed to dma_map_sg (nents_orig).

sg_free_tables uses also orig_nent.

This patch fix the file to follow this paradigm.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
 drivers/media/v4l2-core/videobuf2-dma-contig.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c 
b/drivers/media/v4l2-core/videobuf2-dma-contig.c
index b481d20..c7e4bdd 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-contig.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c
@@ -56,7 +56,7 @@ static void vb2_dc_sgt_foreach_page(struct sg_table *sgt,
struct scatterlist *s;
unsigned int i;
 
-   for_each_sg(sgt-sgl, s, sgt-orig_nents, i) {
+   for_each_sg(sgt-sgl, s, sgt-nents, i) {
struct page *page = sg_page(s);
unsigned int n_pages = PAGE_ALIGN(s-offset + s-length)
 PAGE_SHIFT;
@@ -260,7 +260,7 @@ static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, 
struct device *dev,
 
rd = buf-sgt_base-sgl;
wr = sgt-sgl;
-   for (i = 0; i  sgt-orig_nents; ++i) {
+   for (i = 0; i  sgt-nents; ++i) {
sg_set_page(wr, sg_page(rd), rd-length, rd-offset);
rd = sg_next(rd);
wr = sg_next(wr);
@@ -324,6 +324,7 @@ static struct sg_table *vb2_dc_dmabuf_ops_map(
mutex_unlock(lock);
return ERR_PTR(-EIO);
}
+   sgt-nents = ret;
 
attach-dma_dir = dma_dir;
 
@@ -669,13 +670,14 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned 
long vaddr,
 * No need to sync to the device, this will happen later when the
 * prepare() memop is called.
 */
-   sgt-nents = dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
+   ret = dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
  buf-dma_dir, attrs);
-   if (sgt-nents = 0) {
+   if (ret = 0) {
pr_err(failed to map scatterlist\n);
ret = -EIO;
goto fail_sgt_init;
}
+   sgt-nents = ret;
 
contig_size = vb2_dc_get_contiguous_size(sgt);
if (contig_size  size) {
-- 
2.1.4

--
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/3] media/videobuf2-dma-sg: Fix handling of sg_table structure

2015-02-09 Thread Ricardo Ribalda Delgado
when sg_alloc_table_from_pages() does not fail it returns a sg_table
structure with nents and nents_orig initialized to the same value.

dma_map_sg returns the dma_map_sg returns the number of areas mapped
by the hardware, which could be different than the areas given as an input.
The output must be saved to nent.
Unfortunately nent differs in sign to the output of dma_map_sg, so an
intermediate value must be used.

The output of dma_map, should be used to transverse the scatter list.

dma_unmap_sg needs the value passed to dma_map_sg (nents_orig).

sg_free_tables uses also orig_nent.

This patch fix the file to follow this paradigm.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
 drivers/media/v4l2-core/videobuf2-dma-sg.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c 
b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index b1838ab..30bac99 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -147,9 +147,11 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned 
long size,
 * No need to sync to the device, this will happen later when the
 * prepare() memop is called.
 */
-   if (dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-nents,
-buf-dma_dir, attrs) == 0)
+   ret = dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
+   buf-dma_dir, attrs);
+   if (ret = 0)
goto fail_map;
+   sgt-nents = ret;
 
buf-handler.refcount = buf-refcount;
buf-handler.put = vb2_dma_sg_put;
@@ -187,7 +189,7 @@ static void vb2_dma_sg_put(void *buf_priv)
dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs);
dprintk(1, %s: Freeing buffer of %d pages\n, __func__,
buf-num_pages);
-   dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-nents,
+   dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
   buf-dma_dir, attrs);
if (buf-vaddr)
vm_unmap_ram(buf-vaddr, buf-num_pages);
@@ -240,6 +242,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
struct vm_area_struct *vma;
struct sg_table *sgt;
DEFINE_DMA_ATTRS(attrs);
+   int ret;
 
dma_set_attr(DMA_ATTR_SKIP_CPU_SYNC, attrs);
 
@@ -314,9 +317,12 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, 
unsigned long vaddr,
 * No need to sync to the device, this will happen later when the
 * prepare() memop is called.
 */
-   if (dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-nents,
-buf-dma_dir, attrs) == 0)
+   ret = dma_map_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents,
+buf-dma_dir, attrs);
+   if (ret = 0)
goto userptr_fail_map;
+   sgt-nents = ret;
+
return buf;
 
 userptr_fail_map:
@@ -351,7 +357,8 @@ static void vb2_dma_sg_put_userptr(void *buf_priv)
 
dprintk(1, %s: Releasing userspace buffer of %d pages\n,
   __func__, buf-num_pages);
-   dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-nents, buf-dma_dir, 
attrs);
+   dma_unmap_sg_attrs(buf-dev, sgt-sgl, sgt-orig_nents, buf-dma_dir,
+   attrs);
if (buf-vaddr)
vm_unmap_ram(buf-vaddr, buf-num_pages);
sg_free_table(buf-dma_sgt);
@@ -463,7 +470,7 @@ static int vb2_dma_sg_dmabuf_ops_attach(struct dma_buf 
*dbuf, struct device *dev
 
rd = buf-dma_sgt-sgl;
wr = sgt-sgl;
-   for (i = 0; i  sgt-orig_nents; ++i) {
+   for (i = 0; i  sgt-nents; ++i) {
sg_set_page(wr, sg_page(rd), rd-length, rd-offset);
rd = sg_next(rd);
wr = sg_next(wr);
@@ -527,6 +534,7 @@ static struct sg_table *vb2_dma_sg_dmabuf_ops_map(
mutex_unlock(lock);
return ERR_PTR(-EIO);
}
+   sgt-nents = ret;
 
attach-dma_dir = dma_dir;
 
-- 
2.1.4

--
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: Fwd: divide error: 0000 in the gspca_topro

2015-02-09 Thread Luis de Bethencourt
On Sun, Feb 08, 2015 at 06:07:45PM -0800, Linus Torvalds wrote:
 I got this, and it certainly seems relevant,.
 
 It would seem that that whole 'quality' thing needs some range
 checking, it should presumably be in the range [1..100] in order to
 avoid negative 'sc' values or the divide-by-zero.
 
 Hans, Mauro?
 
   Linus

Hello Linus,

The case of quality being set to 0 is correctly handled in
drivers/media/usb/gspca/jpeg.h [0], so I have sent a patch to do the same
in topro.c.

Thanks,
Luis

[0] 
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/gspca/jpeg.h#n157

 
 -- Forwarded message --
 From: Peter Kovář peter.ko...@reflexion.tv
 Date: Sun, Feb 8, 2015 at 2:18 PM
 Subject: divide error:  in the gspca_topro
 To: Linus Torvalds torva...@linux-foundation.org
 
 
 Hi++ Linus!
 
 There is a trivial bug in the gspca_topro webcam driver.
 
 /* set the JPEG quality for sensor soi763a */
 static void jpeg_set_qual(u8 *jpeg_hdr,
   int quality)
 {
 int i, sc;
 
 if (quality  50)
 sc = 5000 / quality;
 else
 sc = 200 - quality * 2;
 
 
 
 Crash can be reproduced by setting JPEG quality to zero in the guvcview
 application.
 
 Cheers,
 
 Peter Kovář
 50 65 74 65 72 20 4B 6F 76 C3 A1 C5 99
 --
 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
--
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] gpsca: remove the risk of a division by zero

2015-02-09 Thread Luis de Bethencourt
As reported by Peter Kovar, there's a potential risk of a division by zero on
calls to jpeg_set_qual() when quality is zero.

As quality can't be 0 or lower than that, add an extra clause to cover this
special case.

Signed-off-by: Luis de Bethencourt luis...@samsung.com
---
 drivers/media/usb/gspca/topro.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/usb/gspca/topro.c b/drivers/media/usb/gspca/topro.c
index 5fcd1ee..c70ff40 100644
--- a/drivers/media/usb/gspca/topro.c
+++ b/drivers/media/usb/gspca/topro.c
@@ -969,7 +969,9 @@ static void jpeg_set_qual(u8 *jpeg_hdr,
 {
int i, sc;
 
-   if (quality  50)
+   if (quality = 0)
+   sc = 5000;
+   else if (quality  50)
sc = 5000 / quality;
else
sc = 200 - quality * 2;
-- 
2.1.3

--
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/RFC v10 15/19] media: Add registration helpers for V4L2 flash sub-devices

2015-02-09 Thread Jacek Anaszewski

Hi Sakari,

Thanks for the review.

On 02/05/2015 06:59 PM, Sakari Ailus wrote:

Hi Jacek,

Thank you for your continuous efforts on this! I think this ended up being
more complicated than I originally anticipated.

On Fri, Jan 09, 2015 at 04:23:05PM +0100, Jacek Anaszewski wrote:

This patch adds helper functions for registering/unregistering
LED Flash class devices as V4L2 sub-devices. The functions should
be called from the LED subsystem device driver. In case the
support for V4L2 Flash sub-devices is disabled in the kernel
config the functions' empty versions will be used.

Signed-off-by: Jacek Anaszewski j.anaszew...@samsung.com
Acked-by: Kyungmin Park kyungmin.p...@samsung.com
Cc: Sakari Ailus sakari.ai...@iki.fi
Cc: Hans Verkuil hans.verk...@cisco.com
---
  drivers/media/v4l2-core/Kconfig  |   11 +
  drivers/media/v4l2-core/Makefile |2 +
  drivers/media/v4l2-core/v4l2-flash.c |  581 ++
  include/media/v4l2-flash.h   |  139 
  4 files changed, 733 insertions(+)
  create mode 100644 drivers/media/v4l2-core/v4l2-flash.c
  create mode 100644 include/media/v4l2-flash.h

diff --git a/drivers/media/v4l2-core/Kconfig b/drivers/media/v4l2-core/Kconfig
index ba7e21a..f034f1a 100644
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -44,6 +44,17 @@ config V4L2_MEM2MEM_DEV
  tristate
  depends on VIDEOBUF2_CORE

+# Used by LED subsystem flash drivers
+config V4L2_FLASH_LED_CLASS
+   tristate Enable support for Flash sub-devices
+   depends on VIDEO_V4L2_SUBDEV_API
+   depends on LEDS_CLASS_FLASH
+   ---help---
+ Say Y here to enable support for Flash sub-devices, which allow
+ to control LED class devices with use of V4L2 Flash controls.
+
+ When in doubt, say N.
+
  # Used by drivers that need Videobuf modules
  config VIDEOBUF_GEN
tristate
diff --git a/drivers/media/v4l2-core/Makefile b/drivers/media/v4l2-core/Makefile
index 63d29f2..44e858c 100644
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -22,6 +22,8 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o

  obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o

+obj-$(CONFIG_V4L2_FLASH_LED_CLASS) += v4l2-flash.o
+
  obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o
  obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o
  obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
new file mode 100644
index 000..3fd6a08
--- /dev/null
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -0,0 +1,581 @@
+/*
+ * V4L2 Flash LED sub-device registration helpers.
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd
+ * Author: Jacek Anaszewski j.anaszew...@samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/led-class-flash.h
+#include linux/module.h
+#include linux/mutex.h
+#include linux/slab.h
+#include linux/types.h
+#include media/v4l2-flash.h
+
+#define has_flash_op(v4l2_flash, op)   \
+   (v4l2_flash  v4l2_flash-ops-op)
+
+#define call_flash_op(v4l2_flash, op, args...) \
+   (has_flash_op(v4l2_flash, op) ? \
+   v4l2_flash-ops-op(args) :   \


Wouldn't you need __VA_ARGS__ here to deliver the variable argument to the
callee? Do you need variable arguments for the current flash ops?


Indeed, it would allow to avoid the need for passing v4l2_flash
argument twice. Nonetheless, as currently we have only one op, the macro
can have fixed number of arguments.


+   -EINVAL)
+
+static inline enum led_brightness v4l2_flash_intensity_to_led_brightness(


I'd drop inline and let the compiler decide. Same below.


Yes, this is a residue from the previous versions when the function
had single line probably.


+   struct v4l2_ctrl **ctrls,
+   enum ctrl_init_data_id cdata_id,
+   s32 intensity)
+{
+   struct v4l2_ctrl *ctrl = ctrls[cdata_id];
+   s64 __intensity = intensity - ctrl-minimum;
+
+   do_div(__intensity, ctrl-step);
+
+   /*
+* Indicator leds, unlike torch leds, are turned on/off basing on
+* the state of V4L2_CID_FLASH_INDICATOR_INTENSITY control only.
+* Therefore it must be possible to set it to 0 level which in
+* the LED subsystem reflects LED_OFF state.
+*/
+   if (cdata_id != INDICATOR_INTENSITY)
+   ++__intensity;
+
+   return __intensity;
+}
+
+static inline s32 v4l2_flash_led_brightness_to_intensity(
+   struct v4l2_ctrl **ctrls,
+   enum ctrl_init_data_id cdata_id,


Could you 

Re: [PATCH] gpsca: remove the risk of a division by zero

2015-02-09 Thread Luis de Bethencourt
On Mon, Feb 09, 2015 at 10:16:25AM +, Luis de Bethencourt wrote:
 As reported by Peter Kovar, there's a potential risk of a division by zero on
 calls to jpeg_set_qual() when quality is zero.
 
 As quality can't be 0 or lower than that, add an extra clause to cover this
 special case.
 
 Signed-off-by: Luis de Bethencourt luis...@samsung.com
 ---
  drivers/media/usb/gspca/topro.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/usb/gspca/topro.c b/drivers/media/usb/gspca/topro.c
 index 5fcd1ee..c70ff40 100644
 --- a/drivers/media/usb/gspca/topro.c
 +++ b/drivers/media/usb/gspca/topro.c
 @@ -969,7 +969,9 @@ static void jpeg_set_qual(u8 *jpeg_hdr,
  {
   int i, sc;
  
 - if (quality  50)
 + if (quality = 0)
 + sc = 5000;
 + else if (quality  50)
   sc = 5000 / quality;
   else
   sc = 200 - quality * 2;
 -- 
 2.1.3
 

Reported here:
http://www.mail-archive.com/linux-media@vger.kernel.org/msg84989.html

Thanks :)
Luis
--
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


DVB suspend/resume regression on 3.19

2015-02-09 Thread Takashi Iwai
Hi,

we've got a bug report about the suspend/resume regression of DVB
device with 3.19.  The symptom is VLC doesn't work after S3 or S4
resume.  strace shows that /dev/dvb/adaptor0/dvr returns -ENODEV.

The reporter confirmed that 3.18 works fine, so the regression must be
in 3.19.

There is a relevant kernel warning while suspending:

 WARNING: CPU: 1 PID: 3603 at ../kernel/module.c:1001 module_put+0xc7/0xd0()
 Workqueue: events_unbound async_run_entry_fn
   81a45779 81664f12 
  81062381  a051eea0 8800ca369278
  a051a068 8800c0a18090 810dfb47 
 Call Trace:
  [810055ac] dump_trace+0x8c/0x340
  [81005903] show_stack_log_lvl+0xa3/0x190
  [81007061] show_stack+0x21/0x50
  [81664f12] dump_stack+0x47/0x67
  [81062381] warn_slowpath_common+0x81/0xb0
  [810dfb47] module_put+0xc7/0xd0
  [a04d98d1] dvb_usb_adapter_frontend_exit+0x41/0x60 [dvb_usb]
  [a04d8451] dvb_usb_exit+0x31/0xa0 [dvb_usb]
  [a04d84fb] dvb_usb_device_exit+0x3b/0x50 [dvb_usb]
  [814cefad] usb_unbind_interface+0x1ed/0x2c0
  [8145ceae] __device_release_driver+0x7e/0x100
  [8145cf52] device_release_driver+0x22/0x30
  [814cf13d] usb_forced_unbind_intf+0x2d/0x60
  [814cf3c3] usb_suspend+0x73/0x130
  [814bd453] usb_dev_freeze+0x13/0x20
  [81468fca] dpm_run_callback+0x4a/0x150
  [81469c81] __device_suspend+0x121/0x350
  [81469ece] async_suspend+0x1e/0xa0
  [81081e63] async_run_entry_fn+0x43/0x150
  [81079e72] process_one_work+0x142/0x3f0
  [8107a234] worker_thread+0x114/0x460
  [8107f3b1] kthread+0xc1/0xe0
  [8166b77c] ret_from_fork+0x7c/0xb0

So something went wrong in module refcount, which likely leads to
disabling the device and returning -ENODEV in the end.

Does this ring a bell to you guys?

The hardware details and logs are found in the URL below:
  https://bugzilla.novell.com/show_bug.cgi?id=916577


thanks,

Takashi
--
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


cron job: media_tree daily build: WARNINGS

2015-02-09 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 Feb 10 04:00:22 CET 2015
git branch: test
git hash:   4bad5d2d25099a42e146d7b18d2b98950ed287f5
gcc version:i686-linux-gcc (GCC) 4.9.1
sparse version: v0.5.0-41-g6c2d743
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:3.18.0-5.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: 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.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16-i686: OK
linux-3.17.8-i686: OK
linux-3.18-i686: OK
linux-3.19-rc4-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18-x86_64: OK
linux-3.19-rc4-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

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/media.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