aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/radio/si470x/radio-si470x-common.c
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2009-08-09 14:23:02 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 12:18:42 -0300
commit3c7cc8d52c0bd60d214aca22772aa3602a2b3198 (patch)
tree7018e376b3446607cc4a3be92e6e8914051aae24 /drivers/media/radio/si470x/radio-si470x-common.c
parenta9d6fd5e316f1bbed08278c88cb984a2616a0278 (diff)
V4L/DVB (12415): radio-si470x: add disconnect check function
The si470x_disconnect_check is function to check disconnect state of radio in common file. The function is implemented in each interface file. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/si470x/radio-si470x-common.c')
-rw-r--r--drivers/media/radio/si470x/radio-si470x-common.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c
index fd9fc4aa8fb..9f9a417caf9 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -475,10 +475,9 @@ static int si470x_vidioc_g_ctrl(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
switch (ctrl->id) {
case V4L2_CID_AUDIO_VOLUME:
@@ -511,10 +510,9 @@ static int si470x_vidioc_s_ctrl(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
switch (ctrl->id) {
case V4L2_CID_AUDIO_VOLUME:
@@ -567,10 +565,10 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
+
if (tuner->index != 0) {
retval = -EINVAL;
goto done;
@@ -649,10 +647,10 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
int retval = -EINVAL;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
+
if (tuner->index != 0)
goto done;
@@ -688,10 +686,10 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
+
if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
@@ -718,10 +716,10 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
+
if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
@@ -747,10 +745,10 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
int retval = 0;
/* safety checks */
- if (radio->disconnected) {
- retval = -EIO;
+ retval = si470x_disconnect_check(radio);
+ if (retval)
goto done;
- }
+
if (seek->tuner != 0) {
retval = -EINVAL;
goto done;