Commit 174ced21 authored by Shuah Khan's avatar Shuah Khan Committed by Mauro Carvalho Chehab

[media] media: au0828 set ctrl_input in au0828_s_input()

dev->ctrl_input is set in vidioc_s_input() and doesn't get set in
au0828_s_input(). As a result, dev->ctrl_input is left uninitialized
until user space calls s_input.

It works correctly because the default input value is 0 and which is
what dev->ctrl_input gets initialized via kzalloc().

Change to set dev->ctrl_input in au0828_s_input(). Also optimize
vidioc_s_input() to return if the new input value is same as the
current.
Signed-off-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent b21d29e0
...@@ -1417,9 +1417,11 @@ static void au0828_s_input(struct au0828_dev *dev, int index) ...@@ -1417,9 +1417,11 @@ static void au0828_s_input(struct au0828_dev *dev, int index)
default: default:
dprintk(1, "unknown input type set [%d]\n", dprintk(1, "unknown input type set [%d]\n",
AUVI_INPUT(index).type); AUVI_INPUT(index).type);
break; return;
} }
dev->ctrl_input = index;
v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing, v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_routing,
AUVI_INPUT(index).vmux, 0, 0); AUVI_INPUT(index).vmux, 0, 0);
...@@ -1458,7 +1460,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) ...@@ -1458,7 +1460,10 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index)
return -EINVAL; return -EINVAL;
if (AUVI_INPUT(index).type == 0) if (AUVI_INPUT(index).type == 0)
return -EINVAL; return -EINVAL;
dev->ctrl_input = index;
if (dev->ctrl_input == index)
return 0;
au0828_s_input(dev, index); au0828_s_input(dev, index);
return 0; return 0;
} }
...@@ -1974,6 +1979,7 @@ int au0828_analog_register(struct au0828_dev *dev, ...@@ -1974,6 +1979,7 @@ int au0828_analog_register(struct au0828_dev *dev,
dev->ctrl_ainput = 0; dev->ctrl_ainput = 0;
dev->ctrl_freq = 960; dev->ctrl_freq = 960;
dev->std = V4L2_STD_NTSC_M; dev->std = V4L2_STD_NTSC_M;
/* Default input is TV Tuner */
au0828_s_input(dev, 0); au0828_s_input(dev, 0);
mutex_init(&dev->vb_queue_lock); mutex_init(&dev->vb_queue_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment