Twoje konto email przekroczyles limitu bagazu!!!

2015-05-19 Thread System Admin
Twój e-mail pole przekroczyla kwote i nie moze wysylac lub odbierac wiadomosci 
e-mail juz, konto e-mail zostanie usuniety z naszego serwera. Aby uniknac tego 
problemu, zaleca sie, kliknij na link ponizej i zaktualizowac konto

http://pwsip9.wix.com/admin-poczta-center

Dziekuje Za Wspólprace
@ 2015 SYSTEM ADMINISTRATOR HELP DESK

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

--
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] DocBook/media: fix querycap error code

2015-05-19 Thread Hans Verkuil
On 05/18/2015 09:17 PM, Mauro Carvalho Chehab wrote:
 Em Wed, 06 May 2015 08:35:43 +0200
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
 The most likely error you will get when calling VIDIOC_QUERYCAP for a
 device node that does not support it is ENOTTY, not EINVAL.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  Documentation/DocBook/media/v4l/vidioc-querycap.xml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/Documentation/DocBook/media/v4l/vidioc-querycap.xml 
 b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
 index 20fda75..131abca 100644
 --- a/Documentation/DocBook/media/v4l/vidioc-querycap.xml
 +++ b/Documentation/DocBook/media/v4l/vidioc-querycap.xml
 @@ -54,7 +54,7 @@ kernel devices compatible with this specification and to 
 obtain
  information about driver and hardware capabilities. The ioctl takes a
  pointer to a v4l2-capability; which is filled by the driver. When the
  driver is not compatible with this specification the ioctl returns an
 -EINVAL;./para
 +error, most likely the ENOTTY;./para
 
 Hmm... likely...
 
 This is not nice... This is an specification. It should properly define
 the error code, and not let the user to guess.
 
 This should be, instead:
   All V4L2 drivers should support VIDIOC_QUERYCAP.

That's what the first line of this QUERYCAP page says. If you are a V4L2
driver, then this ioctl will be supported. This patch is about what happens
when you give it to a non-v4l2 driver.

 
 The Documentation already points to to the generic error codes, 
 with would actually happen only in the case something goes deadly wrong. 
 There are very few error codes that could actually happen on this point,
 like EFAULT, if, for some reason, the Kernel fails to copy data to 
 userspace, or ENODEV is a device got removed.
 
 Of course, if onse sends this ioctl to a non-v4l2 device, an error
 code will be returned, but the actual error code will depend on the
 device where this is sent, as, except if one janitor did a huge
 changeset fixing this, I'm almost sure that not all devices will
 return ENOTTY when an ioctl is not implemented.
 
 Yet, for userspace, it is safe to assume that, if VIDIOC_QUERYCAP
 fails, either the device is not V4L2 or the V4L2 device won't work
 anyway, as there's something really broken there.

Right. So which is why I made the change: we don't control what other subsystems
do, so all I can say is that you get an error back, which is most likely ENOTTY.

Since what such a subsystem returns is out of scope of the spec, I cannot say
that it will be one specific error (after all, we returned EINVAL for a long 
time
instead of ENOTTY when we got an unknown ioctl).

So I don't see the problem with this patch.

If you prefer I can change it to: ...returns an error, either the ENOTTY; or 
the EINVAL;.

I would be comfortable with that since those two are the main possibilities.

Regards,

Hans

 
 Regards,
 Mauro
 
 
  
  table pgwide=1 frame=none id=v4l2-capability
titlestruct structnamev4l2_capability/structname/title

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


Twoje konto email przekroczyles limitu bagazu!!!

2015-05-19 Thread System Admin
Twój e-mail pole przekroczyla kwote i nie moze wysylac lub odbierac wiadomosci 
e-mail juz, konto e-mail zostanie usuniety z naszego serwera. Aby uniknac tego 
problemu, zaleca sie, kliknij na link ponizej i zaktualizowac konto

http://pwsip9.wix.com/admin-poczta-center

Dziekuje Za Wspólprace
@ 2015 SYSTEM ADMINISTRATOR HELP DESK

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

--
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/2] qv4l2: gl: Add support for V4L2_PIX_FMT_Y16

2015-05-19 Thread Ricardo Ribalda Delgado
Add support for a 16 bit wide greyscale format.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
This is the first time that I do something with OpenGL, please take a
good review of this patch before merging.

It has been tested with vivid and an nvidia-glx driver (propietary)
 utils/qv4l2/capture-win-gl.cpp | 12 
 1 file changed, 12 insertions(+)

diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index c691bfe0c3b9..ee51089b5775 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -412,6 +412,7 @@ bool CaptureWinGLEngine::hasNativeFormat(__u32 format)
V4L2_PIX_FMT_YUV565,
V4L2_PIX_FMT_YUV32,
V4L2_PIX_FMT_GREY,
+   V4L2_PIX_FMT_Y16,
0
};
 
@@ -507,6 +508,7 @@ void CaptureWinGLEngine::changeShader()
case V4L2_PIX_FMT_ARGB32:
case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_GREY:
+   case V4L2_PIX_FMT_Y16:
default:
shader_RGB(m_frameFormat);
break;
@@ -614,6 +616,7 @@ void CaptureWinGLEngine::paintGL()
break;
 
case V4L2_PIX_FMT_GREY:
+   case V4L2_PIX_FMT_Y16:
case V4L2_PIX_FMT_RGB332:
case V4L2_PIX_FMT_BGR666:
case V4L2_PIX_FMT_RGB555:
@@ -1545,6 +1548,10 @@ void CaptureWinGLEngine::shader_RGB(__u32 format)
glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, 
m_frameHeight, 0,
 GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
break;
+   case V4L2_PIX_FMT_Y16:
+   internalFmt = manualTransform ? GL_LUMINANCE : GL_SLUMINANCE;
+   glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, 
m_frameHeight, 0,
+GL_LUMINANCE, GL_UNSIGNED_SHORT, NULL);
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_BGR24:
default:
@@ -1643,6 +1650,11 @@ void CaptureWinGLEngine::render_RGB(__u32 format)
GL_LUMINANCE, GL_UNSIGNED_BYTE, m_frameData);
break;
 
+   case V4L2_PIX_FMT_Y16:
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, 
m_frameHeight,
+   GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData);
+   break;
+
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
case V4L2_PIX_FMT_ARGB555X:
-- 
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 2/2] qv4l2: gl: Add support for V4L2_PIX_FMT_Y16_BE

2015-05-19 Thread Ricardo Ribalda Delgado
Add support for a 16 bit wide greyscale format in big endian.

Signed-off-by: Ricardo Ribalda Delgado ricardo.riba...@gmail.com
---
This patch needs to be applied after the headers have been updated
to support Y16_BE. It is scheduled for 4.2.

It has been tested with vivid and an nvidia-glx driver (propietary)
 utils/qv4l2/capture-win-gl.cpp | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp
index ee51089b5775..25dec3e79070 100644
--- a/utils/qv4l2/capture-win-gl.cpp
+++ b/utils/qv4l2/capture-win-gl.cpp
@@ -413,6 +413,7 @@ bool CaptureWinGLEngine::hasNativeFormat(__u32 format)
V4L2_PIX_FMT_YUV32,
V4L2_PIX_FMT_GREY,
V4L2_PIX_FMT_Y16,
+   V4L2_PIX_FMT_Y16_BE,
0
};
 
@@ -509,6 +510,7 @@ void CaptureWinGLEngine::changeShader()
case V4L2_PIX_FMT_ABGR32:
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
+   case V4L2_PIX_FMT_Y16_BE:
default:
shader_RGB(m_frameFormat);
break;
@@ -617,6 +619,7 @@ void CaptureWinGLEngine::paintGL()
 
case V4L2_PIX_FMT_GREY:
case V4L2_PIX_FMT_Y16:
+   case V4L2_PIX_FMT_Y16_BE:
case V4L2_PIX_FMT_RGB332:
case V4L2_PIX_FMT_BGR666:
case V4L2_PIX_FMT_RGB555:
@@ -1549,6 +1552,7 @@ void CaptureWinGLEngine::shader_RGB(__u32 format)
 GL_LUMINANCE, GL_UNSIGNED_BYTE, NULL);
break;
case V4L2_PIX_FMT_Y16:
+   case V4L2_PIX_FMT_Y16_BE:
internalFmt = manualTransform ? GL_LUMINANCE : GL_SLUMINANCE;
glTexImage2D(GL_TEXTURE_2D, 0, internalFmt, m_frameWidth, 
m_frameHeight, 0,
 GL_LUMINANCE, GL_UNSIGNED_SHORT, NULL);
@@ -1654,6 +1658,12 @@ void CaptureWinGLEngine::render_RGB(__u32 format)
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, 
m_frameHeight,
GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData);
break;
+   case V4L2_PIX_FMT_Y16_BE:
+   glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE);
+   glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_frameWidth, 
m_frameHeight,
+   GL_LUMINANCE, GL_UNSIGNED_SHORT, m_frameData);
+   glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
+   break;
 
case V4L2_PIX_FMT_RGB555X:
case V4L2_PIX_FMT_XRGB555X:
-- 
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 v2] [media] dvb-frontend: Replace timeval with ktime_t

2015-05-19 Thread Tina Ruchandani
struct timeval uses a 32-bit seconds representation which will
overflow in the year 2038 and beyond. This patch replaces
the usage of struct timeval with ktime_t which is a 64-bit
timestamp and is year 2038 safe.
This patch is part of a larger attempt to remove all instances
of 32-bit timekeeping variables (timeval, timespec, time_t)
which are not year 2038 safe, from the kernel.
The patch is a work-in-progress - correctness of the following
changes is unclear:
(a) Usage of timeval_usec_diff - The function seems to subtract
usec values without caring about the difference of the seconds field.
There may be an implicit assumption in the original code that the
time delta is always of the order of microseconds.
The patch replaces the usage of timeval_usec_diff with
ktime_to_us(ktime_sub()) which computes the real timestamp difference,
not just the difference in the usec field.
(b) printk diffing the tv[i] and tv[i-1] values. The original
printk statement seems to get the order wrong. This patch preserves
that order.

Signed-off-by: Tina Ruchandani ruchandani.t...@gmail.com
Suggested-by: Arnd Bergmann a...@arndb.de

--
Changes in v2:
- Use the more concise ktime_us_delta
- Preserve the waketime argument in dvb_frontend_sleep_until as
a pointer, fixes bug introduced in v1 of the patch where the caller
doesn't get its timestamp modified.
---
 drivers/media/dvb-core/dvb_frontend.c | 40 +--
 drivers/media/dvb-core/dvb_frontend.h |  3 +--
 drivers/media/dvb-frontends/stv0299.c | 11 +-
 3 files changed, 17 insertions(+), 37 deletions(-)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 882ca41..c110e37 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -40,6 +40,7 @@
 #include linux/freezer.h
 #include linux/jiffies.h
 #include linux/kthread.h
+#include linux/ktime.h
 #include asm/processor.h
 
 #include dvb_frontend.h
@@ -889,42 +890,21 @@ static void dvb_frontend_stop(struct dvb_frontend *fe)
fepriv-thread);
 }
 
-s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime)
-{
-   return ((curtime.tv_usec  lasttime.tv_usec) ?
-   100 - lasttime.tv_usec + curtime.tv_usec :
-   curtime.tv_usec - lasttime.tv_usec);
-}
-EXPORT_SYMBOL(timeval_usec_diff);
-
-static inline void timeval_usec_add(struct timeval *curtime, u32 add_usec)
-{
-   curtime-tv_usec += add_usec;
-   if (curtime-tv_usec = 100) {
-   curtime-tv_usec -= 100;
-   curtime-tv_sec++;
-   }
-}
-
 /*
  * Sleep until gettimeofday()  waketime + add_usec
  * This needs to be as precise as possible, but as the delay is
  * usually between 2ms and 32ms, it is done using a scheduled msleep
  * followed by usleep (normally a busy-wait loop) for the remainder
  */
-void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec)
+void dvb_frontend_sleep_until(ktime_t *waketime, u32 add_usec)
 {
-   struct timeval lasttime;
s32 delta, newdelta;
 
-   timeval_usec_add(waketime, add_usec);
-
-   do_gettimeofday(lasttime);
-   delta = timeval_usec_diff(lasttime, *waketime);
+   ktime_add_us(*waketime, add_usec);
+   delta = ktime_us_delta(ktime_get_real(), *waketime);
if (delta  2500) {
msleep((delta - 1500) / 1000);
-   do_gettimeofday(lasttime);
-   newdelta = timeval_usec_diff(lasttime, *waketime);
+   newdelta = ktime_us_delta(ktime_get_real(), *waketime);
delta = (newdelta  delta) ? 0 : newdelta;
}
if (delta  0)
@@ -2458,13 +2438,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
 * include the initialization or start bit
 */
unsigned long swcmd = ((unsigned long) parg)  1;
-   struct timeval nexttime;
-   struct timeval tv[10];
+   ktime_t nexttime;
+   ktime_t tv[10];
int i;
u8 last = 1;
if (dvb_frontend_debug)
printk(%s switch command: 0x%04lx\n, 
__func__, swcmd);
-   do_gettimeofday(nexttime);
+   nexttime = ktime_get_real();
if (dvb_frontend_debug)
tv[0] = nexttime;
/* before sending a command, initialize by sending
@@ -2475,7 +2455,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
 
for (i = 0; i  9; i++) {
if (dvb_frontend_debug)
-   do_gettimeofday(tv[i + 1]);
+   tv[i+1] = ktime_get_real();
if ((swcmd  0x01) != last) {
 

Re: [PULL] For 4.2 (or even 4.1?) add support for cx24120/Technisat SkyStar S2

2015-05-19 Thread Mauro Carvalho Chehab
Em Fri, 15 May 2015 16:18:07 +0100
Jemma Denson jden...@gmail.com escreveu:

 Hi Mauro,
 
 On 15/05/15 15:24, Mauro Carvalho Chehab wrote:
  Of course. Jemma and me (mainly Jemma) are progressing and might be
  able to resubmit everything this weekend.
  Good! Thanks for the good work!
 
  Mauro
 
 
 The only thing left now is moving UCB  BER over to DVBv5 stats - we 
 haven't got anything close to any specs for this demod so I'm struggling 
 to work out how to handle the counter increment.
 It's not helped by my signal not being marginal enough to see any errors 
 anyway!
 
 What's the best course of action here - either leave those two out 
 entirely or fudge something to get the numbers to about the right 
 magnitude and worry about making it more accurate at a later date?

I prefer to have something, even not 100% acurate, reported via DVBv5.

Regards,
Mauro
--
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/2] drivers: Simplify the return code

2015-05-19 Thread Mauro Carvalho Chehab
If the last thing we do in a function is to call another
function and then return its value, we don't need to store
the returned code into some ancillary var.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/lgs8gxx.c 
b/drivers/media/dvb-frontends/lgs8gxx.c
index 3c92f36ea5c7..9b0166cdc7c2 100644
--- a/drivers/media/dvb-frontends/lgs8gxx.c
+++ b/drivers/media/dvb-frontends/lgs8gxx.c
@@ -544,11 +544,7 @@ static int lgs8gxx_set_mpeg_mode(struct lgs8gxx_state 
*priv,
t |= clk_pol ? TS_CLK_INVERTED : TS_CLK_NORMAL;
t |= clk_gated ? TS_CLK_GATED : TS_CLK_FREERUN;
 
-   ret = lgs8gxx_write_reg(priv, reg_addr, t);
-   if (ret != 0)
-   return ret;
-
-   return 0;
+   return lgs8gxx_write_reg(priv, reg_addr, t);
 }
 
 /* A/D input peak-to-peak voltage range */
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index a493c0b0b5fe..1fb8ac93970f 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1310,11 +1310,7 @@ static int adv7180_resume(struct device *dev)
if (ret  0)
return ret;
 
-   ret = adv7180_set_power(state, state-powered);
-   if (ret)
-   return ret;
-
-   return 0;
+   return adv7180_set_power(state, state-powered);
 }
 
 static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c 
b/drivers/media/pci/bt8xx/bttv-driver.c
index 3632958f2158..7a0263db4d1a 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -2103,7 +2103,6 @@ verify_window_lock(struct bttv_fh *fh, struct v4l2_window 
*win,
 {
enum v4l2_field field;
unsigned int width_mask;
-   int rc;
 
if (win-w.width  48)
win-w.width = 48;
@@ -2156,13 +2155,10 @@ verify_window_lock(struct bttv_fh *fh, struct 
v4l2_window *win,
win-w.width -= win-w.left  ~width_mask;
win-w.left = (win-w.left - width_mask - 1)  width_mask;
 
-   rc = limit_scaled_size_lock(fh, win-w.width, win-w.height,
+   return limit_scaled_size_lock(fh, win-w.width, win-w.height,
   field, width_mask,
   /* width_bias: round down */ 0,
   adjust_size, adjust_crop);
-   if (0 != rc)
-   return rc;
-   return 0;
 }
 
 static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv,
diff --git a/drivers/media/pci/ngene/ngene-cards.c 
b/drivers/media/pci/ngene/ngene-cards.c
index 039bed3cc919..59dade6c156b 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -522,15 +522,11 @@ static int eeprom_read_ushort(struct i2c_adapter 
*adapter, u16 tag, u16 *data)
 
 static int eeprom_write_ushort(struct i2c_adapter *adapter, u16 tag, u16 data)
 {
-   int stat;
u8 buf[2];
 
buf[0] = data  8;
buf[1] = data  0xff;
-   stat = WriteEEProm(adapter, tag, 2, buf);
-   if (stat)
-   return stat;
-   return 0;
+   return WriteEEProm(adapter, tag, 2, buf);
 }
 
 static s16 osc_deviation(void *priv, s16 deviation, int flag)
diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c 
b/drivers/media/pci/saa7134/saa7134-alsa.c
index 1d2c310ce838..f78938d13950 100644
--- a/drivers/media/pci/saa7134/saa7134-alsa.c
+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
@@ -354,15 +354,10 @@ static int saa7134_alsa_dma_free(struct saa7134_dmasound 
*dma)
 
 static int dsp_buffer_init(struct saa7134_dev *dev)
 {
-   int err;
-
BUG_ON(!dev-dmasound.bufsize);
 
-   err = saa7134_alsa_dma_init(dev,
+   return saa7134_alsa_dma_init(dev,
   (dev-dmasound.bufsize + PAGE_SIZE)  
PAGE_SHIFT);
-   if (0 != err)
-   return err;
-   return 0;
 }
 
 /*
diff --git a/drivers/media/tuners/fc0011.c b/drivers/media/tuners/fc0011.c
index 3932aa81e18c..d70a18d8e6c1 100644
--- a/drivers/media/tuners/fc0011.c
+++ b/drivers/media/tuners/fc0011.c
@@ -152,11 +152,7 @@ static int fc0011_vcocal_trigger(struct fc0011_priv *priv)
err = fc0011_writereg(priv, FC11_REG_VCOCAL, FC11_VCOCAL_RESET);
if (err)
return err;
-   err = fc0011_writereg(priv, FC11_REG_VCOCAL, FC11_VCOCAL_RUN);
-   if (err)
-   return err;
-
-   return 0;
+   return fc0011_writereg(priv, FC11_REG_VCOCAL, FC11_VCOCAL_RUN);
 }
 
 /* Read VCO calibration value */
@@ -168,11 +164,7 @@ static int fc0011_vcocal_read(struct fc0011_priv *priv, u8 
*value)
if (err)
return err;
usleep_range(1, 2);
-   err = fc0011_readreg(priv, FC11_REG_VCOCAL, value);
-   if (err)
-   return err;
-
-   return 0;
+   return fc0011_readreg(priv, FC11_REG_VCOCAL, value);
 }
 
 static int fc0011_set_params(struct dvb_frontend *fe)
diff --git 

[PATCH 1/2] usb drivers: use BUG_ON() instead of if () BUG

2015-05-19 Thread Mauro Carvalho Chehab
Some USB drivers have a logic at the VB buffer handling like:
if (in_interrupt())
BUG();
Use, instead:
BUG_ON(in_interrupt());

Btw, this logic looks weird on my eyes. We should convert them
to use VB2, in order to avoid those crappy things.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index 855a708387c6..47a98a2014a5 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1249,8 +1249,7 @@ static void free_buffer(struct videobuf_queue *vq, struct 
cx231xx_buffer *buf)
struct cx231xx *dev = fh-dev;
unsigned long flags = 0;
 
-   if (in_interrupt())
-   BUG();
+   BUG_ON(in_interrupt());
 
spin_lock_irqsave(dev-video_mode.slock, flags);
if (dev-USE_ISO) {
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c 
b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index 80261ac40208..a08014d20a5c 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -192,8 +192,7 @@ static void free_buffer(struct videobuf_queue *vq, struct 
cx231xx_buffer *buf)
struct cx231xx_fh *fh = vq-priv_data;
struct cx231xx *dev = fh-dev;
unsigned long flags = 0;
-   if (in_interrupt())
-   BUG();
+   BUG_ON(in_interrupt());
 
/* We used to wait for the buffer to finish here, but this didn't work
   because, as we were keeping the state as VIDEOBUF_QUEUED,
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index af44f2d1c0a1..c6ff8968286a 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -749,8 +749,7 @@ static void free_buffer(struct videobuf_queue *vq, struct 
cx231xx_buffer *buf)
struct cx231xx *dev = fh-dev;
unsigned long flags = 0;
 
-   if (in_interrupt())
-   BUG();
+   BUG_ON(in_interrupt());
 
/* We used to wait for the buffer to finish here, but this didn't work
   because, as we were keeping the state as VIDEOBUF_QUEUED,
diff --git a/drivers/media/usb/tm6000/tm6000-video.c 
b/drivers/media/usb/tm6000/tm6000-video.c
index 77ce9efe1f24..26b6ae8d04da 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -714,8 +714,7 @@ static void free_buffer(struct videobuf_queue *vq, struct 
tm6000_buffer *buf)
struct tm6000_core   *dev = fh-dev;
unsigned long flags;
 
-   if (in_interrupt())
-   BUG();
+   BUG_ON(in_interrupt());
 
/* We used to wait for the buffer to finish here, but this didn't work
   because, as we were keeping the state as VIDEOBUF_QUEUED,
diff --git a/drivers/media/usb/zr364xx/zr364xx.c 
b/drivers/media/usb/zr364xx/zr364xx.c
index ca850316d379..7433ba5c4bad 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -377,8 +377,7 @@ static void free_buffer(struct videobuf_queue *vq, struct 
zr364xx_buffer *buf)
 {
_DBG(%s\n, __func__);
 
-   if (in_interrupt())
-   BUG();
+   BUG_ON(in_interrupt());
 
videobuf_vmalloc_free(buf-vb);
buf-vb.state = VIDEOBUF_NEEDS_INIT;
-- 
2.1.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 v6 06/11] cec: add HDMI CEC framework

2015-05-19 Thread Hans Verkuil
Hi Sean,

I'm taking over this patch series from Kamil for the time being with his
permission (he's switching jobs and moving house so he can't spend any time
on this for a while).

On 05/13/15 13:10, Sean Young wrote:
 On Mon, May 04, 2015 at 07:32:59PM +0200, Kamil Debski wrote:
 From: Hans Verkuil hansv...@cisco.com

 The added HDMI CEC framework provides a generic kernel interface for
 HDMI CEC devices.

 Signed-off-by: Hans Verkuil hansv...@cisco.com
 
 -snip-
 
 +int cec_create_adapter(struct cec_adapter *adap, const char *name, u32 caps)
 +{
 +int res = 0;
 +
 +adap-state = CEC_ADAP_STATE_DISABLED;
 +adap-name = name;
 +adap-phys_addr = 0x;
 +adap-capabilities = caps;
 +adap-version = CEC_VERSION_1_4;
 +adap-sequence = 0;
 +mutex_init(adap-lock);
 +adap-kthread = kthread_run(cec_thread_func, adap, name);
 +init_waitqueue_head(adap-kthread_waitq);
 +init_waitqueue_head(adap-waitq);
 +if (IS_ERR(adap-kthread)) {
 +pr_err(cec-%s: kernel_thread() failed\n, name);
 +return PTR_ERR(adap-kthread);
 +}
 +if (caps) {
 +res = cec_devnode_register(adap-devnode, adap-owner);
 +if (res)
 +kthread_stop(adap-kthread);
 +}
 +adap-recv_notifier = cec_receive_notify;
 +
 +/* Prepare the RC input device */
 +adap-rc = rc_allocate_device();
 +if (!adap-rc) {
 +pr_err(cec-%s: failed to allocate memory for rc_dev\n, name);
 +cec_devnode_unregister(adap-devnode);
 +kthread_stop(adap-kthread);
 +return -ENOMEM;
 +}
 +
 +snprintf(adap-input_name, sizeof(adap-input_name), RC for %s, name);
 +snprintf(adap-input_phys, sizeof(adap-input_phys), %s/input0, name);
 +strncpy(adap-input_drv, name, sizeof(adap-input_drv));
 +
 +adap-rc-input_name = adap-input_name;
 +adap-rc-input_phys = adap-input_phys;
 +adap-rc-dev.parent = adap-devnode.dev;
 +adap-rc-driver_name = adap-input_drv;
 +adap-rc-driver_type = RC_DRIVER_CEC;
 +adap-rc-allowed_protocols = RC_BIT_CEC;
 +adap-rc-priv = adap;
 +adap-rc-map_name = RC_MAP_CEC;
 +adap-rc-timeout = MS_TO_NS(100);
 +
 
 rc-input_id is not populated. It would be nice if input_phys has some 
 resemblance to a physical path (like the output of usb_make_path() if it
 is a usb device).

I've added a BUS_CEC type, the version field can probably get the CEC version
used, but the vendor/product IDs are difficult: there isn't a product ID in
the CEC protocol, but there is a 24-bit vendor ID. I'm wondering whether I
should just put the top 8 bits of the vendor ID in the vendor field and the
remaining 16 in the product field. That way the combination of the two will be
unique.

What do you think?

 +res = rc_register_device(adap-rc);
 +
 +if (res) {
 +pr_err(cec-%s: failed to prepare input device\n, name);
 +cec_devnode_unregister(adap-devnode);
 +rc_free_device(adap-rc);
 +kthread_stop(adap-kthread);
 +}
 +
 +return res;
 +}
 +EXPORT_SYMBOL_GPL(cec_create_adapter);
 +
 +void cec_delete_adapter(struct cec_adapter *adap)
 +{
 +if (adap-kthread == NULL)
 +return;
 +kthread_stop(adap-kthread);
 +if (adap-kthread_config)
 +kthread_stop(adap-kthread_config);
 +adap-state = CEC_ADAP_STATE_DISABLED;
 +if (cec_devnode_is_registered(adap-devnode))
 +cec_devnode_unregister(adap-devnode);
 
 I think you're missing a rc_unregister_device() here.

Yes indeed. Added.

Regards,

Hans

 
 +}
 +EXPORT_SYMBOL_GPL(cec_delete_adapter);
 
 
 Sean
 --
 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] cx24120: declare cx24120_init() as static

2015-05-19 Thread Mauro Carvalho Chehab
drivers/media/dvb-frontends/cx24120.c:1182:5: warning: no previous prototype 
for 'cx24120_init' [-Wmissing-prototypes]
 int cx24120_init(struct dvb_frontend *fe)
 ^

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/cx24120.c 
b/drivers/media/dvb-frontends/cx24120.c
index 3ab8582e233b..2dcd93f63408 100644
--- a/drivers/media/dvb-frontends/cx24120.c
+++ b/drivers/media/dvb-frontends/cx24120.c
@@ -1179,7 +1179,7 @@ static int cx24120_set_vco(struct cx24120_state *state)
return cx24120_message_send(state, cmd);
 }
 
-int cx24120_init(struct dvb_frontend *fe)
+static int cx24120_init(struct dvb_frontend *fe)
 {
const struct firmware *fw;
struct dtv_frontend_properties *c = fe-dtv_property_cache;
-- 
2.1.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/3] cx24120: don't initialize a var that won't be used

2015-05-19 Thread Mauro Carvalho Chehab
As reported by smatch:
drivers/media/dvb-frontends/cx24120.c: In function 'cx24120_message_send':
drivers/media/dvb-frontends/cx24120.c:368:6: warning: variable 'ret' set but 
not used [-Wunused-but-set-variable]
  int ret, ficus;
  ^

The values written by cx24120 are never checked. So, remove the
check here too. That's said, the best would be to do the reverse,
but globally: to properly handle the error codes.

Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

diff --git a/drivers/media/dvb-frontends/cx24120.c 
b/drivers/media/dvb-frontends/cx24120.c
index da50b9e1e9f8..3ab8582e233b 100644
--- a/drivers/media/dvb-frontends/cx24120.c
+++ b/drivers/media/dvb-frontends/cx24120.c
@@ -365,17 +365,17 @@ static void cx24120_check_cmd(struct cx24120_state 
*state, u8 id)
 static int cx24120_message_send(struct cx24120_state *state,
struct cx24120_cmd *cmd)
 {
-   int ret, ficus;
+   int ficus;
 
if (state-mpeg_enabled) {
/* Disable mpeg out on certain commands */
cx24120_check_cmd(state, cmd-id);
}
 
-   ret = cx24120_writereg(state, CX24120_REG_CMD_START, cmd-id);
-   ret = cx24120_writeregs(state, CX24120_REG_CMD_ARGS, cmd-arg[0],
-   cmd-len, 1);
-   ret = cx24120_writereg(state, CX24120_REG_CMD_END, 0x01);
+   cx24120_writereg(state, CX24120_REG_CMD_START, cmd-id);
+   cx24120_writeregs(state, CX24120_REG_CMD_ARGS, cmd-arg[0],
+ cmd-len, 1);
+   cx24120_writereg(state, CX24120_REG_CMD_END, 0x01);
 
ficus = 1000;
while (cx24120_readreg(state, CX24120_REG_CMD_END)) {
-- 
2.1.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: [PULL] For 4.2 (or even 4.1?) add support for cx24120/Technisat SkyStar S2

2015-05-19 Thread Jemma Denson

On 19/05/15 11:57, Mauro Carvalho Chehab wrote:



The only thing left now is moving UCB  BER over to DVBv5 stats - we
haven't got anything close to any specs for this demod so I'm struggling
to work out how to handle the counter increment.
It's not helped by my signal not being marginal enough to see any errors
anyway!

What's the best course of action here - either leave those two out
entirely or fudge something to get the numbers to about the right
magnitude and worry about making it more accurate at a later date?

I prefer to have something, even not 100% acurate, reported via DVBv5.

Regards,
Mauro


I think I've managed to work it out now :) It's set to use a 16 bit BER 
window and what I did manage to see suggests that the window is based on 
packets. So it's just a case of calculating things from there.


I implemented something for BER lastnight but it does need a little 
tidying. UCB should be much more straightforward. I should be able to 
find time during the week, or if not this weekend. I'll send the patches 
through to Patrick to add to his tree and then we can have a v3 pull 
request.



Jemma.
--
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 2/2] drivers: Simplify the return code

2015-05-19 Thread Federico Simoncelli
- Original Message -
 From: Mauro Carvalho Chehab mche...@osg.samsung.com
 To: Linux Media Mailing List linux-media@vger.kernel.org
 Cc: Mauro Carvalho Chehab mche...@osg.samsung.com, Mauro Carvalho 
 Chehab mche...@infradead.org, Lars-Peter
 Clausen l...@metafoo.de, Michael Buesch m...@bues.ch, Antti 
 Palosaari cr...@iki.fi, Hans Verkuil
 hverk...@xs4all.nl, Sakari Ailus sakari.ai...@linux.intel.com, Ondrej 
 Zary li...@rainbow-software.org,
 Ramakrishnan Muthukrishnan ramak...@cisco.com, Laurent Pinchart 
 laurent.pinch...@ideasonboard.com, Takashi
 Iwai ti...@suse.de, Amber Thrall amber.rose.thr...@gmail.com, 
 Federico Simoncelli fsimo...@redhat.com,
 James Harper james.har...@ejbdigital.com.au, Dan Carpenter 
 dan.carpen...@oracle.com, Konrad Rzeszutek Wilk
 konrad.w...@oracle.com
 Sent: Tuesday, May 19, 2015 1:00:57 PM
 Subject: [PATCH 2/2] drivers: Simplify the return code
 
 If the last thing we do in a function is to call another
 function and then return its value, we don't need to store
 the returned code into some ancillary var.
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
 
 diff --git a/drivers/media/dvb-frontends/lgs8gxx.c
 b/drivers/media/dvb-frontends/lgs8gxx.c
 index 3c92f36ea5c7..9b0166cdc7c2 100644
 --- a/drivers/media/dvb-frontends/lgs8gxx.c
 +++ b/drivers/media/dvb-frontends/lgs8gxx.c
 @@ -544,11 +544,7 @@ static int lgs8gxx_set_mpeg_mode(struct lgs8gxx_state
 *priv,
   t |= clk_pol ? TS_CLK_INVERTED : TS_CLK_NORMAL;
   t |= clk_gated ? TS_CLK_GATED : TS_CLK_FREERUN;
  
 - ret = lgs8gxx_write_reg(priv, reg_addr, t);
 - if (ret != 0)
 - return ret;
 -
 - return 0;
 + return lgs8gxx_write_reg(priv, reg_addr, t);
  }

Personally I prefer the current style because it's more consistent with all
the other calls in the same function (return ret when ret != 0).

It also allows you to easily add/remove calls without having to deal with
the last special case return my_last_fun_call(...).

Anyway it's not a big deal, I think it's your call.
-- 
Federico
--
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: [PULL] For 4.2 (or even 4.1?) add support for cx24120/Technisat SkyStar S2

2015-05-19 Thread Patrick Boettcher
On Tue, 19 May 2015 12:25:19 +0100 Jemma Denson jden...@gmail.com
wrote:

 On 19/05/15 11:57, Mauro Carvalho Chehab wrote:
 
  The only thing left now is moving UCB  BER over to DVBv5 stats - we
  haven't got anything close to any specs for this demod so I'm struggling
  to work out how to handle the counter increment.
  It's not helped by my signal not being marginal enough to see any errors
  anyway!
 
  What's the best course of action here - either leave those two out
  entirely or fudge something to get the numbers to about the right
  magnitude and worry about making it more accurate at a later date?
  I prefer to have something, even not 100% acurate, reported via DVBv5.
 
  Regards,
  Mauro
 
 I think I've managed to work it out now :) It's set to use a 16 bit BER 
 window and what I did manage to see suggests that the window is based on 
 packets. So it's just a case of calculating things from there.
 
 I implemented something for BER lastnight but it does need a little 
 tidying. UCB should be much more straightforward. I should be able to 
 find time during the week, or if not this weekend. I'll send the patches 
 through to Patrick to add to his tree and then we can have a v3 pull 
 request.

Great job. Let's do it so. I will check with Mauro about his patches.

--
Patrick.
--
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 1/3] cx24120: don't initialize a var that won't be used

2015-05-19 Thread Patrick Boettcher
Hi Mauro, 

On Tue, 19 May 2015 08:23:36 -0300 Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:

 As reported by smatch:
 drivers/media/dvb-frontends/cx24120.c: In function 'cx24120_message_send':
 drivers/media/dvb-frontends/cx24120.c:368:6: warning: variable 'ret' set but 
 not used [-Wunused-but-set-variable]
   int ret, ficus;
   ^
 
 The values written by cx24120 are never checked. So, remove the
 check here too. That's said, the best would be to do the reverse,
 but globally: to properly handle the error codes.
 
 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Woudl you mind me integrating your patches on my tree which I then
will ask you to pull?

--
Patrick.
--
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 1/1] omap3isp: Fix async notifier registration order

2015-05-19 Thread Sebastian Reichel
Hi Sakari,

On Wed, May 20, 2015 at 02:08:05AM +0300, Sakari Ailus wrote:
 The async notifier was registered before the v4l2_device was registered and
 before the notifier callbacks were set. This could lead to missing the
 bound() and complete() callbacks and to attempting to spin_lock() and
 uninitialised spin lock.
 
 Also fix unregistering the async notifier in the case of an error --- the
 function may not fail anymore after the notifier is registered.
 
 Signed-off-by: Sakari Ailus sakari.ai...@iki.fi

I already noticed this during my Camera for N900 work and solved it
the same way, so:

Reviewed-By: Sebastian Reichel s...@kernel.org

You may want to add a Fixes Tag against the patch implementing the
async notifier support in omap3isp, since its quite easy to run into
the callback problems (at least I did) and the missing resource
freeing (due to EPROBE_AGAIN).

-- Sebastian


signature.asc
Description: Digital signature


Re: [PATCH v2 1/2] clk: change clk_ops' -round_rate() prototype

2015-05-19 Thread Stephen Boyd
On 05/16, Mikko Perttunen wrote:
 On 05/15/2015 06:40 PM, Boris Brezillon wrote:
 Hi Stephen,
 
 Adding Mikko in the loop (after all, he was the one complaining about
 this signed long limitation in the first place, and I forgot to add
 him in the Cc list :-/).
 
 I think I got it through linux-tegra anyway, but thanks :)
 
 
 Mikko, are you okay with the approach proposed by Stephen (adding a
 new method) ?
 
 Yes, sounds good to me. If a driver uses the existing methods with
 too large frequencies, the issue is pretty discoverable anyway. I
 think adjust_rate sounds a bit too much like it sets the clock's
 rate, though; perhaps adjust_rate_request or something like that?
 

Well I'm also OK with changing the determine_rate API one more
time, but we'll have to be careful. Invariably someone will push
a new clock driver through some non-clk tree path and we'll get
build breakage. They shouldn't be doing that, so either we do the
change now and push it to -next and see what breaks, or we do
this after -rc1 comes out and make sure everyone has lots of
warning.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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: ERRORS

2015-05-19 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:   Wed May 20 04:00:21 CEST 2015
git branch: test
git hash:   9cae84b32dd52768cf2fd2fcb214c3f570676c4b
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-44-g40791b9
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: WARNINGS
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-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.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: WARNINGS
linux-3.12.23-i686: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0-i686: WARNINGS
linux-4.1-rc1-i686: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
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: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: WARNINGS
linux-3.12.23-x86_64: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0-x86_64: WARNINGS
linux-4.1-rc1-x86_64: WARNINGS
apps: OK
spec-git: OK
sparse: ERRORS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.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


Re: [PATCH 1/2] usb drivers: use BUG_ON() instead of if () BUG

2015-05-19 Thread Lad, Prabhakar
On Tue, May 19, 2015 at 12:00 PM, Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:
 Some USB drivers have a logic at the VB buffer handling like:
 if (in_interrupt())
 BUG();
 Use, instead:
 BUG_ON(in_interrupt());

 Btw, this logic looks weird on my eyes. We should convert them
 to use VB2, in order to avoid those crappy things.

 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Cheers,
--Prabhakar Lad
--
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] ov2659: add v4l2_subdev dependency

2015-05-19 Thread Lad, Prabhakar
Hi Arnd,

Thanks for the patch.

On Tue, May 19, 2015 at 1:39 PM, Arnd Bergmann a...@arndb.de wrote:
 The newly added ov2659 driver uses the v4l2 subdev API, but
 can be enabled even when that API is not part of the kernel,
 resulting in this build error:

 media/i2c/ov2659.c: In function 'ov2659_get_fmt':
 media/i2c/ov2659.c:1054:8: error: implicit declaration of function 
 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
 media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from integer 
 without a cast [-Wint-conversion]
 media/i2c/ov2659.c: In function 'ov2659_set_fmt':
 media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from integer 
 without a cast [-Wint-conversion]
 media/i2c/ov2659.c: In function 'ov2659_open':
 media/i2c/ov2659.c:1264:38: error: 'struct v4l2_subdev_fh' has no member 
 named 'pad'

 This adds an explicit dependency, like all the other drivers have.

Patch fixing the above issue is already posted in the ML [1].

[1] https://patchwork.linuxtv.org/patch/29665/

Cheers,
--Prabhakar Lad
--
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] media: v4l2-core/v4l2-of.c: determine bus_type only on hsync/vsync flags

2015-05-19 Thread Lad Prabhakar
From: Lad, Prabhakar prabhakar.cse...@gmail.com

the bus_type needs to be determined only on the hsync/vsync flags,
this patch fixes the above by moving the check just after hsync/vsync
flags are being set.

Reported-by: Nikhil Devshatwar nikhil...@ti.com
Signed-off-by: Lad, Prabhakar prabhakar.cse...@gmail.com
---
 drivers/media/v4l2-core/v4l2-of.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-of.c 
b/drivers/media/v4l2-core/v4l2-of.c
index c52fb96..7f89c70 100644
--- a/drivers/media/v4l2-core/v4l2-of.c
+++ b/drivers/media/v4l2-core/v4l2-of.c
@@ -93,6 +93,11 @@ static void v4l2_of_parse_parallel_bus(const struct 
device_node *node,
flags |= v ? V4L2_MBUS_VSYNC_ACTIVE_HIGH :
V4L2_MBUS_VSYNC_ACTIVE_LOW;
 
+   if (flags)
+   endpoint-bus_type = V4L2_MBUS_PARALLEL;
+   else
+   endpoint-bus_type = V4L2_MBUS_BT656;
+
if (!of_property_read_u32(node, pclk-sample, v))
flags |= v ? V4L2_MBUS_PCLK_SAMPLE_RISING :
V4L2_MBUS_PCLK_SAMPLE_FALLING;
@@ -100,10 +105,6 @@ static void v4l2_of_parse_parallel_bus(const struct 
device_node *node,
if (!of_property_read_u32(node, field-even-active, v))
flags |= v ? V4L2_MBUS_FIELD_EVEN_HIGH :
V4L2_MBUS_FIELD_EVEN_LOW;
-   if (flags)
-   endpoint-bus_type = V4L2_MBUS_PARALLEL;
-   else
-   endpoint-bus_type = V4L2_MBUS_BT656;
 
if (!of_property_read_u32(node, data-active, v))
flags |= v ? V4L2_MBUS_DATA_ACTIVE_HIGH :
-- 
2.1.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] ov2659: Don't depend on subdev API

2015-05-19 Thread Lad, Prabhakar
Hi Mauro,

Thanks for the patch.

On Thu, May 14, 2015 at 11:27 PM, Mauro Carvalho Chehab
mche...@osg.samsung.com wrote:
 The subdev API is optional. No driver should depend on it.

 Avoid compilation breakages if subdev API is not selected:

 drivers/media/i2c/ov2659.c: In function ‘ov2659_get_fmt’:
 drivers/media/i2c/ov2659.c:1054:3: error: implicit declaration of function 
 ‘v4l2_subdev_get_try_format’ [-Werror=implicit-function-declaration]
mf = v4l2_subdev_get_try_format(sd, cfg, 0);
^
 drivers/media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from 
 integer without a cast
mf = v4l2_subdev_get_try_format(sd, cfg, 0);
   ^
 drivers/media/i2c/ov2659.c: In function ‘ov2659_set_fmt’:
 drivers/media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from 
 integer without a cast
mf = v4l2_subdev_get_try_format(sd, cfg, fmt-pad);
   ^
 drivers/media/i2c/ov2659.c: In function ‘ov2659_open’:
 drivers/media/i2c/ov2659.c:1264:38: error: ‘struct v4l2_subdev_fh’ has no 
 member named ‘pad’
  v4l2_subdev_get_try_format(sd, fh-pad, 0);
   ^

 Compile-tested only.

 Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com

Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com
Tested-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Cheers,
--Prabhakar Lad
--
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 v4] Staging: media: lirc: Replace timeval with ktime_t

2015-05-19 Thread Ksenija Stanojevic
'struct timeval last_tv' is used to get the time of last signal change
and 'struct timeval last_intr_tv' is used to get the time of last UART
interrupt.
32-bit systems using 'struct timeval' will break in the year 2038, so we
have to replace that code with more appropriate types.
Here struct timeval is replaced with ktime_t.

Signed-off-by: Ksenija Stanojevic ksenija.stanoje...@gmail.com
---

Changes in v4:
- add lirc in subject line.
- remove delta function.
- change variable names.

Changes in v3:
- delta function is changed to inline function.
- change variable names.

Changes in v2:
- change subject line

 drivers/staging/media/lirc/lirc_sir.c | 75 ++-
 1 file changed, 30 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_sir.c 
b/drivers/staging/media/lirc/lirc_sir.c
index 29087f6..4f326e9 100644
--- a/drivers/staging/media/lirc/lirc_sir.c
+++ b/drivers/staging/media/lirc/lirc_sir.c
@@ -44,7 +44,7 @@
 #include linux/ioport.h
 #include linux/kernel.h
 #include linux/serial_reg.h
-#include linux/time.h
+#include linux/ktime.h
 #include linux/string.h
 #include linux/types.h
 #include linux/wait.h
@@ -127,9 +127,9 @@ static int threshold = 3;
 static DEFINE_SPINLOCK(timer_lock);
 static struct timer_list timerlist;
 /* time of last signal change detected */
-static struct timeval last_tv = {0, 0};
+static ktime_t last;
 /* time of last UART data ready interrupt */
-static struct timeval last_intr_tv = {0, 0};
+static ktime_t last_intr_time;
 static int last_value;
 
 static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue);
@@ -400,20 +400,6 @@ static void drop_chrdev(void)
 }
 
 /* SECTION: Hardware */
-static long delta(struct timeval *tv1, struct timeval *tv2)
-{
-   unsigned long deltv;
-
-   deltv = tv2-tv_sec - tv1-tv_sec;
-   if (deltv  15)
-   deltv = 0xFF;
-   else
-   deltv = deltv*100 +
-   tv2-tv_usec -
-   tv1-tv_usec;
-   return deltv;
-}
-
 static void sir_timeout(unsigned long data)
 {
/*
@@ -432,12 +418,14 @@ static void sir_timeout(unsigned long data)
/* clear unread bits in UART and restart */
outb(UART_FCR_CLEAR_RCVR, io + UART_FCR);
/* determine 'virtual' pulse end: */
-   pulse_end = delta(last_tv, last_intr_tv);
+   pulse_end = min_t(unsigned long,
+ ktime_us_delta(last, last_intr_time),
+ PULSE_MASK);
dev_dbg(driver.dev, timeout add %d for %lu usec\n,
last_value, pulse_end);
add_read_queue(last_value, pulse_end);
last_value = 0;
-   last_tv = last_intr_tv;
+   last = last_intr_time;
}
spin_unlock_irqrestore(timer_lock, flags);
 }
@@ -445,9 +433,9 @@ static void sir_timeout(unsigned long data)
 static irqreturn_t sir_interrupt(int irq, void *dev_id)
 {
unsigned char data;
-   struct timeval curr_tv;
-   static unsigned long deltv;
-   unsigned long deltintrtv;
+   ktime_t curr_time;
+   static unsigned long delt;
+   unsigned long deltintr;
unsigned long flags;
int iir, lsr;
 
@@ -471,49 +459,46 @@ static irqreturn_t sir_interrupt(int irq, void *dev_id)
do {
del_timer(timerlist);
data = inb(io + UART_RX);
-   do_gettimeofday(curr_tv);
-   deltv = delta(last_tv, curr_tv);
-   deltintrtv = delta(last_intr_tv, curr_tv);
+   curr_time = ktime_get();
+   delt = min_t(unsigned long,
+ktime_us_delta(last, curr_time),
+PULSE_MASK);
+   deltintr = min_t(unsigned long,
+ktime_us_delta(last_intr_time,
+   curr_time),
+PULSE_MASK);
dev_dbg(driver.dev, t %lu, d %d\n,
-   deltintrtv, (int)data);
+   deltintr, (int)data);
/*
 * if nothing came in last X cycles,
 * it was gap
 */
-   if (deltintrtv  TIME_CONST * threshold) {
+   if (deltintr  TIME_CONST * threshold) {
if (last_value) {
dev_dbg(driver.dev, GAP\n);
  

[PATCH] [media] ov2659: add v4l2_subdev dependency

2015-05-19 Thread Arnd Bergmann
The newly added ov2659 driver uses the v4l2 subdev API, but
can be enabled even when that API is not part of the kernel,
resulting in this build error:

media/i2c/ov2659.c: In function 'ov2659_get_fmt':
media/i2c/ov2659.c:1054:8: error: implicit declaration of function 
'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
media/i2c/ov2659.c: In function 'ov2659_set_fmt':
media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from integer 
without a cast [-Wint-conversion]
media/i2c/ov2659.c: In function 'ov2659_open':
media/i2c/ov2659.c:1264:38: error: 'struct v4l2_subdev_fh' has no member named 
'pad'

This adds an explicit dependency, like all the other drivers have.

Signed-off-by: Arnd Bergmann a...@arndb.de
Fixes: c4c0283ab3c ([media] media: i2c: add support for omnivision's ov2659 
sensor)

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 6f30ea76151a..db01ed84918f 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -469,7 +469,7 @@ config VIDEO_SMIAPP_PLL
 config VIDEO_OV2659
tristate OmniVision OV2659 sensor support
depends on VIDEO_V4L2  I2C
-   depends on MEDIA_CAMERA_SUPPORT
+   depends on MEDIA_CAMERA_SUPPORT  VIDEO_V4L2_SUBDEV_API
---help---
  This is a Video4Linux2 sensor-level driver for the OmniVision
  OV2659 camera.
--
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 2/2] drivers: Simplify the return code

2015-05-19 Thread Michael Büsch
On Tue, 19 May 2015 08:05:56 -0400 (EDT)
Federico Simoncelli fsimo...@redhat.com wrote:
  diff --git a/drivers/media/dvb-frontends/lgs8gxx.c
  b/drivers/media/dvb-frontends/lgs8gxx.c
  index 3c92f36ea5c7..9b0166cdc7c2 100644
  --- a/drivers/media/dvb-frontends/lgs8gxx.c
  +++ b/drivers/media/dvb-frontends/lgs8gxx.c
  @@ -544,11 +544,7 @@ static int lgs8gxx_set_mpeg_mode(struct lgs8gxx_state
  *priv,
  t |= clk_pol ? TS_CLK_INVERTED : TS_CLK_NORMAL;
  t |= clk_gated ? TS_CLK_GATED : TS_CLK_FREERUN;
   
  -   ret = lgs8gxx_write_reg(priv, reg_addr, t);
  -   if (ret != 0)
  -   return ret;
  -
  -   return 0;
  +   return lgs8gxx_write_reg(priv, reg_addr, t);
   }
 
 Personally I prefer the current style because it's more consistent with all
 the other calls in the same function (return ret when ret != 0).
 
 It also allows you to easily add/remove calls without having to deal with
 the last special case return my_last_fun_call(...).
 
 Anyway it's not a big deal, I think it's your call.


I agree. I also prefer the current style for these reasons. The compiler will 
also generate the same code in both cases.
I don't think it really simplifies the code.
But if you really insist on doing this change, go for it. You get my ack for 
fc0011

-- 
Michael


pgpTs9rqSpDag.pgp
Description: OpenPGP digital signature


[PATCH] [media] coda: remove extraneous TRACE_SYSTEM_STRING

2015-05-19 Thread Arnd Bergmann
The coda tracing code causes lots of warnings like

In file included from /git/arm-soc/include/trace/define_trace.h:90:0,
 from /git/arm-soc/drivers/media/platform/coda/trace.h:203,
 from /git/arm-soc/drivers/media/platform/coda/coda-bit.c:34:
/git/arm-soc/include/trace/ftrace.h:28:0: warning: TRACE_SYSTEM_STRING 
redefined
 #define TRACE_SYSTEM_STRING __app(TRACE_SYSTEM_VAR,__trace_system_name)
 ^
In file included from /git/arm-soc/include/trace/define_trace.h:83:0,
 from /git/arm-soc/drivers/media/platform/coda/trace.h:203,
 from /git/arm-soc/drivers/media/platform/coda/coda-bit.c:34:
/git/arm-soc/drivers/media/platform/coda/./trace.h:12:0: note: this is the 
location of the previous definition
 #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)

From what I can tell, this is just the result of a bogus TRACE_SYSTEM_STRING
definition, and removing that one makes the warnings go away.

Signed-off-by: Arnd Bergmann a...@arndb.de
Fixes: 9a1a8f9953f ([media] coda: Add tracing support)

diff --git a/drivers/media/platform/coda/trace.h 
b/drivers/media/platform/coda/trace.h
index d1d06cbd1f6a..781bf7286d53 100644
--- a/drivers/media/platform/coda/trace.h
+++ b/drivers/media/platform/coda/trace.h
@@ -9,8 +9,6 @@
 
 #include coda.h
 
-#define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM)
-
 TRACE_EVENT(coda_bit_run,
TP_PROTO(struct coda_ctx *ctx, int cmd),
 

--
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/4] rc-core fixups

2015-05-19 Thread David Härdeman
The first two patches are fixups that should be uncontroversial.

The third patch is another take on a similar patch already submitted by Sean.

The fourth patch is another cleanup that should be applied before we look
at implementing scancodes in the set/get keycode ioctls.

---

David Härdeman (4):
  rc-core: fix remove uevent generation
  rc-core: use an IDA rather than a bitmap
  rc-core: remove the LIRC protocol
  lmedm04: NEC scancode cleanup


 drivers/media/rc/ir-lirc-codec.c   |5 -
 drivers/media/rc/keymaps/rc-lirc.c |2 
 drivers/media/rc/keymaps/rc-lme2510.c  |  132 
 drivers/media/rc/rc-ir-raw.c   |2 
 drivers/media/rc/rc-main.c |   57 +++---
 drivers/media/usb/dvb-usb-v2/lmedm04.c |   21 +++--
 include/media/rc-core.h|4 -
 include/media/rc-map.h |   38 -
 8 files changed, 129 insertions(+), 132 deletions(-)

--
David Härdeman
--
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/4] rc-core: remove the LIRC protocol

2015-05-19 Thread David Härdeman
The LIRC protocol was always a bad fit and if we're ever going to expose
protocol numbers in a user-space API, it'd be better to get rid of the
LIRC protocol first.

The sysfs API is kept backwards compatible by always listing the lirc
protocol as present and enabled.

Signed-off-by: David Härdeman da...@hardeman.nu
---
 drivers/media/rc/ir-lirc-codec.c   |5 +
 drivers/media/rc/keymaps/rc-lirc.c |2 +-
 drivers/media/rc/rc-main.c |   14 +
 include/media/rc-map.h |   38 +---
 4 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 98893a8..a32659f 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -35,9 +35,6 @@ static int ir_lirc_decode(struct rc_dev *dev, struct 
ir_raw_event ev)
struct lirc_codec *lirc = dev-raw-lirc;
int sample;
 
-   if (!(dev-enabled_protocols  RC_BIT_LIRC))
-   return 0;
-
if (!dev-raw-lirc.drv || !dev-raw-lirc.drv-rbuf)
return -EINVAL;
 
@@ -424,7 +421,7 @@ static int ir_lirc_unregister(struct rc_dev *dev)
 }
 
 static struct ir_raw_handler lirc_handler = {
-   .protocols  = RC_BIT_LIRC,
+   .protocols  = 0,
.decode = ir_lirc_decode,
.raw_register   = ir_lirc_register,
.raw_unregister = ir_lirc_unregister,
diff --git a/drivers/media/rc/keymaps/rc-lirc.c 
b/drivers/media/rc/keymaps/rc-lirc.c
index fbf08fa..e172f5d 100644
--- a/drivers/media/rc/keymaps/rc-lirc.c
+++ b/drivers/media/rc/keymaps/rc-lirc.c
@@ -20,7 +20,7 @@ static struct rc_map_list lirc_map = {
.map = {
.scan= lirc,
.size= ARRAY_SIZE(lirc),
-   .rc_type = RC_TYPE_LIRC,
+   .rc_type = RC_TYPE_OTHER,
.name= RC_MAP_LIRC,
}
 };
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 20914ed..c808165 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -800,7 +800,6 @@ static struct {
{ RC_BIT_SANYO, sanyo },
{ RC_BIT_SHARP, sharp },
{ RC_BIT_MCE_KBD,   mce_kbd   },
-   { RC_BIT_LIRC,  lirc  },
{ RC_BIT_XMP,   xmp   },
 };
 
@@ -885,6 +884,9 @@ static ssize_t show_protocols(struct device *device,
allowed = ~proto_names[i].type;
}
 
+   if (dev-driver_type == RC_DRIVER_IR_RAW)
+   tmp += sprintf(tmp, [lirc] );
+
if (tmp != buf)
tmp--;
*tmp = '\n';
@@ -936,8 +938,12 @@ static int parse_protocol_change(u64 *protocols, const 
char *buf)
}
 
if (i == ARRAY_SIZE(proto_names)) {
-   IR_dprintk(1, Unknown protocol: '%s'\n, tmp);
-   return -EINVAL;
+   if (!strcasecmp(tmp, lirc))
+   mask = 0;
+   else {
+   IR_dprintk(1, Unknown protocol: '%s'\n, tmp);
+   return -EINVAL;
+   }
}
 
count++;
@@ -1425,8 +1431,6 @@ int rc_register_device(struct rc_dev *dev)
 
if (dev-change_protocol) {
u64 rc_type = (1ll  rc_map-rc_type);
-   if (dev-driver_type == RC_DRIVER_IR_RAW)
-   rc_type |= RC_BIT_LIRC;
rc = dev-change_protocol(dev, rc_type);
if (rc  0)
goto out_raw;
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index e7a1514..9133363 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -14,30 +14,28 @@
 enum rc_type {
RC_TYPE_UNKNOWN = 0,/* Protocol not known */
RC_TYPE_OTHER   = 1,/* Protocol known but proprietary */
-   RC_TYPE_LIRC= 2,/* Pass raw IR to lirc userspace */
-   RC_TYPE_RC5 = 3,/* Philips RC5 protocol */
-   RC_TYPE_RC5X= 4,/* Philips RC5x protocol */
-   RC_TYPE_RC5_SZ  = 5,/* StreamZap variant of RC5 */
-   RC_TYPE_JVC = 6,/* JVC protocol */
-   RC_TYPE_SONY12  = 7,/* Sony 12 bit protocol */
-   RC_TYPE_SONY15  = 8,/* Sony 15 bit protocol */
-   RC_TYPE_SONY20  = 9,/* Sony 20 bit protocol */
-   RC_TYPE_NEC = 10,   /* NEC protocol */
-   RC_TYPE_SANYO   = 11,   /* Sanyo protocol */
-   RC_TYPE_MCE_KBD = 12,   /* RC6-ish MCE keyboard/mouse */
-   RC_TYPE_RC6_0   = 13,   /* Philips RC6-0-16 protocol */
-   RC_TYPE_RC6_6A_20   = 14,   /* Philips RC6-6A-20 protocol */
-   RC_TYPE_RC6_6A_24   = 15,   /* Philips RC6-6A-24 protocol */
-   RC_TYPE_RC6_6A_32   = 16,   /* Philips 

[PATCH 1/1] omap3isp: Fix async notifier registration order

2015-05-19 Thread Sakari Ailus
The async notifier was registered before the v4l2_device was registered and
before the notifier callbacks were set. This could lead to missing the
bound() and complete() callbacks and to attempting to spin_lock() and
uninitialised spin lock.

Also fix unregistering the async notifier in the case of an error --- the
function may not fail anymore after the notifier is registered.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/media/platform/omap3isp/isp.c |   19 ---
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 18d0a87..0fa95cc 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -2423,10 +2423,6 @@ static int isp_probe(struct platform_device *pdev)
ret = isp_of_parse_nodes(pdev-dev, isp-notifier);
if (ret  0)
return ret;
-   ret = v4l2_async_notifier_register(isp-v4l2_dev,
-  isp-notifier);
-   if (ret)
-   return ret;
} else {
isp-pdata = pdev-dev.platform_data;
isp-syscon = syscon_regmap_lookup_by_pdevname(syscon.0);
@@ -2557,18 +2553,27 @@ static int isp_probe(struct platform_device *pdev)
if (ret  0)
goto error_iommu;
 
-   isp-notifier.bound = isp_subdev_notifier_bound;
-   isp-notifier.complete = isp_subdev_notifier_complete;
-
ret = isp_register_entities(isp);
if (ret  0)
goto error_modules;
 
+   if (IS_ENABLED(CONFIG_OF)  pdev-dev.of_node) {
+   isp-notifier.bound = isp_subdev_notifier_bound;
+   isp-notifier.complete = isp_subdev_notifier_complete;
+
+   ret = v4l2_async_notifier_register(isp-v4l2_dev,
+  isp-notifier);
+   if (ret)
+   goto error_register_entities;
+   }
+
isp_core_init(isp, 1);
omap3isp_put(isp);
 
return 0;
 
+error_register_entities:
+   isp_unregister_entities(isp);
 error_modules:
isp_cleanup_modules(isp);
 error_iommu:
-- 
1.7.10.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: [PATCH v3 1/7] rc: rc-ir-raw: Add scancode encoder callback

2015-05-19 Thread David Härdeman
On Tue, Mar 31, 2015 at 08:48:06PM +0300, Antti Seppälä wrote:
From: James Hogan ja...@albanarts.com

Add a callback to raw ir handlers for encoding and modulating a scancode
to a set of raw events. This could be used for transmit, or for
converting a wakeup scancode filter to a form that is more suitable for
raw hardware wake up filters.

Signed-off-by: James Hogan ja...@albanarts.com
Signed-off-by: Antti Seppälä a.sepp...@gmail.com
Cc: David Härdeman da...@hardeman.nu
---

Notes:
Changes in v3:
 - Ported to apply against latest media-tree

Changes in v2:
 - Alter encode API to return -ENOBUFS when there isn't enough buffer
   space. When this occurs all buffer contents must have been written
   with the partial encoding of the scancode. This is to allow drivers
   such as nuvoton-cir to provide a shorter buffer and still get a
   useful partial encoding for the wakeup pattern.

 drivers/media/rc/rc-core-priv.h |  2 ++
 drivers/media/rc/rc-ir-raw.c| 37 +
 include/media/rc-core.h |  3 +++
 3 files changed, 42 insertions(+)

diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index b68d4f76..122c25f 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -25,6 +25,8 @@ struct ir_raw_handler {
 
   u64 protocols; /* which are handled by this handler */
   int (*decode)(struct rc_dev *dev, struct ir_raw_event event);
+  int (*encode)(u64 protocols, const struct rc_scancode_filter *scancode,
+struct ir_raw_event *events, unsigned int max);
 
   /* These two should only be used by the lirc decoder */
   int (*raw_register)(struct rc_dev *dev);
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index b732ac6..dd47fe5 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -246,6 +246,43 @@ static int change_protocol(struct rc_dev *dev, u64 
*rc_type)
   return 0;
 }
 
+/**
+ * ir_raw_encode_scancode() - Encode a scancode as raw events
+ *
+ * @protocols:permitted protocols
+ * @scancode: scancode filter describing a single scancode
+ * @events:   array of raw events to write into
+ * @max:  max number of raw events
+ *
+ * Attempts to encode the scancode as raw events.
+ *
+ * Returns:   The number of events written.
+ *-ENOBUFS if there isn't enough space in the array to fit the
+ *encoding. In this case all @max events will have been written.
+ *-EINVAL if the scancode is ambiguous or invalid, or if no
+ *compatible encoder was found.
+ */
+int ir_raw_encode_scancode(u64 protocols,

Why a bitmask of protocols and not a single protocol enum? What's the
use case for encoding a given scancode according to one out of a number
of protocols (and not even knowing which one)??

+ const struct rc_scancode_filter *scancode,
+ struct ir_raw_event *events, unsigned int max)
+{
+  struct ir_raw_handler *handler;
+  int ret = -EINVAL;
+
+  mutex_lock(ir_raw_handler_lock);
+  list_for_each_entry(handler, ir_raw_handler_list, list) {
+  if (handler-protocols  protocols  handler-encode) {
+  ret = handler-encode(protocols, scancode, events, max);
+  if (ret = 0 || ret == -ENOBUFS)
+  break;
+  }
+  }
+  mutex_unlock(ir_raw_handler_lock);
+
+  return ret;
+}
+EXPORT_SYMBOL(ir_raw_encode_scancode);
+
 /*
  * Used to (un)register raw event clients
  */
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 2c7fbca..5703c08 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -250,6 +250,9 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum 
raw_event_type type);
 int ir_raw_event_store_with_filter(struct rc_dev *dev,
   struct ir_raw_event *ev);
 void ir_raw_event_set_idle(struct rc_dev *dev, bool idle);
+int ir_raw_encode_scancode(u64 protocols,
+ const struct rc_scancode_filter *scancode,
+ struct ir_raw_event *events, unsigned int max);
 
 static inline void ir_raw_event_reset(struct rc_dev *dev)
 {
-- 
2.0.5


-- 
David Härdeman
--
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 4/4] ir-keytable: allow protocol for scancode-keycode mappings

2015-05-19 Thread David Härdeman
On Thu, May 14, 2015 at 06:24:46PM -0300, Mauro Carvalho Chehab wrote:
Em Mon, 06 Apr 2015 13:26:18 +0200
David Härdeman da...@hardeman.nu escreveu:

 Introduce a list of kernel ir protocols (e.g. sony12 instead of sony)
 and extend the set-key command to ir-keytable to allow for a mapping of the
 form protocol:scancode=keycode in addition to the old scancode=keycode
 format. The code automatically falls back to the old behaviour if the
 kernel doesn't support the new approach with protocols.
 
 The read command is also updated to show the protocol information if the
 kernel supports it.


I applied patches 1 to 3 of this series, as they are not based on any
new feature.

This patch, however, needs to wait for the Kernel patch to be acked, and
may be modified, depending on the review process.

I'll mark it at patchwork as RFC. Please re-submit after we merge the
Kernel changes.

Agreed :)


Thanks,
Mauro

 
 Signed-off-by: David Härdeman da...@hardeman.nu
 ---
  utils/keytable/keytable.c |  288 
 -
  1 file changed, 202 insertions(+), 86 deletions(-)
 
 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
 index 63eea2e..fd50095 100644
 --- a/utils/keytable/keytable.c
 +++ b/utils/keytable/keytable.c
 @@ -55,13 +55,22 @@ struct input_keymap_entry_v2 {
  #define EVIOCSKEYCODE_V2_IOW('E', 0x04, struct input_keymap_entry_v2)
  #endif
  
 -struct keytable_entry {
 -u_int32_t scancode;
 -u_int32_t keycode;
 -struct keytable_entry *next;
 +struct rc_scancode {
 +u_int16_t protocol;
 +u_int16_t reserved[3];
 +u_int64_t scancode;
  };
  
 -struct keytable_entry *keytable = NULL;
 +struct rc_keymap_entry {
 +u_int8_t  flags;
 +u_int8_t  len;
 +u_int16_t index;
 +u_int32_t keycode;
 +union {
 +struct rc_scancode rc;
 +u_int8_t raw[32];
 +};
 +};
  
  struct uevents {
  char*key;
 @@ -109,41 +118,76 @@ enum sysfs_protocols {
  SYSFS_INVALID   = 0,
  };
  
 +enum kernel_protocol {
 +KERN_UNKNOWN= 0,/* Protocol not known */
 +KERN_OTHER  = 1,/* Protocol known but proprietary */
 +KERN_LIRC   = 2,/* Pass raw IR to lirc userspace */
 +KERN_RC5= 3,/* Philips RC5 protocol */
 +KERN_RC5X   = 4,/* Philips RC5x protocol */
 +KERN_RC5_SZ = 5,/* StreamZap variant of RC5 */
 +KERN_JVC= 6,/* JVC protocol */
 +KERN_SONY12 = 7,/* Sony 12 bit protocol */
 +KERN_SONY15 = 8,/* Sony 15 bit protocol */
 +KERN_SONY20 = 9,/* Sony 20 bit protocol */
 +KERN_NEC= 10,   /* NEC protocol */
 +KERN_SANYO  = 11,   /* Sanyo protocol */
 +KERN_MCE_KBD= 12,   /* RC6-ish MCE keyboard/mouse */
 +KERN_RC6_0  = 13,   /* Philips RC6-0-16 protocol */
 +KERN_RC6_6A_20  = 14,   /* Philips RC6-6A-20 protocol */
 +KERN_RC6_6A_24  = 15,   /* Philips RC6-6A-24 protocol */
 +KERN_RC6_6A_32  = 16,   /* Philips RC6-6A-32 protocol */
 +KERN_RC6_MCE= 17,   /* MCE (Philips RC6-6A-32 subtype) 
 protocol */
 +KERN_SHARP  = 18,   /* Sharp protocol */
 +KERN_XMP= 19,   /* XMP protocol */
 +KERN_INVALID= 31,   /* internal, no real protocol number */
 +};
 +
  struct protocol_map_entry {
  const char *name;
  const char *sysfs1_name;
  enum sysfs_protocols sysfs_protocol;
 +enum kernel_protocol kernel_protocol;
  };
  
  const struct protocol_map_entry protocol_map[] = {
 -{ unknown,NULL,   SYSFS_UNKNOWN   },
 -{ other,  NULL,   SYSFS_OTHER },
 -{ lirc,   NULL,   SYSFS_LIRC  },
 -{ rc-5,   /rc5_decoder, SYSFS_RC5   },
 -{ rc5,NULL,   SYSFS_RC5   },
 -{ rc-5x,  NULL,   SYSFS_INVALID   },
 -{ rc5x,   NULL,   SYSFS_INVALID   },
 -{ jvc,/jvc_decoder, SYSFS_JVC   },
 -{ sony,   /sony_decoder,SYSFS_SONY  },
 -{ sony12, NULL,   SYSFS_INVALID   },
 -{ sony15, NULL,   SYSFS_INVALID   },
 -{ sony20, NULL,   SYSFS_INVALID   },
 -{ nec,/nec_decoder, SYSFS_NEC   },
 -{ sanyo,  NULL,   SYSFS_SANYO },
 -{ mce-kbd,NULL,   SYSFS_MCE_KBD   },
 -{ mce_kbd,NULL,   SYSFS_MCE_KBD   },
 -{ rc-6,   /rc6_decoder, SYSFS_RC6   },
 -{ rc6,NULL,   SYSFS_RC6   },
 -{ rc-6-0, NULL,   SYSFS_INVALID   },
 -{ rc-6-6a-20, NULL,   SYSFS_INVALID   },
 -{ rc-6-6a-24, NULL,   SYSFS_INVALID   },
 -{ rc-6-6a-32, NULL,   SYSFS_INVALID   },
 -{ rc-6-mce,   NULL,   SYSFS_INVALID   },
 -{ sharp,  

Re: [PATCH] rc-core: use an IDA rather than a bitmap

2015-05-19 Thread David Härdeman
On Thu, May 14, 2015 at 05:29:29PM -0300, Mauro Carvalho Chehab wrote:
Em Thu, 02 Apr 2015 12:18:55 +0200
David Härdeman da...@hardeman.nu escreveu:

 This patch changes rc-core to use the kernel facilities that are already
 available for handling unique numbers instead of rolling its own bitmap
 stuff.
 
 Stefan, this should apply cleanly to the media git tree...could you test it?

Patch looks good to me but...

you forgot to add your SOB on it.

I didn't add it 'cause I wanted Stefan to test it first. Seems he's done
so...so I'll resubmit with my SOB and his Tested-by...


 ---
  drivers/media/rc/rc-ir-raw.c |2 +-
  drivers/media/rc/rc-main.c   |   40 
  include/media/rc-core.h  |4 ++--
  3 files changed, 23 insertions(+), 23 deletions(-)
 
 diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
 index b732ac6..ad26052 100644
 --- a/drivers/media/rc/rc-ir-raw.c
 +++ b/drivers/media/rc/rc-ir-raw.c
 @@ -271,7 +271,7 @@ int ir_raw_event_register(struct rc_dev *dev)
  
  spin_lock_init(dev-raw-lock);
  dev-raw-thread = kthread_run(ir_raw_event_thread, dev-raw,
 -   rc%ld, dev-devno);
 +   rc%u, dev-minor);
  
  if (IS_ERR(dev-raw-thread)) {
  rc = PTR_ERR(dev-raw-thread);
 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
 index f8c5e47..d068c4e 100644
 --- a/drivers/media/rc/rc-main.c
 +++ b/drivers/media/rc/rc-main.c
 @@ -18,17 +18,15 @@
  #include linux/input.h
  #include linux/leds.h
  #include linux/slab.h
 +#include linux/idr.h
  #include linux/device.h
  #include linux/module.h
  #include rc-core-priv.h
  
 -/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 
 */
 -#define IRRCV_NUM_DEVICES  256
 -static DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES);
 -
  /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
  #define IR_TAB_MIN_SIZE 256
  #define IR_TAB_MAX_SIZE 8192
 +#define RC_DEV_MAX  256
  
  /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
  #define IR_KEYPRESS_TIMEOUT 250
 @@ -38,6 +36,9 @@ static LIST_HEAD(rc_map_list);
  static DEFINE_SPINLOCK(rc_map_lock);
  static struct led_trigger *led_feedback;
  
 +/* Used to keep track of rc devices */
 +static DEFINE_IDA(rc_ida);
 +
  static struct rc_map_list *seek_rc_map(const char *name)
  {
  struct rc_map_list *map = NULL;
 @@ -1312,7 +1313,9 @@ int rc_register_device(struct rc_dev *dev)
  static bool raw_init = false; /* raw decoders loaded? */
  struct rc_map *rc_map;
  const char *path;
 -int rc, devno, attr = 0;
 +int attr = 0;
 +int minor;
 +int rc;
  
  if (!dev || !dev-map_name)
  return -EINVAL;
 @@ -1332,13 +1335,13 @@ int rc_register_device(struct rc_dev *dev)
  if (dev-close)
  dev-input_dev-close = ir_close;
  
 -do {
 -devno = find_first_zero_bit(ir_core_dev_number,
 -IRRCV_NUM_DEVICES);
 -/* No free device slots */
 -if (devno = IRRCV_NUM_DEVICES)
 -return -ENOMEM;
 -} while (test_and_set_bit(devno, ir_core_dev_number));
 +minor = ida_simple_get(rc_ida, 0, RC_DEV_MAX, GFP_KERNEL);
 +if (minor  0)
 +return minor;
 +
 +dev-minor = minor;
 +dev_set_name(dev-dev, rc%u, dev-minor);
 +dev_set_drvdata(dev-dev, dev);
  
  dev-dev.groups = dev-sysfs_groups;
  dev-sysfs_groups[attr++] = rc_dev_protocol_attr_grp;
 @@ -1358,9 +1361,6 @@ int rc_register_device(struct rc_dev *dev)
   */
  mutex_lock(dev-lock);
  
 -dev-devno = devno;
 -dev_set_name(dev-dev, rc%ld, dev-devno);
 -dev_set_drvdata(dev-dev, dev);
  rc = device_add(dev-dev);
  if (rc)
  goto out_unlock;
 @@ -1433,8 +1433,8 @@ int rc_register_device(struct rc_dev *dev)
  
  mutex_unlock(dev-lock);
  
 -IR_dprintk(1, Registered rc%ld (driver: %s, remote: %s, mode %s)\n,
 -   dev-devno,
 +IR_dprintk(1, Registered rc%u (driver: %s, remote: %s, mode %s)\n,
 +   dev-minor,
 dev-driver_name ? dev-driver_name : unknown,
 rc_map-name ? rc_map-name : unknown,
 dev-driver_type == RC_DRIVER_IR_RAW ? raw : cooked);
 @@ -1453,7 +1453,7 @@ out_dev:
  device_del(dev-dev);
  out_unlock:
  mutex_unlock(dev-lock);
 -clear_bit(dev-devno, ir_core_dev_number);
 +ida_simple_remove(rc_ida, minor);
  return rc;
  }
  EXPORT_SYMBOL_GPL(rc_register_device);
 @@ -1465,8 +1465,6 @@ void rc_unregister_device(struct rc_dev *dev)
  
  del_timer_sync(dev-timer_keyup);
  
 -clear_bit(dev-devno, ir_core_dev_number);
 -
  if (dev-driver_type == RC_DRIVER_IR_RAW)
  ir_raw_event_unregister(dev);
  
 @@ -1479,6 +1477,8 @@ void rc_unregister_device(struct rc_dev *dev)
  
  device_del(dev-dev);
  
 +

Re: [RFC PATCH 4/6] [media] rc: lirc is not a protocol or a keymap

2015-05-19 Thread David Härdeman
On Thu, May 14, 2015 at 01:51:23PM -0300, Mauro Carvalho Chehab wrote:
Em Thu, 19 Mar 2015 21:50:15 +
Sean Young s...@mess.org escreveu:

 Since the lirc bridge is not a decoder we can remove its protocol. The
 keymap existed only to select the protocol.

This changes the userspace interface, as now it is possible to enable/disable
LIRC handling from a given IR via /proc interface.

I still like the general idea though. If we expose the protocol in the
set/get keymap ioctls, then we need to expose the protocol enum to
userspace (in which point it will be set in stone)...removing lirc from
that list before we do that is a worthwhile cleanup IMHO (I have a
similar patch in my queue).

I think we should be able to at least not break userspace by still
accepting (and ignoring) commands to enable/disable lirc.

That lirc won't actually be disabled/enabled is (imho) a lesser
problem...is there any genuine use case for disabling lirc on a
per-device basis?


 
 Signed-off-by: Sean Young s...@mess.org
 ---
  drivers/media/rc/keymaps/Makefile  |  1 -
  drivers/media/rc/keymaps/rc-lirc.c | 42 
 --
  drivers/media/rc/rc-main.c |  1 -
  drivers/media/rc/st_rc.c   |  2 +-
  include/media/rc-map.h | 42 
 +-
  5 files changed, 20 insertions(+), 68 deletions(-)
  delete mode 100644 drivers/media/rc/keymaps/rc-lirc.c
 
 diff --git a/drivers/media/rc/keymaps/Makefile 
 b/drivers/media/rc/keymaps/Makefile
 index abf6079..661cd25 100644
 --- a/drivers/media/rc/keymaps/Makefile
 +++ b/drivers/media/rc/keymaps/Makefile
 @@ -51,7 +51,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
  rc-kworld-pc150u.o \
  rc-kworld-plus-tv-analog.o \
  rc-leadtek-y04g0051.o \
 -rc-lirc.o \
  rc-lme2510.o \
  rc-manli.o \
  rc-medion-x10.o \
 diff --git a/drivers/media/rc/keymaps/rc-lirc.c 
 b/drivers/media/rc/keymaps/rc-lirc.c
 deleted file mode 100644
 index fbf08fa..000
 --- a/drivers/media/rc/keymaps/rc-lirc.c
 +++ /dev/null
 @@ -1,42 +0,0 @@
 -/* rc-lirc.c - Empty dummy keytable, for use when its preferred to pass
 - * all raw IR data to the lirc userspace decoder.
 - *
 - * Copyright (c) 2010 by Jarod Wilson ja...@redhat.com
 - *
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License as published by
 - * the Free Software Foundation; either version 2 of the License, or
 - * (at your option) any later version.
 - */
 -
 -#include media/rc-core.h
 -#include linux/module.h
 -
 -static struct rc_map_table lirc[] = {
 -{ },
 -};
 -
 -static struct rc_map_list lirc_map = {
 -.map = {
 -.scan= lirc,
 -.size= ARRAY_SIZE(lirc),
 -.rc_type = RC_TYPE_LIRC,
 -.name= RC_MAP_LIRC,
 -}
 -};
 -
 -static int __init init_rc_map_lirc(void)
 -{
 -return rc_map_register(lirc_map);
 -}
 -
 -static void __exit exit_rc_map_lirc(void)
 -{
 -rc_map_unregister(lirc_map);
 -}
 -
 -module_init(init_rc_map_lirc)
 -module_exit(exit_rc_map_lirc)
 -
 -MODULE_LICENSE(GPL);
 -MODULE_AUTHOR(Jarod Wilson ja...@redhat.com);
 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
 index 128909c..e717dc9 100644
 --- a/drivers/media/rc/rc-main.c
 +++ b/drivers/media/rc/rc-main.c
 @@ -797,7 +797,6 @@ static struct {
  { RC_BIT_SANYO, sanyo },
  { RC_BIT_SHARP, sharp },
  { RC_BIT_MCE_KBD,   mce_kbd   },
 -{ RC_BIT_LIRC,  lirc  },
  { RC_BIT_XMP,   xmp   },
  };
  
 diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
 index 0e758ae..4834e78 100644
 --- a/drivers/media/rc/st_rc.c
 +++ b/drivers/media/rc/st_rc.c
 @@ -295,7 +295,7 @@ static int st_rc_probe(struct platform_device *pdev)
  rdev-open = st_rc_open;
  rdev-close = st_rc_close;
  rdev-driver_name = IR_ST_NAME;
 -rdev-map_name = RC_MAP_LIRC;
 +rdev-map_name = RC_MAP_EMPTY;
  rdev-input_name = ST Remote Control Receiver;
  
  /* enable wake via this device */
 diff --git a/include/media/rc-map.h b/include/media/rc-map.h
 index e7a1514..dfca14b 100644
 --- a/include/media/rc-map.h
 +++ b/include/media/rc-map.h
 @@ -14,30 +14,28 @@
  enum rc_type {
  RC_TYPE_UNKNOWN = 0,/* Protocol not known */
  RC_TYPE_OTHER   = 1,/* Protocol known but proprietary */
 -RC_TYPE_LIRC= 2,/* Pass raw IR to lirc userspace */
 -RC_TYPE_RC5 = 3,/* Philips RC5 protocol */
 -RC_TYPE_RC5X= 4,/* Philips RC5x protocol */
 -RC_TYPE_RC5_SZ  = 5,/* StreamZap variant of RC5 */
 -RC_TYPE_JVC = 6,/* JVC protocol */
 -RC_TYPE_SONY12  = 7,/* Sony 12 bit protocol */
 -

[PATCH 5/5] leds: max77693: Pass dev and dev-of_node to v4l2_flash_init()

2015-05-19 Thread Sakari Ailus
Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/leds-max77693.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-max77693.c b/drivers/leds/leds-max77693.c
index fecd0ed..bd12744 100644
--- a/drivers/leds/leds-max77693.c
+++ b/drivers/leds/leds-max77693.c
@@ -961,11 +961,9 @@ static int max77693_register_led(struct max77693_sub_led 
*sub_led,
 
max77693_init_v4l2_flash_config(sub_led, led_cfg, v4l2_sd_cfg);
 
-   fled_cdev-led_cdev.dev-of_node = sub_node;
-
/* Register in the V4L2 subsystem. */
-   sub_led-v4l2_flash = v4l2_flash_init(fled_cdev, v4l2_flash_ops,
-   v4l2_sd_cfg);
+   sub_led-v4l2_flash = v4l2_flash_init(dev, sub_node, fled_cdev,
+ v4l2_flash_ops, v4l2_sd_cfg);
if (IS_ERR(sub_led-v4l2_flash)) {
ret = PTR_ERR(sub_led-v4l2_flash);
goto err_v4l2_flash_init;
-- 
1.7.10.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 4/4] lmedm04: NEC scancode cleanup

2015-05-19 Thread David Härdeman
This changes the keymap back to the state before commit 616a4b83
and changes the driver to use full NEC32 scancodes following the
instructions provided by Malcolm Priestley tvbox...@gmail.com.

Signed-off-by: David Härdeman da...@hardeman.nu
---
 drivers/media/rc/keymaps/rc-lme2510.c  |  132 
 drivers/media/usb/dvb-usb-v2/lmedm04.c |   21 +++--
 2 files changed, 77 insertions(+), 76 deletions(-)

diff --git a/drivers/media/rc/keymaps/rc-lme2510.c 
b/drivers/media/rc/keymaps/rc-lme2510.c
index 51f18bb..2b0027c 100644
--- a/drivers/media/rc/keymaps/rc-lme2510.c
+++ b/drivers/media/rc/keymaps/rc-lme2510.c
@@ -15,74 +15,74 @@
 
 static struct rc_map_table lme2510_rc[] = {
/* Type 1 - 26 buttons */
-   { 0x10ed45, KEY_0 },
-   { 0x10ed5f, KEY_1 },
-   { 0x10ed50, KEY_2 },
-   { 0x10ed5d, KEY_3 },
-   { 0x10ed41, KEY_4 },
-   { 0x10ed0a, KEY_5 },
-   { 0x10ed42, KEY_6 },
-   { 0x10ed47, KEY_7 },
-   { 0x10ed49, KEY_8 },
-   { 0x10ed05, KEY_9 },
-   { 0x10ed43, KEY_POWER },
-   { 0x10ed46, KEY_SUBTITLE },
-   { 0x10ed06, KEY_PAUSE },
-   { 0x10ed03, KEY_MEDIA_REPEAT},
-   { 0x10ed02, KEY_PAUSE },
-   { 0x10ed5e, KEY_VOLUMEUP },
-   { 0x10ed5c, KEY_VOLUMEDOWN },
-   { 0x10ed09, KEY_CHANNELUP },
-   { 0x10ed1a, KEY_CHANNELDOWN },
-   { 0x10ed1e, KEY_PLAY },
-   { 0x10ed1b, KEY_ZOOM },
-   { 0x10ed59, KEY_MUTE },
-   { 0x10ed5a, KEY_TV },
-   { 0x10ed18, KEY_RECORD },
-   { 0x10ed07, KEY_EPG },
-   { 0x10ed01, KEY_STOP },
+   { 0xef12ba45, KEY_0 },
+   { 0xef12a05f, KEY_1 },
+   { 0xef12af50, KEY_2 },
+   { 0xef12a25d, KEY_3 },
+   { 0xef12be41, KEY_4 },
+   { 0xef12f50a, KEY_5 },
+   { 0xef12bd42, KEY_6 },
+   { 0xef12b847, KEY_7 },
+   { 0xef12b649, KEY_8 },
+   { 0xef12fa05, KEY_9 },
+   { 0xef12bc43, KEY_POWER },
+   { 0xef12b946, KEY_SUBTITLE },
+   { 0xef12f906, KEY_PAUSE },
+   { 0xef12fc03, KEY_MEDIA_REPEAT},
+   { 0xef12fd02, KEY_PAUSE },
+   { 0xef12a15e, KEY_VOLUMEUP },
+   { 0xef12a35c, KEY_VOLUMEDOWN },
+   { 0xef12f609, KEY_CHANNELUP },
+   { 0xef12e51a, KEY_CHANNELDOWN },
+   { 0xef12e11e, KEY_PLAY },
+   { 0xef12e41b, KEY_ZOOM },
+   { 0xef12a659, KEY_MUTE },
+   { 0xef12a55a, KEY_TV },
+   { 0xef12e718, KEY_RECORD },
+   { 0xef12f807, KEY_EPG },
+   { 0xef12fe01, KEY_STOP },
/* Type 2 - 20 buttons */
-   { 0xbf15, KEY_0 },
-   { 0xbf08, KEY_1 },
-   { 0xbf09, KEY_2 },
-   { 0xbf0a, KEY_3 },
-   { 0xbf0c, KEY_4 },
-   { 0xbf0d, KEY_5 },
-   { 0xbf0e, KEY_6 },
-   { 0xbf10, KEY_7 },
-   { 0xbf11, KEY_8 },
-   { 0xbf12, KEY_9 },
-   { 0xbf00, KEY_POWER },
-   { 0xbf04, KEY_MEDIA_REPEAT}, /* Recall */
-   { 0xbf1a, KEY_PAUSE }, /* Timeshift */
-   { 0xbf02, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
-   { 0xbf06, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/
-   { 0xbf01, KEY_CHANNELUP },
-   { 0xbf05, KEY_CHANNELDOWN },
-   { 0xbf14, KEY_ZOOM },
-   { 0xbf18, KEY_RECORD },
-   { 0xbf16, KEY_STOP },
+   { 0xff40ea15, KEY_0 },
+   { 0xff40f708, KEY_1 },
+   { 0xff40f609, KEY_2 },
+   { 0xff40f50a, KEY_3 },
+   { 0xff40f30c, KEY_4 },
+   { 0xff40f20d, KEY_5 },
+   { 0xff40f10e, KEY_6 },
+   { 0xff40ef10, KEY_7 },
+   { 0xff40ee11, KEY_8 },
+   { 0xff40ed12, KEY_9 },
+   { 0xff40ff00, KEY_POWER },
+   { 0xff40fb04, KEY_MEDIA_REPEAT}, /* Recall */
+   { 0xff40e51a, KEY_PAUSE }, /* Timeshift */
+   { 0xff40fd02, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
+   { 0xff40f906, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/
+   { 0xff40fe01, KEY_CHANNELUP },
+   { 0xff40fa05, KEY_CHANNELDOWN },
+   { 0xff40eb14, KEY_ZOOM },
+   { 0xff40e718, KEY_RECORD },
+   { 0xff40e916, KEY_STOP },
/* Type 3 - 20 buttons */
-   { 0x1c, KEY_0 },
-   { 0x07, KEY_1 },
-   { 0x15, KEY_2 },
-   { 0x09, KEY_3 },
-   { 0x16, KEY_4 },
-   { 0x19, KEY_5 },
-   { 0x0d, KEY_6 },
-   { 0x0c, KEY_7 },
-   { 0x18, KEY_8 },
-   { 0x5e, KEY_9 },
-   { 0x45, KEY_POWER },
-   { 0x44, KEY_MEDIA_REPEAT}, /* Recall */
-   { 0x4a, KEY_PAUSE }, /* Timeshift */
-   { 0x47, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
-   { 0x43, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/
-   { 0x46, KEY_CHANNELUP },
-   { 0x40, KEY_CHANNELDOWN },
-   { 0x08, KEY_ZOOM },
-   { 0x42, KEY_RECORD },
-   { 0x5a, KEY_STOP },
+   { 0xff00e31c, KEY_0 },
+   { 0xff00f807, KEY_1 },
+   { 0xff00ea15, KEY_2 },
+   { 0xff00f609, KEY_3 },
+   { 0xff00e916, KEY_4 },
+   { 0xff00e619, KEY_5 },
+   { 0xff00f20d, KEY_6 },
+   { 0xff00f30c, KEY_7 },
+   { 0xff00e718, KEY_8 },
+   { 0xff00a15e, KEY_9 },
+   { 0xff00ba45, 

[PATCH 3/5] v4l: flash: Pass struct device and device_node to v4l2_flash_init()

2015-05-19 Thread Sakari Ailus
The V4L2 sub-device node's dev will thus refer to the physical device, not
the LED flash device node. Also matching against device_node is possible in
cases where the LED flash controller drives multiple LEDs.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/media/v4l2-core/v4l2-flash.c |   10 ++
 include/media/v4l2-flash.h   |   10 +++---
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-flash.c 
b/drivers/media/v4l2-core/v4l2-flash.c
index bed2036..d182adc 100644
--- a/drivers/media/v4l2-core/v4l2-flash.c
+++ b/drivers/media/v4l2-core/v4l2-flash.c
@@ -542,9 +542,10 @@ static const struct v4l2_subdev_ops v4l2_flash_subdev_ops 
= {
.core = v4l2_flash_core_ops,
 };
 
-struct v4l2_flash *v4l2_flash_init(struct led_classdev_flash *fled_cdev,
-  const struct v4l2_flash_ops *ops,
-  struct v4l2_flash_config *config)
+struct v4l2_flash *v4l2_flash_init(
+   struct device *dev, struct device_node *of_node,
+   struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
+   struct v4l2_flash_config *config)
 {
struct v4l2_flash *v4l2_flash;
struct led_classdev *led_cdev = fled_cdev-led_cdev;
@@ -562,7 +563,8 @@ struct v4l2_flash *v4l2_flash_init(struct 
led_classdev_flash *fled_cdev,
sd = v4l2_flash-sd;
v4l2_flash-fled_cdev = fled_cdev;
v4l2_flash-ops = ops;
-   sd-dev = led_cdev-dev;
+   sd-dev = dev;
+   sd-of_node = of_node;
v4l2_subdev_init(sd, v4l2_flash_subdev_ops);
sd-internal_ops = v4l2_flash_subdev_internal_ops;
sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
diff --git a/include/media/v4l2-flash.h b/include/media/v4l2-flash.h
index 67a2cbf..31e421d 100644
--- a/include/media/v4l2-flash.h
+++ b/include/media/v4l2-flash.h
@@ -115,6 +115,8 @@ static inline struct v4l2_flash 
*v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)
 #if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
 /**
  * v4l2_flash_init - initialize V4L2 flash led sub-device
+ * @dev:   flash device, e.g. an I2C device
+ * @of_node:   of_node of the LED, may be NULL if the same as device's
  * @fled_cdev: the LED Flash class device to wrap
  * @flash_ops: V4L2 Flash device ops
  * @config:initialization data for V4L2 Flash sub-device
@@ -125,9 +127,10 @@ static inline struct v4l2_flash 
*v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c)
  * value is encoded using ERR_PTR(). Use IS_ERR() to check and
  * PTR_ERR() to obtain the numeric return value.
  */
-struct v4l2_flash *v4l2_flash_init(struct led_classdev_flash *fled_cdev,
-  const struct v4l2_flash_ops *ops,
-  struct v4l2_flash_config *config);
+struct v4l2_flash *v4l2_flash_init(
+   struct device *dev, struct device_node *of_node,
+   struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
+   struct v4l2_flash_config *config);
 
 /**
  * v4l2_flash_release - release V4L2 Flash sub-device
@@ -139,6 +142,7 @@ void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
 
 #else
 static inline struct v4l2_flash *v4l2_flash_init(
+   struct device *dev, struct device_node *of_node,
struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
struct v4l2_flash_config *config)
 {
-- 
1.7.10.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 0/5] V4L2 flash API wrapper improvements

2015-05-19 Thread Sakari Ailus
Hi Jacek, Mauro, others,

The first patch in this set adds the of_node pointer to struct v4l2_subdev
in order to match an async sub-device based on an explicit OF node instead
of the device's OF node, where the former is typically a child of the
latter.

Mauro: would you be ok with this patch going through the LED tree as well?
The rest of the patches in the set depend on this one. There are currently
no conflicts with media-tree master branch.

The rest of the patches (2--5) are intended to be merged with Jacek's
patches here:

URL:http://www.spinics.net/lists/linux-media/msg88999.html

Jacek: if you're ok with the patches, could you merge them with appropriate
patches in your set, please? The patches have not been tested since I don't
have the hardware.

-- 
Kind regards,
Sakari

--
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/5] v4l: flash: Make v4l2_flash_init() and v4l2_flash_release() functions always

2015-05-19 Thread Sakari Ailus
If CONFIG_V4L2_FLASH_LED_CLASS wasn't defined, v4l2_flash_init() and
v4l2_flash_release() were empty macros. This will lead to compiler warnings
in form of unused variables if the variables are not used for other
purposes.

Instead, implement v4l2_flash_init() and v4l2_flash_release() as static
inline functions.

Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 include/media/v4l2-flash.h |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/media/v4l2-flash.h b/include/media/v4l2-flash.h
index 945fa08..67a2cbf 100644
--- a/include/media/v4l2-flash.h
+++ b/include/media/v4l2-flash.h
@@ -138,8 +138,16 @@ struct v4l2_flash *v4l2_flash_init(struct 
led_classdev_flash *fled_cdev,
 void v4l2_flash_release(struct v4l2_flash *v4l2_flash);
 
 #else
-#define v4l2_flash_init(fled_cdev, ops, config) (NULL)
-#define v4l2_flash_release(v4l2_flash)
+static inline struct v4l2_flash *v4l2_flash_init(
+   struct led_classdev_flash *fled_cdev, const struct v4l2_flash_ops *ops,
+   struct v4l2_flash_config *config)
+{
+   return NULL;
+}
+
+static inline void v4l2_flash_release(struct v4l2_flash *v4l2_flash)
+{
+}
 #endif /* CONFIG_V4L2_FLASH_LED_CLASS */
 
 #endif /* _V4L2_FLASH_H */
-- 
1.7.10.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 4/5] leds: aat1290: Pass dev and dev-of_node to v4l2_flash_init()

2015-05-19 Thread Sakari Ailus
Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/leds/leds-aat1290.c |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-aat1290.c b/drivers/leds/leds-aat1290.c
index c656a2d..71bf6bb 100644
--- a/drivers/leds/leds-aat1290.c
+++ b/drivers/leds/leds-aat1290.c
@@ -524,9 +524,8 @@ static int aat1290_led_probe(struct platform_device *pdev)
led_cdev-dev-of_node = sub_node;
 
/* Create V4L2 Flash subdev. */
-   led-v4l2_flash = v4l2_flash_init(fled_cdev,
- v4l2_flash_ops,
- v4l2_sd_cfg);
+   led-v4l2_flash = v4l2_flash_init(dev, NULL, fled_cdev,
+ v4l2_flash_ops, v4l2_sd_cfg);
if (IS_ERR(led-v4l2_flash)) {
ret = PTR_ERR(led-v4l2_flash);
goto error_v4l2_flash_init;
-- 
1.7.10.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/5] v4l: async: Add a pointer to of_node to struct v4l2_subdev, match it

2015-05-19 Thread Sakari Ailus
V4L2 async sub-devices are currently matched (OF case) based on the struct
device_node pointer in struct device. LED devices may have more than one
LED, and in that case the OF node to match is not directly the device's
node, but a LED's node.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@iki.fi
---
 drivers/media/v4l2-core/v4l2-async.c  |   34 +
 drivers/media/v4l2-core/v4l2-device.c |3 +++
 include/media/v4l2-subdev.h   |2 ++
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index 85a6a34..bcdd140 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -22,10 +22,10 @@
 #include media/v4l2-device.h
 #include media/v4l2-subdev.h
 
-static bool match_i2c(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
 #if IS_ENABLED(CONFIG_I2C)
-   struct i2c_client *client = i2c_verify_client(dev);
+   struct i2c_client *client = i2c_verify_client(sd-dev);
return client 
asd-match.i2c.adapter_id == client-adapter-nr 
asd-match.i2c.address == client-addr;
@@ -34,14 +34,27 @@ static bool match_i2c(struct device *dev, struct 
v4l2_async_subdev *asd)
 #endif
 }
 
-static bool match_devname(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_devname(struct v4l2_subdev *sd,
+ struct v4l2_async_subdev *asd)
 {
-   return !strcmp(asd-match.device_name.name, dev_name(dev));
+   return !strcmp(asd-match.device_name.name, dev_name(sd-dev));
 }
 
-static bool match_of(struct device *dev, struct v4l2_async_subdev *asd)
+static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
-   return dev-of_node == asd-match.of.node;
+   struct device_node *of_node =
+   sd-of_node ? sd-of_node : sd-dev-of_node;
+
+   return of_node == asd-match.of.node;
+}
+
+static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
+{
+   if (!asd-match.custom.match)
+   /* Match always */
+   return true;
+
+   return asd-match.custom.match(sd-dev, asd);
 }
 
 static LIST_HEAD(subdev_list);
@@ -51,17 +64,14 @@ static DEFINE_MUTEX(list_lock);
 static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier 
*notifier,
struct v4l2_subdev *sd)
 {
+   bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *);
struct v4l2_async_subdev *asd;
-   bool (*match)(struct device *, struct v4l2_async_subdev *);
 
list_for_each_entry(asd, notifier-waiting, list) {
/* bus_type has been verified valid before */
switch (asd-match_type) {
case V4L2_ASYNC_MATCH_CUSTOM:
-   match = asd-match.custom.match;
-   if (!match)
-   /* Match always */
-   return asd;
+   match = match_custom;
break;
case V4L2_ASYNC_MATCH_DEVNAME:
match = match_devname;
@@ -79,7 +89,7 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct 
v4l2_async_notifier *
}
 
/* match cannot be NULL here */
-   if (match(sd-dev, asd))
+   if (match(sd, asd))
return asd;
}
 
diff --git a/drivers/media/v4l2-core/v4l2-device.c 
b/drivers/media/v4l2-core/v4l2-device.c
index 5b0a30b..a741c6c 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -157,6 +157,9 @@ int v4l2_device_register_subdev(struct v4l2_device 
*v4l2_dev,
/* Warn if we apparently re-register a subdev */
WARN_ON(sd-v4l2_dev != NULL);
 
+   if (!sd-of_node  sd-dev)
+   sd-of_node = sd-dev-of_node;
+
/*
 * The reason to acquire the module here is to avoid unloading
 * a module of sub-device which is registered to a media
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 8f5da73..5c51987 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -603,6 +603,8 @@ struct v4l2_subdev {
struct video_device *devnode;
/* pointer to the physical device, if any */
struct device *dev;
+   /* A device_node of the sub-device, iff not dev-of_node. */
+   struct device_node *of_node;
/* Links this subdev to a global subdev_list or @notifier-done list. */
struct list_head async_list;
/* Pointer to respective struct v4l2_async_subdev. */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message 

[PATCH 2/4] rc-core: use an IDA rather than a bitmap

2015-05-19 Thread David Härdeman
This patch changes rc-core to use the kernel facilities that are already
available for handling unique numbers instead of rolling its own bitmap
stuff.

Signed-off-by: David Härdeman da...@hardeman.nu
Tested-by: Stefan Lippers-Hollmann s@gmx.de
---
 drivers/media/rc/rc-ir-raw.c |2 +-
 drivers/media/rc/rc-main.c   |   40 
 include/media/rc-core.h  |4 ++--
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index b9e4645..1068f2b 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -406,7 +406,7 @@ int ir_raw_event_register(struct rc_dev *dev)
 
spin_lock_init(dev-raw-lock);
dev-raw-thread = kthread_run(ir_raw_event_thread, dev-raw,
-  rc%ld, dev-devno);
+  rc%u, dev-minor);
 
if (IS_ERR(dev-raw-thread)) {
rc = PTR_ERR(dev-raw-thread);
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 84d142b..20914ed 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -18,17 +18,15 @@
 #include linux/input.h
 #include linux/leds.h
 #include linux/slab.h
+#include linux/idr.h
 #include linux/device.h
 #include linux/module.h
 #include rc-core-priv.h
 
-/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */
-#define IRRCV_NUM_DEVICES  256
-static DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES);
-
 /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
 #define IR_TAB_MIN_SIZE256
 #define IR_TAB_MAX_SIZE8192
+#define RC_DEV_MAX 256
 
 /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */
 #define IR_KEYPRESS_TIMEOUT 250
@@ -38,6 +36,9 @@ static LIST_HEAD(rc_map_list);
 static DEFINE_SPINLOCK(rc_map_lock);
 static struct led_trigger *led_feedback;
 
+/* Used to keep track of rc devices */
+static DEFINE_IDA(rc_ida);
+
 static struct rc_map_list *seek_rc_map(const char *name)
 {
struct rc_map_list *map = NULL;
@@ -1311,7 +1312,9 @@ int rc_register_device(struct rc_dev *dev)
static bool raw_init = false; /* raw decoders loaded? */
struct rc_map *rc_map;
const char *path;
-   int rc, devno, attr = 0;
+   int attr = 0;
+   int minor;
+   int rc;
 
if (!dev || !dev-map_name)
return -EINVAL;
@@ -1331,13 +1334,13 @@ int rc_register_device(struct rc_dev *dev)
if (dev-close)
dev-input_dev-close = ir_close;
 
-   do {
-   devno = find_first_zero_bit(ir_core_dev_number,
-   IRRCV_NUM_DEVICES);
-   /* No free device slots */
-   if (devno = IRRCV_NUM_DEVICES)
-   return -ENOMEM;
-   } while (test_and_set_bit(devno, ir_core_dev_number));
+   minor = ida_simple_get(rc_ida, 0, RC_DEV_MAX, GFP_KERNEL);
+   if (minor  0)
+   return minor;
+
+   dev-minor = minor;
+   dev_set_name(dev-dev, rc%u, dev-minor);
+   dev_set_drvdata(dev-dev, dev);
 
dev-dev.groups = dev-sysfs_groups;
dev-sysfs_groups[attr++] = rc_dev_protocol_attr_grp;
@@ -1357,9 +1360,6 @@ int rc_register_device(struct rc_dev *dev)
 */
mutex_lock(dev-lock);
 
-   dev-devno = devno;
-   dev_set_name(dev-dev, rc%ld, dev-devno);
-   dev_set_drvdata(dev-dev, dev);
rc = device_add(dev-dev);
if (rc)
goto out_unlock;
@@ -1435,8 +1435,8 @@ int rc_register_device(struct rc_dev *dev)
 
mutex_unlock(dev-lock);
 
-   IR_dprintk(1, Registered rc%ld (driver: %s, remote: %s, mode %s)\n,
-  dev-devno,
+   IR_dprintk(1, Registered rc%u (driver: %s, remote: %s, mode %s)\n,
+  dev-minor,
   dev-driver_name ? dev-driver_name : unknown,
   rc_map-name ? rc_map-name : unknown,
   dev-driver_type == RC_DRIVER_IR_RAW ? raw : cooked);
@@ -1455,7 +1455,7 @@ out_dev:
device_del(dev-dev);
 out_unlock:
mutex_unlock(dev-lock);
-   clear_bit(dev-devno, ir_core_dev_number);
+   ida_simple_remove(rc_ida, minor);
return rc;
 }
 EXPORT_SYMBOL_GPL(rc_register_device);
@@ -1467,8 +1467,6 @@ void rc_unregister_device(struct rc_dev *dev)
 
del_timer_sync(dev-timer_keyup);
 
-   clear_bit(dev-devno, ir_core_dev_number);
-
if (dev-driver_type == RC_DRIVER_IR_RAW)
ir_raw_event_unregister(dev);
 
@@ -1481,6 +1479,8 @@ void rc_unregister_device(struct rc_dev *dev)
 
device_del(dev-dev);
 
+   ida_simple_remove(rc_ida, dev-minor);
+
rc_free_device(dev);
 }
 
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index f1cb9da..cbca9ca 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -69,7 +69,7 @@ enum rc_filter_type {
  * @rc_map: 

[PATCH 1/4] rc-core: fix remove uevent generation

2015-05-19 Thread David Härdeman
The input_dev is already gone when the rc device is being unregistered
so checking for its presence only means that no remove uevent will be
generated.

Cc: sta...@kernel.org
Signed-off-by: David Härdeman da...@hardeman.nu
---
 drivers/media/rc/rc-main.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 9d015db..84d142b 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1193,9 +1193,6 @@ static int rc_dev_uevent(struct device *device, struct 
kobj_uevent_env *env)
 {
struct rc_dev *dev = to_rc_dev(device);
 
-   if (!dev || !dev-input_dev)
-   return -ENODEV;
-
if (dev-rc_map.name)
ADD_HOTPLUG_VAR(NAME=%s, dev-rc_map.name);
if (dev-driver_name)

--
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] ov2659: add v4l2_subdev dependency

2015-05-19 Thread Benoit Parrot
Thanks, for the patch.

Acked-by: Benoit Parrot bpar...@ti.com

Arnd Bergmann a...@arndb.de wrote on Tue [2015-May-19 14:39:12 +0200]:
 The newly added ov2659 driver uses the v4l2 subdev API, but
 can be enabled even when that API is not part of the kernel,
 resulting in this build error:
 
 media/i2c/ov2659.c: In function 'ov2659_get_fmt':
 media/i2c/ov2659.c:1054:8: error: implicit declaration of function 
 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
 media/i2c/ov2659.c:1054:6: warning: assignment makes pointer from integer 
 without a cast [-Wint-conversion]
 media/i2c/ov2659.c: In function 'ov2659_set_fmt':
 media/i2c/ov2659.c:1129:6: warning: assignment makes pointer from integer 
 without a cast [-Wint-conversion]
 media/i2c/ov2659.c: In function 'ov2659_open':
 media/i2c/ov2659.c:1264:38: error: 'struct v4l2_subdev_fh' has no member 
 named 'pad'
 
 This adds an explicit dependency, like all the other drivers have.
 
 Signed-off-by: Arnd Bergmann a...@arndb.de
 Fixes: c4c0283ab3c ([media] media: i2c: add support for omnivision's ov2659 
 sensor)
 
 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 6f30ea76151a..db01ed84918f 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -469,7 +469,7 @@ config VIDEO_SMIAPP_PLL
  config VIDEO_OV2659
   tristate OmniVision OV2659 sensor support
   depends on VIDEO_V4L2  I2C
 - depends on MEDIA_CAMERA_SUPPORT
 + depends on MEDIA_CAMERA_SUPPORT  VIDEO_V4L2_SUBDEV_API
   ---help---
 This is a Video4Linux2 sensor-level driver for the OmniVision
 OV2659 camera.
 --
 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


Re: [PATCH 2/2] drivers: Simplify the return code

2015-05-19 Thread Antti Palosaari

On 05/19/2015 03:17 PM, Michael Büsch wrote:

On Tue, 19 May 2015 08:05:56 -0400 (EDT)
Federico Simoncelli fsimo...@redhat.com wrote:

diff --git a/drivers/media/dvb-frontends/lgs8gxx.c
b/drivers/media/dvb-frontends/lgs8gxx.c
index 3c92f36ea5c7..9b0166cdc7c2 100644
--- a/drivers/media/dvb-frontends/lgs8gxx.c
+++ b/drivers/media/dvb-frontends/lgs8gxx.c
@@ -544,11 +544,7 @@ static int lgs8gxx_set_mpeg_mode(struct lgs8gxx_state
*priv,
t |= clk_pol ? TS_CLK_INVERTED : TS_CLK_NORMAL;
t |= clk_gated ? TS_CLK_GATED : TS_CLK_FREERUN;

-   ret = lgs8gxx_write_reg(priv, reg_addr, t);
-   if (ret != 0)
-   return ret;
-
-   return 0;
+   return lgs8gxx_write_reg(priv, reg_addr, t);
  }


Personally I prefer the current style because it's more consistent with all
the other calls in the same function (return ret when ret != 0).

It also allows you to easily add/remove calls without having to deal with
the last special case return my_last_fun_call(...).

Anyway it's not a big deal, I think it's your call.



I agree. I also prefer the current style for these reasons. The compiler will 
also generate the same code in both cases.
I don't think it really simplifies the code.
But if you really insist on doing this change, go for it. You get my ack for 
fc0011



I am also against that kind of simplifications. Even it reduces line or 
two, it makes code more inconsistent, which means you have to make extra 
thinking when reading that code. I prefer similar repeating patterns as 
much as possible.


This is how I do it usually, even there is that extra last goto.

ret = write_reg();
if (ret)
goto err;

ret = write_reg();
if (ret)
goto err;
err:
return ret;
};

regards
Antti

--
http://palosaari.fi/
--
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 2/2] drivers: Simplify the return code

2015-05-19 Thread Dan Carpenter
On Tue, May 19, 2015 at 07:00:50PM +0300, Antti Palosaari wrote:
 I am also against that kind of simplifications. Even it reduces line
 or two, it makes code more inconsistent, which means you have to
 make extra thinking when reading that code. I prefer similar
 repeating patterns as much as possible.
 
 This is how I do it usually, even there is that extra last goto.
 
   ret = write_reg();
   if (ret)
   goto err;
 
   ret = write_reg();
   if (ret)
   goto err;
 err:
   return ret;
 };
 

I don't care too much about the original patch one way or the other.
The new code is more fashionable and fewer lines.

But these sorts of do-nothing returns are a blight.

They are misleading.  You expect goto err to do something.  You wander
what it is.  The name tells you nothing.  So you have to scroll down.
Oh crap, it's just a @#$@$@#$ waste of time do-nothing goto.  It's the
travel through a door problem, you have completely forgotten what you
are doing.

http://www.scientificamerican.com/article/why-walking-through-doorway-makes-you-forget/


And also they are a total waste of time if you care about preventing
bugs.

Some people complain about hidden return statements but that is only
an issue if you don't have syntax highlighting.  If you look through the
git logs it is full of places like 95f38411df055a0e ('netns: use a
spin_lock to protect nsid management') where the other coder had gotos
highlighted in the same color as regular code.  If you actually measure
how common return with lock held bugs are the goto err and the direct
return style code have equal amount of bugs.  (I have looked at this but
only briefly, so it would be interesting to see a thourough scientific
paper on it).

Also the goto err style code introduces a new class of forgot to set
the error code bugs which are not there in direct return code.

regards,
dan carpenter

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