cron job: media_tree daily build: WARNINGS

2017-09-06 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:   Thu Sep  7 05:00:19 CEST 2017
media-tree git hash:1efdf1776e2253b77413c997bed862410e4b6aaf
media_build git hash:   bbd9f669f0da6705fe44aff89281c0d6e7bfd73e
v4l-utils git hash: 3296adfa7fa169111bf37c041c0ca70ac8506054
gcc version:i686-linux-gcc (GCC) 7.1.0
sparse version: v0.5.0
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.12.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: 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: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
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.67-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.9-i686: WARNINGS
linux-4.1.33-i686: WARNINGS
linux-4.2.8-i686: WARNINGS
linux-4.3.6-i686: WARNINGS
linux-4.4.22-i686: WARNINGS
linux-4.5.7-i686: WARNINGS
linux-4.6.7-i686: WARNINGS
linux-4.7.5-i686: WARNINGS
linux-4.8-i686: OK
linux-4.9.26-i686: OK
linux-4.10.14-i686: OK
linux-4.11-i686: OK
linux-4.12.1-i686: OK
linux-4.13-i686: OK
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: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
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.67-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.9-x86_64: WARNINGS
linux-4.1.33-x86_64: WARNINGS
linux-4.2.8-x86_64: WARNINGS
linux-4.3.6-x86_64: WARNINGS
linux-4.4.22-x86_64: WARNINGS
linux-4.5.7-x86_64: WARNINGS
linux-4.6.7-x86_64: WARNINGS
linux-4.7.5-x86_64: WARNINGS
linux-4.8-x86_64: WARNINGS
linux-4.9.26-x86_64: WARNINGS
linux-4.10.14-x86_64: WARNINGS
linux-4.11-x86_64: WARNINGS
linux-4.12.1-x86_64: WARNINGS
linux-4.13-x86_64: OK
apps: WARNINGS
spec-git: OK

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


[PATCH v1] [media] uvcvideo: mark buffer error where overflow

2017-09-06 Thread Baoyou Xie
Some cameras post inaccurate frame where next frame data overlap
it. this results in screen flicker, and it need to be prevented.

So this patch marks the buffer error to discard the frame where
buffer overflow.

Signed-off-by: Baoyou Xie 
---
 drivers/media/usb/uvc/uvc_video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/uvc/uvc_video.c 
b/drivers/media/usb/uvc/uvc_video.c
index fb86d6a..81a3530 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1077,6 +1077,7 @@ static void uvc_video_decode_data(struct uvc_streaming 
*stream,
/* Complete the current frame if the buffer size was exceeded. */
if (len > maxlen) {
uvc_trace(UVC_TRACE_FRAME, "Frame complete (overflow).\n");
+   buf->error = 1;
buf->state = UVC_BUF_STATE_READY;
}
 }
-- 
2.7.4



BUGREPORT: IR keytable 1.12.3

2017-09-06 Thread Oliver Müller
BUG IR keytable 1.12.3
 
OS: Distributor ID:    Debian
Description:    Debian GNU/Linux 9.1 (stretch)
Release:    9.1
Codename:    stretch
 
Kernel: 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 
GNU/Linux
 
Programversion: IR keytable control version 1.12.3
 
IR-Device: I: Bus=0003 Vendor=0471 Product=20cc Version=0100
   N: Name="PHILIPS MCE USB IR Receiver- Spinel plus"
   P: Phys=usb-:06:00.0-2/input0
   S: 
Sysfs=/devices/pci:00/:00:15.2/:06:00.0/usb1/1-2/1-2:1.0/0003:0471:20CC.0006/input/input14
   U: Uniq=
   H: Handlers=sysrq kbd leds event3
   B: PROP=0
   B: EV=120013
   B: KEY=c 400 0 58000 8001f84000c004 e0beffdf01cf 
fffe
   B: MSC=10
   B: LED=1f
 
ir-keytable gives /sys/class/rc/: No such file or directory
 
using ir-keytable -d /dev/input/event3 I get this output with no mention of the 
protocol(s):
Name: PHILIPS MCE USB IR Receiver- Spi
bus: 3, vendor/product: 0471:20cc, version: 0x0100
 
if I use ir-keytable -s rc0 instead it comes back to /sys/class/rc/: No such 
file or directory which is also true
 
ir-keytable -d /dev/input/event3 -t works, ir-keytable -d /dev/input/event3 -r 
also works
 
after I introduce the new keymap, like so ir-keytable -d /dev/input/event3 -c 
-w /etc/rc_keymaps/rc6_mce_zotac_zbox-ad05br it doesn't work. I can't read the 
newly introduced keymap nor can I test it. Of course can't I be sure which 
protocol to use because it's not displayed in the initial output.
 
thx in advance


[PATCH v2] media: ov13858: Calculate pixel-rate at runtime, use mode

2017-09-06 Thread Chiranjeevi Rapolu
Calculate pixel-rate at run time instead of compile time.

Instead of using hardcoded pixels-per-line, extract it from current sensor
mode.

Signed-off-by: Chiranjeevi Rapolu 
---
Changes in v2:
- Removed pixel-rate from struct definition.
- Used pixel-rate formula wherever needed.
- Changed commit message to reflect above changes.
 drivers/media/i2c/ov13858.c | 42 ++
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index af7af0d..77f256e 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -104,7 +104,6 @@ struct ov13858_reg_list {
 
 /* Link frequency config */
 struct ov13858_link_freq_config {
-   u32 pixel_rate;
u32 pixels_per_line;
 
/* PLL registers for this link frequency */
@@ -958,8 +957,6 @@ struct ov13858_mode {
 static const struct ov13858_link_freq_config
link_freq_configs[OV13858_NUM_OF_LINK_FREQS] = {
{
-   /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
-   .pixel_rate = (OV13858_LINK_FREQ_540MHZ * 2 * 4) / 10,
.pixels_per_line = OV13858_PPL_540MHZ,
.reg_list = {
.num_of_regs = ARRAY_SIZE(mipi_data_rate_1080mbps),
@@ -967,8 +964,6 @@ struct ov13858_mode {
}
},
{
-   /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
-   .pixel_rate = (OV13858_LINK_FREQ_270MHZ * 2 * 4) / 10,
.pixels_per_line = OV13858_PPL_270MHZ,
.reg_list = {
.num_of_regs = ARRAY_SIZE(mipi_data_rate_540mbps),
@@ -1385,6 +1380,7 @@ static int ov13858_get_pad_format(struct v4l2_subdev *sd,
s32 vblank_def;
s32 vblank_min;
s64 h_blank;
+   s64 pixel_rate;
 
mutex_lock(>mutex);
 
@@ -1400,9 +1396,9 @@ static int ov13858_get_pad_format(struct v4l2_subdev *sd,
} else {
ov13858->cur_mode = mode;
__v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index);
-   __v4l2_ctrl_s_ctrl_int64(
-   ov13858->pixel_rate,
-   link_freq_configs[mode->link_freq_index].pixel_rate);
+   pixel_rate =
+   (link_freq_menu_items[mode->link_freq_index] * 2 * 4) / 10;
+   __v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate);
/* Update limits and set FPS to default */
vblank_def = ov13858->cur_mode->vts_def -
 ov13858->cur_mode->height;
@@ -1617,6 +1613,10 @@ static int ov13858_init_controls(struct ov13858 *ov13858)
s64 exposure_max;
s64 vblank_def;
s64 vblank_min;
+   s64 hblank;
+   s64 pixel_rate_min;
+   s64 pixel_rate_max;
+   const struct ov13858_mode *mode;
int ret;
 
ctrl_hdlr = >ctrl_handler;
@@ -1634,29 +1634,31 @@ static int ov13858_init_controls(struct ov13858 
*ov13858)
link_freq_menu_items);
ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
 
+   /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
+   pixel_rate_max = (link_freq_menu_items[0] * 2 * 4) / 10;
+   pixel_rate_min = (link_freq_menu_items[1] * 2 * 4) / 10;
/* By default, PIXEL_RATE is read only */
ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, _ctrl_ops,
-   V4L2_CID_PIXEL_RATE, 0,
-   link_freq_configs[0].pixel_rate, 1,
-   link_freq_configs[0].pixel_rate);
+   V4L2_CID_PIXEL_RATE,
+   pixel_rate_min, pixel_rate_max,
+   1, pixel_rate_max);
 
-   vblank_def = ov13858->cur_mode->vts_def - ov13858->cur_mode->height;
-   vblank_min = ov13858->cur_mode->vts_min - ov13858->cur_mode->height;
+   mode = ov13858->cur_mode;
+   vblank_def = mode->vts_def - mode->height;
+   vblank_min = mode->vts_min - mode->height;
ov13858->vblank = v4l2_ctrl_new_std(
ctrl_hdlr, _ctrl_ops, V4L2_CID_VBLANK,
-   vblank_min,
-   OV13858_VTS_MAX - ov13858->cur_mode->height, 1,
+   vblank_min, OV13858_VTS_MAX - mode->height, 1,
vblank_def);
 
+   hblank = link_freq_configs[mode->link_freq_index].pixels_per_line -
+mode->width;
ov13858->hblank = v4l2_ctrl_new_std(
ctrl_hdlr, _ctrl_ops, V4L2_CID_HBLANK,
-   OV13858_PPL_540MHZ - ov13858->cur_mode->width,
-   

[PATCH] media: vp7045: port TwinhanDTV Alpha to rc-core

2017-09-06 Thread Sean Young
Only the nec protocol is understood, but then it doesn't pass on
the full scancode and it ignores the nec repeats its own remote
sends, so holding buttons does not work.

Signed-off-by: Sean Young 
---
 drivers/media/rc/keymaps/rc-twinhan1027.c  |  2 +-
 drivers/media/usb/dvb-usb/dvb-usb-remote.c |  1 +
 drivers/media/usb/dvb-usb/dvb-usb.h|  1 +
 drivers/media/usb/dvb-usb/vp7045.c | 88 +-
 4 files changed, 18 insertions(+), 74 deletions(-)

diff --git a/drivers/media/rc/keymaps/rc-twinhan1027.c 
b/drivers/media/rc/keymaps/rc-twinhan1027.c
index 2275b37c61d2..78bb3143a1a8 100644
--- a/drivers/media/rc/keymaps/rc-twinhan1027.c
+++ b/drivers/media/rc/keymaps/rc-twinhan1027.c
@@ -66,7 +66,7 @@ static struct rc_map_list twinhan_vp1027_map = {
.map = {
.scan = twinhan_vp1027,
.size = ARRAY_SIZE(twinhan_vp1027),
-   .rc_proto = RC_PROTO_UNKNOWN,   /* Legacy IR type */
+   .rc_proto = RC_PROTO_NEC,
.name = RC_MAP_TWINHAN_VP1027_DVBS,
}
 };
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-remote.c 
b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
index b027d378102a..bf7dcd6b03e0 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
@@ -283,6 +283,7 @@ static int rc_core_dvb_usb_remote_init(struct 
dvb_usb_device *d)
dev->input_phys = d->rc_phys;
dev->dev.parent = >udev->dev;
dev->priv = d;
+   dev->scancode_mask = d->props.rc.core.scancode_mask;
 
err = rc_register_device(dev);
if (err < 0) {
diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h 
b/drivers/media/usb/dvb-usb/dvb-usb.h
index 72468fdffa18..1da9e47553f5 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb.h
+++ b/drivers/media/usb/dvb-usb/dvb-usb.h
@@ -207,6 +207,7 @@ struct dvb_rc {
int (*rc_query) (struct dvb_usb_device *d);
int rc_interval;
bool bulk_mode; /* uses bulk mode */
+   u32 scancode_mask;
 };
 
 /**
diff --git a/drivers/media/usb/dvb-usb/vp7045.c 
b/drivers/media/usb/dvb-usb/vp7045.c
index 13340af0d39c..2527b88beb87 100644
--- a/drivers/media/usb/dvb-usb/vp7045.c
+++ b/drivers/media/usb/dvb-usb/vp7045.c
@@ -97,82 +97,22 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int 
onoff)
return vp7045_usb_op(d,SET_TUNER_POWER,,1,NULL,0,150);
 }
 
-/* remote control stuff */
-
-/* The keymapping struct. Somehow this should be loaded to the driver, but
- * currently it is hardcoded. */
-static struct rc_map_table rc_map_vp7045_table[] = {
-   { 0x0016, KEY_POWER },
-   { 0x0010, KEY_MUTE },
-   { 0x0003, KEY_1 },
-   { 0x0001, KEY_2 },
-   { 0x0006, KEY_3 },
-   { 0x0009, KEY_4 },
-   { 0x001d, KEY_5 },
-   { 0x001f, KEY_6 },
-   { 0x000d, KEY_7 },
-   { 0x0019, KEY_8 },
-   { 0x001b, KEY_9 },
-   { 0x0015, KEY_0 },
-   { 0x0005, KEY_CHANNELUP },
-   { 0x0002, KEY_CHANNELDOWN },
-   { 0x001e, KEY_VOLUMEUP },
-   { 0x000a, KEY_VOLUMEDOWN },
-   { 0x0011, KEY_RECORD },
-   { 0x0017, KEY_FAVORITES }, /* Heart symbol - Channel list. */
-   { 0x0014, KEY_PLAY },
-   { 0x001a, KEY_STOP },
-   { 0x0040, KEY_REWIND },
-   { 0x0012, KEY_FASTFORWARD },
-   { 0x000e, KEY_PREVIOUS }, /* Recall - Previous channel. */
-   { 0x004c, KEY_PAUSE },
-   { 0x004d, KEY_SCREEN }, /* Full screen mode. */
-   { 0x0054, KEY_AUDIO }, /* MTS - Switch to secondary audio. */
-   { 0x000c, KEY_CANCEL }, /* Cancel */
-   { 0x001c, KEY_EPG }, /* EPG */
-   { 0x, KEY_TAB }, /* Tab */
-   { 0x0048, KEY_INFO }, /* Preview */
-   { 0x0004, KEY_LIST }, /* RecordList */
-   { 0x000f, KEY_TEXT }, /* Teletext */
-   { 0x0041, KEY_PREVIOUSSONG },
-   { 0x0042, KEY_NEXTSONG },
-   { 0x004b, KEY_UP },
-   { 0x0051, KEY_DOWN },
-   { 0x004e, KEY_LEFT },
-   { 0x0052, KEY_RIGHT },
-   { 0x004f, KEY_ENTER },
-   { 0x0013, KEY_CANCEL },
-   { 0x004a, KEY_CLEAR },
-   { 0x0054, KEY_PRINT }, /* Capture */
-   { 0x0043, KEY_SUBTITLE }, /* Subtitle/CC */
-   { 0x0008, KEY_VIDEO }, /* A/V */
-   { 0x0007, KEY_SLEEP }, /* Hibernate */
-   { 0x0045, KEY_ZOOM }, /* Zoom+ */
-   { 0x0018, KEY_RED},
-   { 0x0053, KEY_GREEN},
-   { 0x005e, KEY_YELLOW},
-   { 0x005f, KEY_BLUE}
-};
-
-static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+static int vp7045_rc_query(struct dvb_usb_device *d)
 {
u8 key;
-   int i;
vp7045_usb_op(d,RC_VAL_READ,NULL,0,,1,20);
 
deb_rc("remote query key: %x %d\n",key,key);
 
-   if (key == 0x44) {
-   *state = REMOTE_NO_KEY_PRESSED;
-   return 0;
+   if (key != 0x44) {
+   /*
+* The 8 bit address isn't available, but since the remote uses
+* address 0 

[PATCH] [media] ov9640: make const arrays res_x/y static const, reduces object code size

2017-09-06 Thread Colin King
From: Colin Ian King 

Don't populate the arrays res_x and resy_y on the stack, instead make them
static const.  Makes the object code smaller by over 160 bytes:

Before:
   textdata bss dec hex filename
  105092800  64   13373343d ov9640.o

After:
   textdata bss dec hex filename
  101842960  64   132083398 ov9640.o

Signed-off-by: Colin Ian King 
---
 drivers/media/i2c/soc_camera/ov9640.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/ov9640.c 
b/drivers/media/i2c/soc_camera/ov9640.c
index 0146d1f7aacb..dafea6d90ad9 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -335,8 +335,8 @@ static void ov9640_res_roundup(u32 *width, u32 *height)
 {
int i;
enum { QQCIF, QQVGA, QCIF, QVGA, CIF, VGA, SXGA };
-   int res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
-   int res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
+   static const int res_x[] = { 88, 160, 176, 320, 352, 640, 1280 };
+   static const int res_y[] = { 72, 120, 144, 240, 288, 480, 960 };
 
for (i = 0; i < ARRAY_SIZE(res_x); i++) {
if (res_x[i] >= *width && res_y[i] >= *height) {
-- 
2.14.1



Re: [PATCH v8 15/21] dt: bindings: Add a binding for flash devices associated to a sensor

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Camera flash drivers (and LEDs) are separate from the sensor devices in
> DT. In order to make an association between the two, provide the
> association information to the software.
> 
> Signed-off-by: Sakari Ailus 
> Acked-by: Rob Herring 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  Documentation/devicetree/bindings/media/video-interfaces.txt | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
> b/Documentation/devicetree/bindings/media/video-interfaces.txt
> index 852041a7480c..efc67161e389 100644
> --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> @@ -67,6 +67,14 @@ are required in a relevant parent node:
>   identifier, should be 1.
>   - #size-cells: should be zero.
>  
> +
> +Optional properties
> +---
> +
> +- flash: An array of phandles, each referring to a flash LED, a sub-node
> +  of the LED driver device node.
> +
> +
>  Optional endpoint properties
>  
>  
> 



Re: [PATCH v8 16/21] dt: bindings: Add lens-focus binding for image sensors

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> The lens-focus property contains a phandle to the lens voice coil driver
> that is associated to the sensor; typically both are contained in the same
> camera module.
> 
> Signed-off-by: Sakari Ailus 
> Acked-by: Pavel Machek 
> Reviewed-by: Sebastian Reichel 
> Acked-by: Rob Herring 


Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  Documentation/devicetree/bindings/media/video-interfaces.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt 
> b/Documentation/devicetree/bindings/media/video-interfaces.txt
> index efc67161e389..39b19d9d8426 100644
> --- a/Documentation/devicetree/bindings/media/video-interfaces.txt
> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> @@ -74,6 +74,8 @@ Optional properties
>  - flash: An array of phandles, each referring to a flash LED, a sub-node
>of the LED driver device node.
>  
> +- lens-focus: A phandle to the node of the focus lens controller.
> +
>  
>  Optional endpoint properties
>  
> 



Re: [PATCH v8 14/21] v4l: async: Allow binding notifiers to sub-devices

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Registering a notifier has required the knowledge of struct v4l2_device
> for the reason that sub-devices generally are registered to the
> v4l2_device (as well as the media device, also available through
> v4l2_device).
> 
> This information is not available for sub-device drivers at probe time.
> 
> What this patch does is that it allows registering notifiers without
> having v4l2_device around. Instead the sub-device pointer is stored to the

to -> in

> notifier. Once the sub-device of the driver that registered the notifier
> is registered, the notifier will gain the knowledge of the v4l2_device,
> and the binding of async sub-devices from the sub-device driver's notifier
> may proceed.
> 
> The master notifier's complete callback is only called when all sub-device
> notifiers are completed.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/v4l2-core/v4l2-async.c | 209 
> ++-
>  include/media/v4l2-async.h   |  16 ++-
>  2 files changed, 194 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index 79f216723a3f..620b2cd29fc3 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -53,6 +53,10 @@ static int v4l2_async_notifier_call_complete(struct 
> v4l2_async_notifier *n)
>   return n->ops->complete(n);
>  }
>  
> +static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
> +struct v4l2_subdev *sd,
> +struct v4l2_async_subdev *asd);
> +
>  static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
>  {
>  #if IS_ENABLED(CONFIG_I2C)
> @@ -129,14 +133,119 @@ static struct v4l2_async_subdev *v4l2_async_find_match(
>   return NULL;
>  }
>  
> +/* Get the sub-device notifier registered by a sub-device driver. */
> +static struct v4l2_async_notifier *v4l2_async_get_subdev_notifier(
> + struct v4l2_subdev *sd)
> +{
> + struct v4l2_async_notifier *n;
> +
> + list_for_each_entry(n, _list, list)
> + if (n->sd == sd)
> + return n;
> +
> + return NULL;
> +}
> +
> +/* Return true if all sub-device notifiers are complete, false otherwise. */
> +static bool v4l2_async_subdev_notifiers_complete(
> + struct v4l2_async_notifier *notifier)
> +{
> + struct v4l2_subdev *sd;
> +
> + if (!list_empty(>waiting))
> + return false;
> +
> + list_for_each_entry(sd, >done, async_list) {
> + struct v4l2_async_notifier *subdev_notifier =
> + v4l2_async_get_subdev_notifier(sd);
> +
> + if (!subdev_notifier)
> + continue;
> +
> + if (!v4l2_async_subdev_notifiers_complete(subdev_notifier))
> + return false;
> + }
> +
> + return true;
> +}
> +
> +/* Get v4l2_device related to the notifier if one can be found. */
> +static struct v4l2_device *v4l2_async_notifier_get_v4l2_dev(
> + struct v4l2_async_notifier *notifier)
> +{
> + while (notifier->master)
> + notifier = notifier->master;
> +
> + return notifier->v4l2_dev;
> +}
> +
> +/* Test all async sub-devices in a notifier for a match. */
> +static int v4l2_async_notifier_try_all_subdevs(
> + struct v4l2_async_notifier *notifier)
> +{
> + struct v4l2_subdev *sd, *tmp;
> +
> + if (!v4l2_async_notifier_get_v4l2_dev(notifier))
> + return 0;
> +
> + list_for_each_entry_safe(sd, tmp, _list, async_list) {
> + struct v4l2_async_subdev *asd;
> + int ret;
> +
> + asd = v4l2_async_find_match(notifier, sd);
> + if (!asd)
> + continue;
> +
> + ret = v4l2_async_match_notify(notifier, sd, asd);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +/* Try completing a notifier. */
> +static int v4l2_async_notifier_try_complete(
> + struct v4l2_async_notifier *notifier)
> +{
> + do {
> + int ret;
> +
> + /* Any local async sub-devices left? */
> + if (!list_empty(>waiting))
> + return 0;
> +
> + /*
> +  * Any sub-device notifiers waiting for async subdevs
> +  * to be bound?
> +  */
> + if (!v4l2_async_subdev_notifiers_complete(notifier))
> + return 0;
> +
> + /* Proceed completing the notifier */
> + ret = v4l2_async_notifier_call_complete(notifier);
> + if (ret < 0)
> + return ret;
> +
> + /*
> +  * Obtain notifier's master. If there is one, repeat
> +  * the process, otherwise we're done here.
> +  */
> + } while ((notifier = notifier->master));


[PATCH 10/10] media: rc: gpio-ir-recv: use gpiolib API

2017-09-06 Thread Ladislav Michl
Use of gpiolib API simplifies driver a bit.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/Kconfig|  1 +
 drivers/media/rc/gpio-ir-recv.c | 64 +
 2 files changed, 27 insertions(+), 38 deletions(-)

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 5e83b76495f7..852bf639f1ca 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -382,6 +382,7 @@ config RC_LOOPBACK
 config IR_GPIO_CIR
tristate "GPIO IR remote control"
depends on RC_CORE
+   depends on (OF && GPIOLIB) || COMPILE_TEST
---help---
   Say Y if you want to use GPIO based IR Receiver.
 
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 77498d0c8970..c87f085226f2 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -26,39 +26,34 @@
 
 struct gpio_rc_dev {
struct rc_dev *rcdev;
-   int gpio_nr;
-   bool active_low;
+   struct gpio_desc *gpiod;
+   int irq;
struct timer_list flush_timer;
 };
 
 static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id)
 {
+   int val;
struct gpio_rc_dev *gpio_dev = dev_id;
-   int gval;
-   int rc = 0;
enum raw_event_type type = IR_SPACE;
 
-   gval = gpio_get_value(gpio_dev->gpio_nr);
+   val = gpiod_get_value(gpio_dev->gpiod);
+   if (val < 0)
+   goto err;
 
-   if (gval < 0)
-   goto err_get_value;
-
-   if (gpio_dev->active_low)
-   gval = !gval;
-
-   if (gval == 1)
+   if (val)
type = IR_PULSE;
 
-   rc = ir_raw_event_store_edge(gpio_dev->rcdev, type);
-   if (rc < 0)
-   goto err_get_value;
+   val = ir_raw_event_store_edge(gpio_dev->rcdev, type);
+   if (val < 0)
+   goto err;
 
mod_timer(_dev->flush_timer,
  jiffies + nsecs_to_jiffies(gpio_dev->rcdev->timeout));
 
ir_raw_event_handle(gpio_dev->rcdev);
 
-err_get_value:
+err:
return IRQ_HANDLED;
 }
 
@@ -76,7 +71,6 @@ static void flush_timer(unsigned long arg)
 static int gpio_ir_recv_probe(struct platform_device *pdev)
 {
int rc;
-   enum of_gpio_flags flags;
struct rc_dev *rcdev;
struct gpio_rc_dev *gpio_dev;
struct device *dev = >dev;
@@ -89,15 +83,17 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
if (!gpio_dev)
return -ENOMEM;
 
-   rc = of_get_gpio_flags(np, 0, );
-   if (rc < 0) {
+   gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN);
+   if (IS_ERR(gpio_dev->gpiod)) {
+   rc = PTR_ERR(gpio_dev->gpiod);
+   /* Just try again if this happens */
if (rc != -EPROBE_DEFER)
-   dev_err(dev, "Failed to get gpio flags (%d)\n", rc);
+   dev_err(dev, "error getting gpio (%d)\n", rc);
return rc;
}
-
-   gpio_dev->gpio_nr = rc;
-   gpio_dev->active_low = (flags & OF_GPIO_ACTIVE_LOW);
+   gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod);
+   if (gpio_dev->irq < 0)
+   return gpio_dev->irq;
 
rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
if (!rcdev)
@@ -125,11 +121,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
setup_timer(_dev->flush_timer, flush_timer,
(unsigned long)gpio_dev);
 
-   rc = devm_gpio_request_one(dev, gpio_dev->gpio_nr, GPIOF_DIR_IN,
-   "gpio-ir-recv");
-   if (rc < 0)
-   return rc;
-
rc = devm_rc_register_device(dev, rcdev);
if (rc < 0) {
dev_err(dev, "failed to register rc device\n");
@@ -138,8 +129,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, gpio_dev);
 
-   return devm_request_irq(dev, gpio_to_irq(gpio_dev->gpio_nr),
-   gpio_ir_recv_irq,
+   return devm_request_irq(dev, gpio_dev->irq, gpio_ir_recv_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"gpio-ir-recv-irq", gpio_dev);
 }
@@ -155,26 +145,24 @@ static int gpio_ir_recv_remove(struct platform_device 
*pdev)
 #ifdef CONFIG_PM
 static int gpio_ir_recv_suspend(struct device *dev)
 {
-   struct platform_device *pdev = to_platform_device(dev);
-   struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev);
+   struct gpio_rc_dev *gpio_dev = dev_get_drvdata(dev);
 
if (device_may_wakeup(dev))
-   enable_irq_wake(gpio_to_irq(gpio_dev->gpio_nr));
+   enable_irq_wake(gpio_dev->irq);
else
-   disable_irq(gpio_to_irq(gpio_dev->gpio_nr));
+   disable_irq(gpio_dev->irq);
 
return 0;
 }
 
 static int gpio_ir_recv_resume(struct device *dev)
 {
-   struct 

[PATCH 09/10] media: rc: gpio-ir-recv: remove gpio_ir_recv_platform_data

2017-09-06 Thread Ladislav Michl
gpio_ir_recv_platform_data are not used anywhere in kernel tree,
so remove it.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c  | 98 +++-
 include/linux/platform_data/media/gpio-ir-recv.h | 23 --
 2 files changed, 29 insertions(+), 92 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 92a060f776d5..77498d0c8970 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #define GPIO_IR_DEVICE_NAME"gpio_ir_recv"
 
@@ -32,45 +31,6 @@ struct gpio_rc_dev {
struct timer_list flush_timer;
 };
 
-#ifdef CONFIG_OF
-/*
- * Translate OpenFirmware node properties into platform_data
- */
-static int gpio_ir_recv_get_devtree_pdata(struct device *dev,
- struct gpio_ir_recv_platform_data *pdata)
-{
-   struct device_node *np = dev->of_node;
-   enum of_gpio_flags flags;
-   int gpio;
-
-   gpio = of_get_gpio_flags(np, 0, );
-   if (gpio < 0) {
-   if (gpio != -EPROBE_DEFER)
-   dev_err(dev, "Failed to get gpio flags (%d)\n", gpio);
-   return gpio;
-   }
-
-   pdata->gpio_nr = gpio;
-   pdata->active_low = (flags & OF_GPIO_ACTIVE_LOW);
-   /* probe() takes care of map_name == NULL or allowed_protos == 0 */
-   pdata->map_name = of_get_property(np, "linux,rc-map-name", NULL);
-   pdata->allowed_protos = 0;
-
-   return 0;
-}
-
-static const struct of_device_id gpio_ir_recv_of_match[] = {
-   { .compatible = "gpio-ir-receiver", },
-   { },
-};
-MODULE_DEVICE_TABLE(of, gpio_ir_recv_of_match);
-
-#else /* !CONFIG_OF */
-
-#define gpio_ir_recv_get_devtree_pdata(dev, pdata) (-ENOSYS)
-
-#endif
-
 static irqreturn_t gpio_ir_recv_irq(int irq, void *dev_id)
 {
struct gpio_rc_dev *gpio_dev = dev_id;
@@ -115,33 +75,30 @@ static void flush_timer(unsigned long arg)
 
 static int gpio_ir_recv_probe(struct platform_device *pdev)
 {
-   struct device *dev = >dev;
-   struct gpio_rc_dev *gpio_dev;
-   struct rc_dev *rcdev;
-   const struct gpio_ir_recv_platform_data *pdata = dev->platform_data;
int rc;
+   enum of_gpio_flags flags;
+   struct rc_dev *rcdev;
+   struct gpio_rc_dev *gpio_dev;
+   struct device *dev = >dev;
+   struct device_node *np = dev->of_node;
 
-   if (pdev->dev.of_node) {
-   struct gpio_ir_recv_platform_data *dtpdata =
-   devm_kzalloc(dev, sizeof(*dtpdata), GFP_KERNEL);
-   if (!dtpdata)
-   return -ENOMEM;
-   rc = gpio_ir_recv_get_devtree_pdata(dev, dtpdata);
-   if (rc)
-   return rc;
-   pdata = dtpdata;
-   }
-
-   if (!pdata)
-   return -EINVAL;
-
-   if (pdata->gpio_nr < 0)
-   return -EINVAL;
+   if (!np)
+   return -ENODEV;
 
gpio_dev = devm_kzalloc(dev, sizeof(struct gpio_rc_dev), GFP_KERNEL);
if (!gpio_dev)
return -ENOMEM;
 
+   rc = of_get_gpio_flags(np, 0, );
+   if (rc < 0) {
+   if (rc != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get gpio flags (%d)\n", rc);
+   return rc;
+   }
+
+   gpio_dev->gpio_nr = rc;
+   gpio_dev->active_low = (flags & OF_GPIO_ACTIVE_LOW);
+
rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
if (!rcdev)
return -ENOMEM;
@@ -158,20 +115,17 @@ static int gpio_ir_recv_probe(struct platform_device 
*pdev)
rcdev->min_timeout = 1;
rcdev->timeout = IR_DEFAULT_TIMEOUT;
rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
-   if (pdata->allowed_protos)
-   rcdev->allowed_protocols = pdata->allowed_protos;
-   else
-   rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
-   rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
+   rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
+   rcdev->map_name = of_get_property(np, "linux,rc-map-name", NULL);
+   if (!rcdev->map_name)
+   rcdev->map_name = RC_MAP_EMPTY;
 
gpio_dev->rcdev = rcdev;
-   gpio_dev->gpio_nr = pdata->gpio_nr;
-   gpio_dev->active_low = pdata->active_low;
 
setup_timer(_dev->flush_timer, flush_timer,
(unsigned long)gpio_dev);
 
-   rc = devm_gpio_request_one(dev, pdata->gpio_nr, GPIOF_DIR_IN,
+   rc = devm_gpio_request_one(dev, gpio_dev->gpio_nr, GPIOF_DIR_IN,
"gpio-ir-recv");
if (rc < 0)
return rc;
@@ -184,7 +138,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, gpio_dev);
 
-   return devm_request_irq(dev, gpio_to_irq(pdata->gpio_nr),
+   return 

[PATCH 08/10] media: rc: gpio-ir-recv: use KBUILD_MODNAME

2017-09-06 Thread Ladislav Michl
There already is standard macro providing driver name, use it.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 68278109f460..92a060f776d5 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 
-#define GPIO_IR_DRIVER_NAME"gpio-rc-recv"
 #define GPIO_IR_DEVICE_NAME"gpio_ir_recv"
 
 struct gpio_rc_dev {
@@ -155,7 +154,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
rcdev->input_id.product = 0x0001;
rcdev->input_id.version = 0x0100;
rcdev->dev.parent = dev;
-   rcdev->driver_name = GPIO_IR_DRIVER_NAME;
+   rcdev->driver_name = KBUILD_MODNAME;
rcdev->min_timeout = 1;
rcdev->timeout = IR_DEFAULT_TIMEOUT;
rcdev->max_timeout = 10 * IR_DEFAULT_TIMEOUT;
@@ -236,7 +235,7 @@ static struct platform_driver gpio_ir_recv_driver = {
.probe  = gpio_ir_recv_probe,
.remove = gpio_ir_recv_remove,
.driver = {
-   .name   = GPIO_IR_DRIVER_NAME,
+   .name   = KBUILD_MODNAME,
.of_match_table = of_match_ptr(gpio_ir_recv_of_match),
 #ifdef CONFIG_PM
.pm = _ir_recv_pm_ops,
-- 
2.11.0



[PATCH 06/10] media: rc: gpio-ir-recv: do not allow threaded interrupt handler

2017-09-06 Thread Ladislav Michl
Requesting any context irq is not actually great idea since threaded
interrupt handler is run at too unpredictable time which turns
timing information wrong. Fix it by requesting regular interrupt.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index c78a7eaa5a1d..1d84085f1021 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -185,7 +185,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, gpio_dev);
 
-   rc = request_any_context_irq(gpio_to_irq(pdata->gpio_nr),
+   rc = request_irq(gpio_to_irq(pdata->gpio_nr),
gpio_ir_recv_irq,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
"gpio-ir-recv-irq", gpio_dev);
-- 
2.11.0



[PATCH 07/10] media: rc: gpio-ir-recv: use devm_request_irq

2017-09-06 Thread Ladislav Michl
Use of devm_request_irq simplifies error unwinding.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 1d84085f1021..68278109f460 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -185,24 +185,16 @@ static int gpio_ir_recv_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, gpio_dev);
 
-   rc = request_irq(gpio_to_irq(pdata->gpio_nr),
+   return devm_request_irq(dev, gpio_to_irq(pdata->gpio_nr),
gpio_ir_recv_irq,
-   IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-   "gpio-ir-recv-irq", gpio_dev);
-   if (rc < 0)
-   goto err_request_irq;
-
-   return 0;
-
-err_request_irq:
-   return rc;
+   IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+   "gpio-ir-recv-irq", gpio_dev);
 }
 
 static int gpio_ir_recv_remove(struct platform_device *pdev)
 {
struct gpio_rc_dev *gpio_dev = platform_get_drvdata(pdev);
 
-   free_irq(gpio_to_irq(gpio_dev->gpio_nr), gpio_dev);
del_timer_sync(_dev->flush_timer);
return 0;
 }
-- 
2.11.0



[PATCH 05/10] media: rc: gpio-ir-recv: use devm_rc_register_device

2017-09-06 Thread Ladislav Michl
Use of devm_rc_register_device simplifies error unwinding.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 4b71f7ae9132..c78a7eaa5a1d 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -177,10 +177,10 @@ static int gpio_ir_recv_probe(struct platform_device 
*pdev)
if (rc < 0)
return rc;
 
-   rc = rc_register_device(rcdev);
+   rc = devm_rc_register_device(dev, rcdev);
if (rc < 0) {
dev_err(dev, "failed to register rc device\n");
-   goto err_register_rc_device;
+   return rc;
}
 
platform_set_drvdata(pdev, gpio_dev);
@@ -195,9 +195,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
return 0;
 
 err_request_irq:
-   rc_unregister_device(rcdev);
-   rcdev = NULL;
-err_register_rc_device:
return rc;
 }
 
@@ -207,7 +204,6 @@ static int gpio_ir_recv_remove(struct platform_device *pdev)
 
free_irq(gpio_to_irq(gpio_dev->gpio_nr), gpio_dev);
del_timer_sync(_dev->flush_timer);
-   rc_unregister_device(gpio_dev->rcdev);
return 0;
 }
 
-- 
2.11.0



[PATCH 04/10] media: rc: gpio-ir-recv: use devm_gpio_request_one

2017-09-06 Thread Ladislav Michl
Use of devm_gpio_request_one simplifies error unwinding.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 0e0b6988c08e..4b71f7ae9132 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -172,12 +172,10 @@ static int gpio_ir_recv_probe(struct platform_device 
*pdev)
setup_timer(_dev->flush_timer, flush_timer,
(unsigned long)gpio_dev);
 
-   rc = gpio_request(pdata->gpio_nr, "gpio-ir-recv");
+   rc = devm_gpio_request_one(dev, pdata->gpio_nr, GPIOF_DIR_IN,
+   "gpio-ir-recv");
if (rc < 0)
return rc;
-   rc  = gpio_direction_input(pdata->gpio_nr);
-   if (rc < 0)
-   goto err_gpio_direction_input;
 
rc = rc_register_device(rcdev);
if (rc < 0) {
@@ -200,8 +198,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
rc_unregister_device(rcdev);
rcdev = NULL;
 err_register_rc_device:
-err_gpio_direction_input:
-   gpio_free(pdata->gpio_nr);
return rc;
 }
 
@@ -212,7 +208,6 @@ static int gpio_ir_recv_remove(struct platform_device *pdev)
free_irq(gpio_to_irq(gpio_dev->gpio_nr), gpio_dev);
del_timer_sync(_dev->flush_timer);
rc_unregister_device(gpio_dev->rcdev);
-   gpio_free(gpio_dev->gpio_nr);
return 0;
 }
 
-- 
2.11.0



[PATCH 03/10] media: rc: gpio-ir-recv: use devm_rc_allocate_device

2017-09-06 Thread Ladislav Michl
Use of devm_rc_allocate_device simplifies error unwinding.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index fd5742b23447..0e0b6988c08e 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -143,7 +143,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
if (!gpio_dev)
return -ENOMEM;
 
-   rcdev = rc_allocate_device(RC_DRIVER_IR_RAW);
+   rcdev = devm_rc_allocate_device(dev, RC_DRIVER_IR_RAW);
if (!rcdev)
return -ENOMEM;
 
@@ -174,7 +174,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 
rc = gpio_request(pdata->gpio_nr, "gpio-ir-recv");
if (rc < 0)
-   goto err_gpio_request;
+   return rc;
rc  = gpio_direction_input(pdata->gpio_nr);
if (rc < 0)
goto err_gpio_direction_input;
@@ -202,8 +202,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 err_register_rc_device:
 err_gpio_direction_input:
gpio_free(pdata->gpio_nr);
-err_gpio_request:
-   rc_free_device(rcdev);
return rc;
 }
 
-- 
2.11.0



[PATCH 02/10] media: rc: gpio-ir-recv: use devm_kzalloc

2017-09-06 Thread Ladislav Michl
Use of devm_kzalloc simplifies error unwinding.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 11 +++
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 2f6233186ce9..fd5742b23447 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -139,15 +139,13 @@ static int gpio_ir_recv_probe(struct platform_device 
*pdev)
if (pdata->gpio_nr < 0)
return -EINVAL;
 
-   gpio_dev = kzalloc(sizeof(struct gpio_rc_dev), GFP_KERNEL);
+   gpio_dev = devm_kzalloc(dev, sizeof(struct gpio_rc_dev), GFP_KERNEL);
if (!gpio_dev)
return -ENOMEM;
 
rcdev = rc_allocate_device(RC_DRIVER_IR_RAW);
-   if (!rcdev) {
-   rc = -ENOMEM;
-   goto err_allocate_device;
-   }
+   if (!rcdev)
+   return -ENOMEM;
 
rcdev->priv = gpio_dev;
rcdev->input_name = GPIO_IR_DEVICE_NAME;
@@ -206,8 +204,6 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
gpio_free(pdata->gpio_nr);
 err_gpio_request:
rc_free_device(rcdev);
-err_allocate_device:
-   kfree(gpio_dev);
return rc;
 }
 
@@ -219,7 +215,6 @@ static int gpio_ir_recv_remove(struct platform_device *pdev)
del_timer_sync(_dev->flush_timer);
rc_unregister_device(gpio_dev->rcdev);
gpio_free(gpio_dev->gpio_nr);
-   kfree(gpio_dev);
return 0;
 }
 
-- 
2.11.0



[PATCH 01/10] media: rc: gpio-ir-recv: use helper vaiable to acess device info

2017-09-06 Thread Ladislav Michl
Using explicit struct device variable makes code a bit more readable.

Signed-off-by: Ladislav Michl 
---
 drivers/media/rc/gpio-ir-recv.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index b4f773b9dc1d..2f6233186ce9 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -116,18 +116,18 @@ static void flush_timer(unsigned long arg)
 
 static int gpio_ir_recv_probe(struct platform_device *pdev)
 {
+   struct device *dev = >dev;
struct gpio_rc_dev *gpio_dev;
struct rc_dev *rcdev;
-   const struct gpio_ir_recv_platform_data *pdata =
-   pdev->dev.platform_data;
+   const struct gpio_ir_recv_platform_data *pdata = dev->platform_data;
int rc;
 
if (pdev->dev.of_node) {
struct gpio_ir_recv_platform_data *dtpdata =
-   devm_kzalloc(>dev, sizeof(*dtpdata), GFP_KERNEL);
+   devm_kzalloc(dev, sizeof(*dtpdata), GFP_KERNEL);
if (!dtpdata)
return -ENOMEM;
-   rc = gpio_ir_recv_get_devtree_pdata(>dev, dtpdata);
+   rc = gpio_ir_recv_get_devtree_pdata(dev, dtpdata);
if (rc)
return rc;
pdata = dtpdata;
@@ -156,7 +156,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
rcdev->input_id.vendor = 0x0001;
rcdev->input_id.product = 0x0001;
rcdev->input_id.version = 0x0100;
-   rcdev->dev.parent = >dev;
+   rcdev->dev.parent = dev;
rcdev->driver_name = GPIO_IR_DRIVER_NAME;
rcdev->min_timeout = 1;
rcdev->timeout = IR_DEFAULT_TIMEOUT;
@@ -183,7 +183,7 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
 
rc = rc_register_device(rcdev);
if (rc < 0) {
-   dev_err(>dev, "failed to register rc device\n");
+   dev_err(dev, "failed to register rc device\n");
goto err_register_rc_device;
}
 
-- 
2.11.0



[PATCH 00/10] media: rc: gpio-ir-recv: driver update

2017-09-06 Thread Ladislav Michl
This patch serie brings driver closer to recently used APIs
and removes no longer used gpio_ir_recv_platform_data
support.

It was done as an excercise before writing similar driver using
FIQ and hw timers as this one gives too imprecise timing.

Ladislav Michl (10):
  media: rc: gpio-ir-recv: use helper vaiable to acess device info
  media: rc: gpio-ir-recv: use devm_kzalloc
  media: rc: gpio-ir-recv: use devm_rc_allocate_device
  media: rc: gpio-ir-recv: use devm_gpio_request_one
  media: rc: gpio-ir-recv: use devm_rc_register_device
  media: rc: gpio-ir-recv: do not allow threaded interrupt handler
  media: rc: gpio-ir-recv: use devm_request_irq
  media: rc: gpio-ir-recv: use KBUILD_MODNAME
  media: rc: gpio-ir-recv: remove gpio_ir_recv_platform_data
  media: rc: gpio-ir-recv: use gpiolib API

 drivers/media/rc/Kconfig |   1 +
 drivers/media/rc/gpio-ir-recv.c  | 191 +++
 include/linux/platform_data/media/gpio-ir-recv.h |  23 ---
 3 files changed, 58 insertions(+), 157 deletions(-)
 delete mode 100644 include/linux/platform_data/media/gpio-ir-recv.h

-- 
2.11.0


Re: [PATCH v4l-utils] configure.ac: drop --disable-libv4l, disable plugin support instead

2017-09-06 Thread Hugues FRUCHET
Hi all,

Thanks Thomas for the patch and sorry for delay, tested OK on my side 
with STM32F429I-EVAL board running no-MMU STM32F429 chip.

Tested-by: Hugues Fruchet 

On 09/02/2017 03:29 PM, Thomas Petazzoni wrote:
> Hello,
> 
> On Wed, 23 Aug 2017 13:06:13 +0200, Hans Verkuil wrote:
>> On 08/21/17 23:02, Thomas Petazzoni wrote:
>>> In commit 2e604dfbcd09b93f0808cedb2a0b324c5569a599 ("configure.ac: add
>>> --disable-libv4l option"), an option --disable-libv4l was added. As
>>> part of this, libv4l is no longer built at all in static linking
>>> configurations, just because libv4l uses dlopen() for plugin support.
>>>
>>> However, plugin support is only a side feature of libv4l, and one may
>>> need to use libv4l in static configurations, just without plugin
>>> support.
>>>
>>> Therefore, this commit:
>>>
>>>   - Essentially reverts 2e604dfbcd09b93f0808cedb2a0b324c5569a599, so
>>> that libv4l can be built in static linking configurations again.
>>>
>>>   - Adjusts the compilation of libv4l2 so that the plugin support is
>>> not compiled in when dlopen() in static linking configuration
>>> (dlopen is not available).
>>>
>>> Signed-off-by: Thomas Petazzoni 
>>> ---
>>> NOTE: this was only build-time tested, not runtime tested.
>>
>> Hugues, can you test this to make sure this still does what you need?
>>
>> It looks good to me, but I'd like to make sure it works for you as well
>> before committing this.
> 
> Thanks for your feedback. Unfortunately, Hugues has not answered. What
> can we do ?
> 
> Thanks,
> 
> Thomas
> 

Re: [PATCH v8 13/21] v4l: async: Register sub-devices before calling bound callback

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Register the sub-device before calling the notifier's bound callback.
> Doing this the other way around is problematic as the struct v4l2_device
> has not assigned for the sub-device yet and may be required by the bound
> callback.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/v4l2-core/v4l2-async.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index baee95eacbba..79f216723a3f 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -135,13 +135,13 @@ static int v4l2_async_match_notify(struct 
> v4l2_async_notifier *notifier,
>  {
>   int ret;
>  
> - ret = v4l2_async_notifier_call_bound(notifier, sd, asd);
> + ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd);
>   if (ret < 0)
>   return ret;
>  
> - ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd);
> + ret = v4l2_async_notifier_call_bound(notifier, sd, asd);
>   if (ret < 0) {
> - v4l2_async_notifier_call_unbind(notifier, sd, asd);
> + v4l2_device_unregister_subdev(sd);
>   return ret;
>   }
>  
> 



Re: [PATCH v8 12/21] v4l: async: Introduce helpers for calling async ops callbacks

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Add three helper functions to call async operations callbacks. Besides
> simplifying callbacks, this allows async notifiers to have no ops set,
> i.e. it can be left NULL.

What is the use-case of that?

Anyway:

Acked-by: Hans Verkuil 

Regards,

Hans

> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/v4l2-core/v4l2-async.c | 49 
> ++--
>  include/media/v4l2-async.h   |  1 +
>  2 files changed, 37 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index f7eb3713207a..baee95eacbba 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -25,6 +25,34 @@
>  #include 
>  #include 
>  
> +static int v4l2_async_notifier_call_bound(struct v4l2_async_notifier *n,
> +   struct v4l2_subdev *subdev,
> +   struct v4l2_async_subdev *asd)
> +{
> + if (!n->ops || !n->ops->bound)
> + return 0;
> +
> + return n->ops->bound(n, subdev, asd);
> +}
> +
> +static void v4l2_async_notifier_call_unbind(struct v4l2_async_notifier *n,
> + struct v4l2_subdev *subdev,
> + struct v4l2_async_subdev *asd)
> +{
> + if (!n->ops || !n->ops->unbind)
> + return;
> +
> + n->ops->unbind(n, subdev, asd);
> +}
> +
> +static int v4l2_async_notifier_call_complete(struct v4l2_async_notifier *n)
> +{
> + if (!n->ops || !n->ops->complete)
> + return 0;
> +
> + return n->ops->complete(n);
> +}
> +
>  static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
>  {
>  #if IS_ENABLED(CONFIG_I2C)
> @@ -107,16 +135,13 @@ static int v4l2_async_match_notify(struct 
> v4l2_async_notifier *notifier,
>  {
>   int ret;
>  
> - if (notifier->ops->bound) {
> - ret = notifier->ops->bound(notifier, sd, asd);
> - if (ret < 0)
> - return ret;
> - }
> + ret = v4l2_async_notifier_call_bound(notifier, sd, asd);
> + if (ret < 0)
> + return ret;
>  
>   ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd);
>   if (ret < 0) {
> - if (notifier->ops->unbind)
> - notifier->ops->unbind(notifier, sd, asd);
> + v4l2_async_notifier_call_unbind(notifier, sd, asd);
>   return ret;
>   }
>  
> @@ -128,8 +153,8 @@ static int v4l2_async_match_notify(struct 
> v4l2_async_notifier *notifier,
>   /* Move from the global subdevice list to notifier's done */
>   list_move(>async_list, >done);
>  
> - if (list_empty(>waiting) && notifier->ops->complete)
> - return notifier->ops->complete(notifier);
> + if (list_empty(>waiting))
> + return v4l2_async_notifier_call_complete(notifier);
>  
>   return 0;
>  }
> @@ -215,8 +240,7 @@ void v4l2_async_notifier_unregister(struct 
> v4l2_async_notifier *notifier)
>   list_for_each_entry_safe(sd, tmp, >done, async_list) {
>   v4l2_async_cleanup(sd);
>  
> - if (notifier->ops->unbind)
> - notifier->ops->unbind(notifier, sd, sd->asd);
> + v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
>   }
>  
>   mutex_unlock(_lock);
> @@ -294,8 +318,7 @@ void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
>  
>   v4l2_async_cleanup(sd);
>  
> - if (notifier->ops->unbind)
> - notifier->ops->unbind(notifier, sd, sd->asd);
> + v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
>  
>   mutex_unlock(_lock);
>  }
> diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h
> index 3c48f8b66d12..3bc8a7c0d83f 100644
> --- a/include/media/v4l2-async.h
> +++ b/include/media/v4l2-async.h
> @@ -164,4 +164,5 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd);
>   * @sd: pointer to  v4l2_subdev
>   */
>  void v4l2_async_unregister_subdev(struct v4l2_subdev *sd);
> +
>  #endif
> 



Re: [PATCH v8 10/21] omap3isp: Print the name of the entity where no source pads could be found

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> If no source pads are found in an entity, print the name of the entity.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/platform/omap3isp/isp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c 
> b/drivers/media/platform/omap3isp/isp.c
> index 3b1a9cd0e591..9a694924e46e 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -1669,8 +1669,8 @@ static int isp_link_entity(
>   break;
>   }
>   if (i == entity->num_pads) {
> - dev_err(isp->dev, "%s: no source pad in external entity\n",
> - __func__);
> + dev_err(isp->dev, "%s: no source pad in external entity %s\n",
> + __func__, entity->name);
>   return -EINVAL;
>   }
>  
> 



Re: [PATCH v8 09/21] omap3isp: Fix check for our own sub-devices

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> We only want to link sub-devices that were bound to the async notifier the
> isp driver registered but there may be other sub-devices in the
> v4l2_device as well. Check for the correct async notifier.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/platform/omap3isp/isp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c 
> b/drivers/media/platform/omap3isp/isp.c
> index a546cf774d40..3b1a9cd0e591 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2155,7 +2155,7 @@ static int isp_subdev_notifier_complete(struct 
> v4l2_async_notifier *async)
>   return ret;
>  
>   list_for_each_entry(sd, _dev->subdevs, list) {
> - if (!sd->asd)
> + if (sd->notifier != >notifier)
>   continue;
>  
>   ret = isp_link_entity(isp, >entity,
> 



Re: [PATCH v8 08/21] rcar-vin: Use generic parser for parsing fwnode endpoints

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Instead of using driver implementation, use
> v4l2_async_notifier_parse_fwnode_endpoints() to parse the fwnode endpoints
> of the device.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/platform/rcar-vin/rcar-core.c | 112 
> +---
>  drivers/media/platform/rcar-vin/rcar-dma.c  |  10 +--
>  drivers/media/platform/rcar-vin/rcar-v4l2.c |  14 ++--
>  drivers/media/platform/rcar-vin/rcar-vin.h  |   4 +-
>  4 files changed, 48 insertions(+), 92 deletions(-)
> 
> diff --git a/drivers/media/platform/rcar-vin/rcar-core.c 
> b/drivers/media/platform/rcar-vin/rcar-core.c
> index 142de447..bd551f0be213 100644
> --- a/drivers/media/platform/rcar-vin/rcar-core.c
> +++ b/drivers/media/platform/rcar-vin/rcar-core.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
>  
>  #include "rcar-vin.h"
> @@ -77,14 +78,14 @@ static int rvin_digital_notify_complete(struct 
> v4l2_async_notifier *notifier)
>   int ret;
>  
>   /* Verify subdevices mbus format */
> - if (!rvin_mbus_supported(>digital)) {
> + if (!rvin_mbus_supported(vin->digital)) {
>   vin_err(vin, "Unsupported media bus format for %s\n",
> - vin->digital.subdev->name);
> + vin->digital->subdev->name);
>   return -EINVAL;
>   }
>  
>   vin_dbg(vin, "Found media bus format for %s: %d\n",
> - vin->digital.subdev->name, vin->digital.code);
> + vin->digital->subdev->name, vin->digital->code);
>  
>   ret = v4l2_device_register_subdev_nodes(>v4l2_dev);
>   if (ret < 0) {
> @@ -103,7 +104,7 @@ static void rvin_digital_notify_unbind(struct 
> v4l2_async_notifier *notifier,
>  
>   vin_dbg(vin, "unbind digital subdev %s\n", subdev->name);
>   rvin_v4l2_remove(vin);
> - vin->digital.subdev = NULL;
> + vin->digital->subdev = NULL;
>  }
>  
>  static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier,
> @@ -120,117 +121,70 @@ static int rvin_digital_notify_bound(struct 
> v4l2_async_notifier *notifier,
>   ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SOURCE);
>   if (ret < 0)
>   return ret;
> - vin->digital.source_pad = ret;
> + vin->digital->source_pad = ret;
>  
>   ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK);
> - vin->digital.sink_pad = ret < 0 ? 0 : ret;
> + vin->digital->sink_pad = ret < 0 ? 0 : ret;
>  
> - vin->digital.subdev = subdev;
> + vin->digital->subdev = subdev;
>  
>   vin_dbg(vin, "bound subdev %s source pad: %u sink pad: %u\n",
> - subdev->name, vin->digital.source_pad,
> - vin->digital.sink_pad);
> + subdev->name, vin->digital->source_pad,
> + vin->digital->sink_pad);
>  
>   return 0;
>  }
>  
> -static int rvin_digitial_parse_v4l2(struct rvin_dev *vin,
> - struct device_node *ep,
> - struct v4l2_mbus_config *mbus_cfg)
> +static int rvin_digital_parse_v4l2(struct device *dev,
> +struct v4l2_fwnode_endpoint *vep,
> +struct v4l2_async_subdev *asd)
>  {
> - struct v4l2_fwnode_endpoint v4l2_ep;
> - int ret;
> + struct rvin_dev *vin = dev_get_drvdata(dev);
> + struct rvin_graph_entity *rvge =
> + container_of(asd, struct rvin_graph_entity, asd);
>  
> - ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), _ep);
> - if (ret) {
> - vin_err(vin, "Could not parse v4l2 endpoint\n");
> - return -EINVAL;
> - }
> + if (vep->base.port || vep->base.id)
> + return -EPERM;
>  
> - mbus_cfg->type = v4l2_ep.bus_type;
> + rvge->mbus_cfg.type = vep->bus_type;
>  
> - switch (mbus_cfg->type) {
> + switch (rvge->mbus_cfg.type) {
>   case V4L2_MBUS_PARALLEL:
>   vin_dbg(vin, "Found PARALLEL media bus\n");
> - mbus_cfg->flags = v4l2_ep.bus.parallel.flags;
> + rvge->mbus_cfg.flags = vep->bus.parallel.flags;
>   break;
>   case V4L2_MBUS_BT656:
>   vin_dbg(vin, "Found BT656 media bus\n");
> - mbus_cfg->flags = 0;
> + rvge->mbus_cfg.flags = 0;
>   break;
>   default:
>   vin_err(vin, "Unknown media bus type\n");
>   return -EINVAL;
>   }
>  
> - return 0;
> -}
> -
> -static int rvin_digital_graph_parse(struct rvin_dev *vin)
> -{
> - struct device_node *ep, *np;
> - int ret;
> -
> - vin->digital.asd.match.fwnode.fwnode = NULL;
> - vin->digital.subdev = NULL;
> -
> - /*
> -  * Port 0 id 0 is local digital input, try to get it.
> -  * Not all instances can or will have this, that is OK
> -  */
> - ep = of_graph_get_endpoint_by_regs(vin->dev->of_node, 0, 0);
> - if (!ep)
> - return 0;
> -
> -  

Re: [PATCH v8 07/21] omap3isp: Use generic parser for parsing fwnode endpoints

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Instead of using driver implementation, use
> v4l2_async_notifier_parse_fwnode_endpoints() to parse the fwnode endpoints
> of the device.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/platform/omap3isp/isp.c | 115 
> +++---
>  drivers/media/platform/omap3isp/isp.h |   5 +-
>  2 files changed, 37 insertions(+), 83 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c 
> b/drivers/media/platform/omap3isp/isp.c
> index 1a428fe9f070..a546cf774d40 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2001,6 +2001,7 @@ static int isp_remove(struct platform_device *pdev)
>   __omap3isp_put(isp, false);
>  
>   media_entity_enum_cleanup(>crashed);
> + v4l2_async_notifier_release(>notifier);
>  
>   return 0;
>  }
> @@ -2011,44 +2012,41 @@ enum isp_of_phy {
>   ISP_OF_PHY_CSIPHY2,
>  };
>  
> -static int isp_fwnode_parse(struct device *dev, struct fwnode_handle *fwnode,
> - struct isp_async_subdev *isd)
> +static int isp_fwnode_parse(struct device *dev,
> + struct v4l2_fwnode_endpoint *vep,
> + struct v4l2_async_subdev *asd)
>  {
> + struct isp_async_subdev *isd =
> + container_of(asd, struct isp_async_subdev, asd);
>   struct isp_bus_cfg *buscfg = >bus;
> - struct v4l2_fwnode_endpoint vep;
> - unsigned int i;
> - int ret;
>   bool csi1 = false;
> -
> - ret = v4l2_fwnode_endpoint_parse(fwnode, );
> - if (ret)
> - return ret;
> + unsigned int i;
>  
>   dev_dbg(dev, "parsing endpoint %pOF, interface %u\n",
> - to_of_node(fwnode), vep.base.port);
> + to_of_node(vep->base.local_fwnode), vep->base.port);
>  
> - switch (vep.base.port) {
> + switch (vep->base.port) {
>   case ISP_OF_PHY_PARALLEL:
>   buscfg->interface = ISP_INTERFACE_PARALLEL;
>   buscfg->bus.parallel.data_lane_shift =
> - vep.bus.parallel.data_shift;
> + vep->bus.parallel.data_shift;
>   buscfg->bus.parallel.clk_pol =
> - !!(vep.bus.parallel.flags
> + !!(vep->bus.parallel.flags
>  & V4L2_MBUS_PCLK_SAMPLE_FALLING);
>   buscfg->bus.parallel.hs_pol =
> - !!(vep.bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW);
> + !!(vep->bus.parallel.flags & 
> V4L2_MBUS_VSYNC_ACTIVE_LOW);
>   buscfg->bus.parallel.vs_pol =
> - !!(vep.bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW);
> + !!(vep->bus.parallel.flags & 
> V4L2_MBUS_HSYNC_ACTIVE_LOW);
>   buscfg->bus.parallel.fld_pol =
> - !!(vep.bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW);
> + !!(vep->bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW);
>   buscfg->bus.parallel.data_pol =
> - !!(vep.bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW);
> - buscfg->bus.parallel.bt656 = vep.bus_type == V4L2_MBUS_BT656;
> + !!(vep->bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW);
> + buscfg->bus.parallel.bt656 = vep->bus_type == V4L2_MBUS_BT656;
>   break;
>  
>   case ISP_OF_PHY_CSIPHY1:
>   case ISP_OF_PHY_CSIPHY2:
> - switch (vep.bus_type) {
> + switch (vep->bus_type) {
>   case V4L2_MBUS_CCP2:
>   case V4L2_MBUS_CSI1:
>   dev_dbg(dev, "CSI-1/CCP-2 configuration\n");
> @@ -2060,11 +2058,11 @@ static int isp_fwnode_parse(struct device *dev, 
> struct fwnode_handle *fwnode,
>   break;
>   default:
>   dev_err(dev, "unsupported bus type %u\n",
> - vep.bus_type);
> + vep->bus_type);
>   return -EINVAL;
>   }
>  
> - switch (vep.base.port) {
> + switch (vep->base.port) {
>   case ISP_OF_PHY_CSIPHY1:
>   if (csi1)
>   buscfg->interface = ISP_INTERFACE_CCP2B_PHY1;
> @@ -2080,47 +2078,47 @@ static int isp_fwnode_parse(struct device *dev, 
> struct fwnode_handle *fwnode,
>   }
>   if (csi1) {
>   buscfg->bus.ccp2.lanecfg.clk.pos =
> - vep.bus.mipi_csi1.clock_lane;
> + vep->bus.mipi_csi1.clock_lane;
>   buscfg->bus.ccp2.lanecfg.clk.pol =
> - vep.bus.mipi_csi1.lane_polarity[0];
> + vep->bus.mipi_csi1.lane_polarity[0];
>   dev_dbg(dev, 

Re: [PATCH v8 06/21] v4l: fwnode: Support generic parsing of graph endpoints in a device

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> The current practice is that drivers iterate over their endpoints and
> parse each endpoint separately. This is very similar in a number of
> drivers, implement a generic function for the job. Driver specific matters
> can be taken into account in the driver specific callback.
> 
> Signed-off-by: Sakari Ailus 
> ---
>  drivers/media/v4l2-core/v4l2-async.c  |  19 +
>  drivers/media/v4l2-core/v4l2-fwnode.c | 140 
> ++
>  include/media/v4l2-async.h|  24 +-
>  include/media/v4l2-fwnode.h   |  53 +
>  4 files changed, 234 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index 3d81ff6a496f..7bd595c4094a 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -22,6 +22,7 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
> @@ -224,6 +225,24 @@ void v4l2_async_notifier_unregister(struct 
> v4l2_async_notifier *notifier)
>  }
>  EXPORT_SYMBOL(v4l2_async_notifier_unregister);
>  
> +void v4l2_async_notifier_release(struct v4l2_async_notifier *notifier)
> +{
> + unsigned int i;
> +
> + if (!notifier->max_subdevs)
> + return;
> +
> + for (i = 0; i < notifier->num_subdevs; i++)
> + kfree(notifier->subdevs[i]);
> +
> + notifier->max_subdevs = 0;
> + notifier->num_subdevs = 0;
> +
> + kvfree(notifier->subdevs);
> + notifier->subdevs = NULL;
> +}
> +EXPORT_SYMBOL_GPL(v4l2_async_notifier_release);
> +
>  int v4l2_async_register_subdev(struct v4l2_subdev *sd)
>  {
>   struct v4l2_async_notifier *notifier;
> diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c 
> b/drivers/media/v4l2-core/v4l2-fwnode.c
> index 706f9e7b90f1..e6932d7d47b6 100644
> --- a/drivers/media/v4l2-core/v4l2-fwnode.c
> +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> @@ -19,6 +19,7 @@
>   */
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -26,6 +27,7 @@
>  #include 
>  #include 
>  
> +#include 
>  #include 
>  
>  enum v4l2_fwnode_bus_type {
> @@ -313,6 +315,144 @@ void v4l2_fwnode_put_link(struct v4l2_fwnode_link *link)
>  }
>  EXPORT_SYMBOL_GPL(v4l2_fwnode_put_link);
>  
> +static int v4l2_async_notifier_realloc(struct v4l2_async_notifier *notifier,
> +unsigned int max_subdevs)
> +{
> + struct v4l2_async_subdev **subdevs;
> +
> + if (max_subdevs <= notifier->max_subdevs)
> + return 0;
> +
> + subdevs = kvmalloc_array(
> + max_subdevs, sizeof(*notifier->subdevs),
> + GFP_KERNEL | __GFP_ZERO);
> + if (!subdevs)
> + return -ENOMEM;
> +
> + if (notifier->subdevs) {
> + memcpy(subdevs, notifier->subdevs,
> +sizeof(*subdevs) * notifier->num_subdevs);
> +
> + kvfree(notifier->subdevs);
> + }
> +
> + notifier->subdevs = subdevs;
> + notifier->max_subdevs = max_subdevs;
> +
> + return 0;
> +}
> +
> +static int v4l2_async_notifier_fwnode_parse_endpoint(
> + struct device *dev, struct v4l2_async_notifier *notifier,
> + struct fwnode_handle *endpoint, unsigned int asd_struct_size,
> + int (*parse_endpoint)(struct device *dev,
> + struct v4l2_fwnode_endpoint *vep,
> + struct v4l2_async_subdev *asd))
> +{
> + struct v4l2_async_subdev *asd;
> + struct v4l2_fwnode_endpoint *vep;
> + struct fwnode_endpoint ep;
> + int ret = 0;
> +
> + asd = kzalloc(asd_struct_size, GFP_KERNEL);
> + if (!asd)
> + return -ENOMEM;
> +
> + asd->match.fwnode.fwnode =
> + fwnode_graph_get_remote_port_parent(endpoint);
> + if (!asd->match.fwnode.fwnode) {
> + dev_warn(dev, "bad remote port parent\n");
> + ret = -EINVAL;
> + goto out_err;
> + }
> +
> + /* Ignore endpoints the parsing of which failed. */
> + vep = v4l2_fwnode_endpoint_alloc_parse(endpoint);
> + if (IS_ERR(vep)) {
> + ret = PTR_ERR(vep);
> + dev_warn(dev, "unable to parse V4L2 fwnode endpoint (%d)\n",
> +  ret);
> + goto out_err;
> + }
> +
> + ep = vep->base;
> +
> + ret = parse_endpoint ? parse_endpoint(dev, vep, asd) : 0;
> + v4l2_fwnode_endpoint_free(vep);
> + if (ret == -ENOTCONN) {
> + dev_dbg(dev, "ignoring endpoint %u,%u\n", ep.port, ep.id);
> + kfree(asd);

Shouldn't there be a call to fwnode_handle_put()?

> + return 0;
> + } else if (ret < 0) {
> + dev_warn(dev, "driver could not parse endpoint %u,%u (%d)\n",
> +  ep.port, ep.id, ret);
> + goto out_err;
> + }

I think this would be 

Re: [PATCH v8 03/21] v4l: async: Use more intuitive names for internal functions

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Rename internal functions to make the names of the functions better
> describe what they do.
> 
>   Old nameNew name
>   v4l2_async_test_notify  v4l2_async_match_notify
>   v4l2_async_belongs  v4l2_async_find_match
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/v4l2-core/v4l2-async.c | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index f50a82767863..3d81ff6a496f 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -65,8 +65,8 @@ static LIST_HEAD(subdev_list);
>  static LIST_HEAD(notifier_list);
>  static DEFINE_MUTEX(list_lock);
>  
> -static struct v4l2_async_subdev *v4l2_async_belongs(struct 
> v4l2_async_notifier *notifier,
> - struct v4l2_subdev *sd)
> +static struct v4l2_async_subdev *v4l2_async_find_match(
> + struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd)
>  {
>   bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *);
>   struct v4l2_async_subdev *asd;
> @@ -100,9 +100,9 @@ static struct v4l2_async_subdev 
> *v4l2_async_belongs(struct v4l2_async_notifier *
>   return NULL;
>  }
>  
> -static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
> -   struct v4l2_subdev *sd,
> -   struct v4l2_async_subdev *asd)
> +static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
> +struct v4l2_subdev *sd,
> +struct v4l2_async_subdev *asd)
>  {
>   int ret;
>  
> @@ -180,11 +180,11 @@ int v4l2_async_notifier_register(struct v4l2_device 
> *v4l2_dev,
>   list_for_each_entry_safe(sd, tmp, _list, async_list) {
>   int ret;
>  
> - asd = v4l2_async_belongs(notifier, sd);
> + asd = v4l2_async_find_match(notifier, sd);
>   if (!asd)
>   continue;
>  
> - ret = v4l2_async_test_notify(notifier, sd, asd);
> + ret = v4l2_async_match_notify(notifier, sd, asd);
>   if (ret < 0) {
>   mutex_unlock(_lock);
>   return ret;
> @@ -241,9 +241,10 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
>   INIT_LIST_HEAD(>async_list);
>  
>   list_for_each_entry(notifier, _list, list) {
> - struct v4l2_async_subdev *asd = v4l2_async_belongs(notifier, 
> sd);
> + struct v4l2_async_subdev *asd = v4l2_async_find_match(notifier,
> +   sd);
>   if (asd) {
> - int ret = v4l2_async_test_notify(notifier, sd, asd);
> + int ret = v4l2_async_match_notify(notifier, sd, asd);
>   mutex_unlock(_lock);
>   return ret;
>   }
> 



Re: [PATCH v8 02/21] v4l: async: Remove re-probing support

2017-09-06 Thread Hans Verkuil
On 09/05/2017 03:05 PM, Sakari Ailus wrote:
> Remove V4L2 async re-probing support. The re-probing support has been
> there to support cases where the sub-devices require resources provided by
> the main driver's hardware to function, such as clocks.
> 
> Reprobing has allowed unbinding and again binding the main driver without
> explicilty unbinding the sub-device drivers. This is certainly not a
> common need, and the responsibility will be the user's going forward.
> 
> An alternative could have been to introduce notifier specific locks.
> Considering the complexity of the re-probing and that it isn't really a
> solution to a problem but a workaround, remove re-probing instead.
> 
> Signed-off-by: Sakari Ailus 

Acked-by: Hans Verkuil 

Regards,

Hans

> ---
>  drivers/media/v4l2-core/v4l2-async.c | 54 
> 
>  1 file changed, 54 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> b/drivers/media/v4l2-core/v4l2-async.c
> index 851f128eba22..f50a82767863 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -203,78 +203,24 @@ EXPORT_SYMBOL(v4l2_async_notifier_register);
>  void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
>  {
>   struct v4l2_subdev *sd, *tmp;
> - unsigned int notif_n_subdev = notifier->num_subdevs;
> - unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS);
> - struct device **dev;
> - int i = 0;
>  
>   if (!notifier->v4l2_dev)
>   return;
>  
> - dev = kvmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
> - if (!dev) {
> - dev_err(notifier->v4l2_dev->dev,
> - "Failed to allocate device cache!\n");
> - }
> -
>   mutex_lock(_lock);
>  
>   list_del(>list);
>  
>   list_for_each_entry_safe(sd, tmp, >done, async_list) {
> - struct device *d;
> -
> - d = get_device(sd->dev);
> -
>   v4l2_async_cleanup(sd);
>  
> - /* If we handled USB devices, we'd have to lock the parent too 
> */
> - device_release_driver(d);
> -
>   if (notifier->unbind)
>   notifier->unbind(notifier, sd, sd->asd);
> -
> - /*
> -  * Store device at the device cache, in order to call
> -  * put_device() on the final step
> -  */
> - if (dev)
> - dev[i++] = d;
> - else
> - put_device(d);
>   }
>  
>   mutex_unlock(_lock);
>  
> - /*
> -  * Call device_attach() to reprobe devices
> -  *
> -  * NOTE: If dev allocation fails, i is 0, and the whole loop won't be
> -  * executed.
> -  */
> - while (i--) {
> - struct device *d = dev[i];
> -
> - if (d && device_attach(d) < 0) {
> - const char *name = "(none)";
> - int lock = device_trylock(d);
> -
> - if (lock && d->driver)
> - name = d->driver->name;
> - dev_err(d, "Failed to re-probe to %s\n", name);
> - if (lock)
> - device_unlock(d);
> - }
> - put_device(d);
> - }
> - kvfree(dev);
> -
>   notifier->v4l2_dev = NULL;
> -
> - /*
> -  * Don't care about the waiting list, it is initialised and populated
> -  * upon notifier registration.
> -  */
>  }
>  EXPORT_SYMBOL(v4l2_async_notifier_unregister);
>  
> 



Re: [PATCH v1] media: ov13858: Calculate pixel-rate at runtime, use mode

2017-09-06 Thread Sakari Ailus
Hi Rajmohan,

Thanks for the patch. A few comments below.

On Tue, Sep 05, 2017 at 04:44:58PM -0700, Rajmohan Mani wrote:
> From: Chiranjeevi Rapolu 
> 
> Instead of calculating pixle-rate at two different places, calculate at run
> time at a single place.
> 
> Instead of using hardcoded pixels-per-line, extract it from current sensor
> mode.
> 
> Signed-off-by: Chiranjeevi Rapolu 
> ---
>  drivers/media/i2c/ov13858.c | 42 +-
>  1 file changed, 25 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
> index af7af0d..2821824 100644
> --- a/drivers/media/i2c/ov13858.c
> +++ b/drivers/media/i2c/ov13858.c
> @@ -955,11 +955,9 @@ struct ov13858_mode {
>  };
>  
>  /* Link frequency configs */
> -static const struct ov13858_link_freq_config
> +static struct ov13858_link_freq_config
>   link_freq_configs[OV13858_NUM_OF_LINK_FREQS] = {
>   {
> - /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
> - .pixel_rate = (OV13858_LINK_FREQ_540MHZ * 2 * 4) / 10,

Could you remove the pixel_rate field from the struct definition as well?

>   .pixels_per_line = OV13858_PPL_540MHZ,
>   .reg_list = {
>   .num_of_regs = ARRAY_SIZE(mipi_data_rate_1080mbps),
> @@ -967,8 +965,6 @@ struct ov13858_mode {
>   }
>   },
>   {
> - /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
> - .pixel_rate = (OV13858_LINK_FREQ_270MHZ * 2 * 4) / 10,
>   .pixels_per_line = OV13858_PPL_270MHZ,
>   .reg_list = {
>   .num_of_regs = ARRAY_SIZE(mipi_data_rate_540mbps),
> @@ -1617,6 +1613,10 @@ static int ov13858_init_controls(struct ov13858 
> *ov13858)
>   s64 exposure_max;
>   s64 vblank_def;
>   s64 vblank_min;
> + s64 hblank;
> + s64 pixel_rate_min;
> + s64 pixel_rate_max;
> + const struct ov13858_mode *mode;
>   int ret;
>  
>   ctrl_hdlr = >ctrl_handler;
> @@ -1634,29 +1634,30 @@ static int ov13858_init_controls(struct ov13858 
> *ov13858)
>   link_freq_menu_items);
>   ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
>  
> + pixel_rate_max = link_freq_configs[0].pixel_rate;
> + pixel_rate_min = link_freq_configs[1].pixel_rate;
>   /* By default, PIXEL_RATE is read only */
>   ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, _ctrl_ops,
> - V4L2_CID_PIXEL_RATE, 0,
> - link_freq_configs[0].pixel_rate, 1,
> - link_freq_configs[0].pixel_rate);
> + V4L2_CID_PIXEL_RATE,
> + pixel_rate_min, pixel_rate_max,
> + 1, pixel_rate_max);
>  
> - vblank_def = ov13858->cur_mode->vts_def - ov13858->cur_mode->height;
> - vblank_min = ov13858->cur_mode->vts_min - ov13858->cur_mode->height;
> + mode = ov13858->cur_mode;
> + vblank_def = mode->vts_def - mode->height;
> + vblank_min = mode->vts_min - mode->height;
>   ov13858->vblank = v4l2_ctrl_new_std(
>   ctrl_hdlr, _ctrl_ops, V4L2_CID_VBLANK,
> - vblank_min,
> - OV13858_VTS_MAX - ov13858->cur_mode->height, 1,
> + vblank_min, OV13858_VTS_MAX - mode->height, 1,
>   vblank_def);
>  
> + hblank = link_freq_configs[mode->link_freq_index].pixels_per_line -
> +  mode->width;
>   ov13858->hblank = v4l2_ctrl_new_std(
>   ctrl_hdlr, _ctrl_ops, V4L2_CID_HBLANK,
> - OV13858_PPL_540MHZ - ov13858->cur_mode->width,
> - OV13858_PPL_540MHZ - ov13858->cur_mode->width,
> - 1,
> - OV13858_PPL_540MHZ - ov13858->cur_mode->width);
> + hblank, hblank, 1, hblank);
>   ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
>  
> - exposure_max = ov13858->cur_mode->vts_def - 8;
> + exposure_max = mode->vts_def - 8;
>   ov13858->exposure = v4l2_ctrl_new_std(
>   ctrl_hdlr, _ctrl_ops,
>   V4L2_CID_EXPOSURE, OV13858_EXPOSURE_MIN,
> @@ -1704,6 +1705,7 @@ static int ov13858_probe(struct i2c_client *client,
>const struct i2c_device_id *devid)
>  {
>   struct ov13858 *ov13858;
> + int i;
>   int ret;
>   u32 val = 0;
>  
> @@ -1725,6 +1727,12 @@ static int ov13858_probe(struct i2c_client *client,
>   return ret;
>   }
>  
> + for (i = 0; i < OV13858_NUM_OF_LINK_FREQS; i++) {
> + /* 

Re: [PATCH 0/6] [media] Atmel: Adjustments for seven function implementations

2017-09-06 Thread Ludovic Desroches
On Wed, Sep 06, 2017 at 08:58:26AM +0800, Yang, Wenyou wrote:
> Hi,
> 
> 
> On 2017/9/5 4:04, SF Markus Elfring wrote:
> > From: Markus Elfring 
> > Date: Mon, 4 Sep 2017 21:44:55 +0200
> > 
> > A few update suggestions were taken into account
> > from static source code analysis.
> Thank you for your patches.
> 
> You can add my Acked-by for the patch series.
> 
> Acked-by: Wenyou Yang 

Acked-by: Ludovic Desroches 

> 
> > 
> > Markus Elfring (6):
> >Delete an error message for a failed memory allocation in 
> > isc_formats_init()
> >Improve a size determination in isc_formats_init()
> >Adjust three checks for null pointers
> >Delete an error message for a failed memory allocation in two functions
> >Improve three size determinations
> >Adjust a null pointer check in three functions
> > 
> >   drivers/media/platform/atmel/atmel-isc.c | 12 +---
> >   drivers/media/platform/atmel/atmel-isi.c | 20 
> >   2 files changed, 13 insertions(+), 19 deletions(-)
> > 
> 
> Best Regards,
> Wenyou Yang