diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-05-26 13:03:02 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-06-05 05:35:41 -0400 |
commit | 4d3437df25325d517ee310d55989ce9630ff529e (patch) | |
tree | 8784b6743e647dab94fc683ca8e29fb1dac4daa4 | |
parent | 7fa7b8583f14889aaceebcd8dca3093987e289f7 (diff) |
V4L/DVB (7904): v4l/tuner-core: consistent handling of return values
change check_mode and set_mode to return negative errors and fix all callers
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/tuner-core.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index a0f7bc1edaa2..1a9117457c8e 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -536,7 +536,7 @@ static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup) | |||
536 | static inline int check_mode(struct tuner *t, char *cmd) | 536 | static inline int check_mode(struct tuner *t, char *cmd) |
537 | { | 537 | { |
538 | if ((1 << t->mode & t->mode_mask) == 0) { | 538 | if ((1 << t->mode & t->mode_mask) == 0) { |
539 | return EINVAL; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | switch (t->mode) { | 542 | switch (t->mode) { |
@@ -730,11 +730,11 @@ static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, | |||
730 | 730 | ||
731 | t->mode = mode; | 731 | t->mode = mode; |
732 | 732 | ||
733 | if (check_mode(t, cmd) == EINVAL) { | 733 | if (check_mode(t, cmd) == -EINVAL) { |
734 | t->mode = T_STANDBY; | 734 | t->mode = T_STANDBY; |
735 | if (analog_ops->standby) | 735 | if (analog_ops->standby) |
736 | analog_ops->standby(&t->fe); | 736 | analog_ops->standby(&t->fe); |
737 | return EINVAL; | 737 | return -EINVAL; |
738 | } | 738 | } |
739 | return 0; | 739 | return 0; |
740 | } | 740 | } |
@@ -776,13 +776,13 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
776 | break; | 776 | break; |
777 | case AUDC_SET_RADIO: | 777 | case AUDC_SET_RADIO: |
778 | if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") | 778 | if (set_mode(client, t, V4L2_TUNER_RADIO, "AUDC_SET_RADIO") |
779 | == EINVAL) | 779 | == -EINVAL) |
780 | return 0; | 780 | return 0; |
781 | if (t->radio_freq) | 781 | if (t->radio_freq) |
782 | set_freq(client, t->radio_freq); | 782 | set_freq(client, t->radio_freq); |
783 | break; | 783 | break; |
784 | case TUNER_SET_STANDBY: | 784 | case TUNER_SET_STANDBY: |
785 | if (check_mode(t, "TUNER_SET_STANDBY") == EINVAL) | 785 | if (check_mode(t, "TUNER_SET_STANDBY") == -EINVAL) |
786 | return 0; | 786 | return 0; |
787 | t->mode = T_STANDBY; | 787 | t->mode = T_STANDBY; |
788 | if (analog_ops->standby) | 788 | if (analog_ops->standby) |
@@ -790,7 +790,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
790 | break; | 790 | break; |
791 | #ifdef CONFIG_VIDEO_ALLOW_V4L1 | 791 | #ifdef CONFIG_VIDEO_ALLOW_V4L1 |
792 | case VIDIOCSAUDIO: | 792 | case VIDIOCSAUDIO: |
793 | if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) | 793 | if (check_mode(t, "VIDIOCSAUDIO") == -EINVAL) |
794 | return 0; | 794 | return 0; |
795 | if (check_v4l2(t) == EINVAL) | 795 | if (check_v4l2(t) == EINVAL) |
796 | return 0; | 796 | return 0; |
@@ -813,7 +813,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
813 | if (check_v4l2(t) == EINVAL) | 813 | if (check_v4l2(t) == EINVAL) |
814 | return 0; | 814 | return 0; |
815 | 815 | ||
816 | if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL) | 816 | if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==-EINVAL) |
817 | return 0; | 817 | return 0; |
818 | 818 | ||
819 | if (vc->norm < ARRAY_SIZE(map)) | 819 | if (vc->norm < ARRAY_SIZE(map)) |
@@ -827,7 +827,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
827 | { | 827 | { |
828 | unsigned long *v = arg; | 828 | unsigned long *v = arg; |
829 | 829 | ||
830 | if (check_mode(t, "VIDIOCSFREQ") == EINVAL) | 830 | if (check_mode(t, "VIDIOCSFREQ") == -EINVAL) |
831 | return 0; | 831 | return 0; |
832 | if (check_v4l2(t) == EINVAL) | 832 | if (check_v4l2(t) == EINVAL) |
833 | return 0; | 833 | return 0; |
@@ -839,7 +839,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
839 | { | 839 | { |
840 | struct video_tuner *vt = arg; | 840 | struct video_tuner *vt = arg; |
841 | 841 | ||
842 | if (check_mode(t, "VIDIOCGTUNER") == EINVAL) | 842 | if (check_mode(t, "VIDIOCGTUNER") == -EINVAL) |
843 | return 0; | 843 | return 0; |
844 | if (check_v4l2(t) == EINVAL) | 844 | if (check_v4l2(t) == EINVAL) |
845 | return 0; | 845 | return 0; |
@@ -883,7 +883,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
883 | { | 883 | { |
884 | struct video_audio *va = arg; | 884 | struct video_audio *va = arg; |
885 | 885 | ||
886 | if (check_mode(t, "VIDIOCGAUDIO") == EINVAL) | 886 | if (check_mode(t, "VIDIOCGAUDIO") == -EINVAL) |
887 | return 0; | 887 | return 0; |
888 | if (check_v4l2(t) == EINVAL) | 888 | if (check_v4l2(t) == EINVAL) |
889 | return 0; | 889 | return 0; |
@@ -925,7 +925,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
925 | v4l2_std_id *id = arg; | 925 | v4l2_std_id *id = arg; |
926 | 926 | ||
927 | if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") | 927 | if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD") |
928 | == EINVAL) | 928 | == -EINVAL) |
929 | return 0; | 929 | return 0; |
930 | 930 | ||
931 | switch_v4l2(); | 931 | switch_v4l2(); |
@@ -941,7 +941,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
941 | struct v4l2_frequency *f = arg; | 941 | struct v4l2_frequency *f = arg; |
942 | 942 | ||
943 | if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") | 943 | if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY") |
944 | == EINVAL) | 944 | == -EINVAL) |
945 | return 0; | 945 | return 0; |
946 | switch_v4l2(); | 946 | switch_v4l2(); |
947 | set_freq(client,f->frequency); | 947 | set_freq(client,f->frequency); |
@@ -952,7 +952,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
952 | { | 952 | { |
953 | struct v4l2_frequency *f = arg; | 953 | struct v4l2_frequency *f = arg; |
954 | 954 | ||
955 | if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL) | 955 | if (check_mode(t, "VIDIOC_G_FREQUENCY") == -EINVAL) |
956 | return 0; | 956 | return 0; |
957 | switch_v4l2(); | 957 | switch_v4l2(); |
958 | f->type = t->mode; | 958 | f->type = t->mode; |
@@ -973,7 +973,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
973 | { | 973 | { |
974 | struct v4l2_tuner *tuner = arg; | 974 | struct v4l2_tuner *tuner = arg; |
975 | 975 | ||
976 | if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL) | 976 | if (check_mode(t, "VIDIOC_G_TUNER") == -EINVAL) |
977 | return 0; | 977 | return 0; |
978 | switch_v4l2(); | 978 | switch_v4l2(); |
979 | 979 | ||
@@ -1020,7 +1020,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
1020 | { | 1020 | { |
1021 | struct v4l2_tuner *tuner = arg; | 1021 | struct v4l2_tuner *tuner = arg; |
1022 | 1022 | ||
1023 | if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL) | 1023 | if (check_mode(t, "VIDIOC_S_TUNER") == -EINVAL) |
1024 | return 0; | 1024 | return 0; |
1025 | 1025 | ||
1026 | switch_v4l2(); | 1026 | switch_v4l2(); |