aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firewire/firedtv-ci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/firewire/firedtv-ci.c')
-rw-r--r--drivers/media/dvb/firewire/firedtv-ci.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-ci.c b/drivers/media/dvb/firewire/firedtv-ci.c
index 8ffb565f0704..e5ebdbfe8c19 100644
--- a/drivers/media/dvb/firewire/firedtv-ci.c
+++ b/drivers/media/dvb/firewire/firedtv-ci.c
@@ -45,11 +45,6 @@ static int fdtv_get_ca_flags(struct firedtv_tuner_status *stat)
45 return flags; 45 return flags;
46} 46}
47 47
48static int fdtv_ca_reset(struct firedtv *fdtv)
49{
50 return avc_ca_reset(fdtv) ? -EFAULT : 0;
51}
52
53static int fdtv_ca_get_caps(void *arg) 48static int fdtv_ca_get_caps(void *arg)
54{ 49{
55 struct ca_caps *cap = arg; 50 struct ca_caps *cap = arg;
@@ -65,12 +60,14 @@ static int fdtv_ca_get_slot_info(struct firedtv *fdtv, void *arg)
65{ 60{
66 struct firedtv_tuner_status stat; 61 struct firedtv_tuner_status stat;
67 struct ca_slot_info *slot = arg; 62 struct ca_slot_info *slot = arg;
63 int err;
68 64
69 if (avc_tuner_status(fdtv, &stat)) 65 err = avc_tuner_status(fdtv, &stat);
70 return -EFAULT; 66 if (err)
67 return err;
71 68
72 if (slot->num != 0) 69 if (slot->num != 0)
73 return -EFAULT; 70 return -EACCES;
74 71
75 slot->type = CA_CI; 72 slot->type = CA_CI;
76 slot->flags = fdtv_get_ca_flags(&stat); 73 slot->flags = fdtv_get_ca_flags(&stat);
@@ -81,21 +78,21 @@ static int fdtv_ca_app_info(struct firedtv *fdtv, void *arg)
81{ 78{
82 struct ca_msg *reply = arg; 79 struct ca_msg *reply = arg;
83 80
84 return avc_ca_app_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; 81 return avc_ca_app_info(fdtv, reply->msg, &reply->length);
85} 82}
86 83
87static int fdtv_ca_info(struct firedtv *fdtv, void *arg) 84static int fdtv_ca_info(struct firedtv *fdtv, void *arg)
88{ 85{
89 struct ca_msg *reply = arg; 86 struct ca_msg *reply = arg;
90 87
91 return avc_ca_info(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; 88 return avc_ca_info(fdtv, reply->msg, &reply->length);
92} 89}
93 90
94static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg) 91static int fdtv_ca_get_mmi(struct firedtv *fdtv, void *arg)
95{ 92{
96 struct ca_msg *reply = arg; 93 struct ca_msg *reply = arg;
97 94
98 return avc_ca_get_mmi(fdtv, reply->msg, &reply->length) ? -EFAULT : 0; 95 return avc_ca_get_mmi(fdtv, reply->msg, &reply->length);
99} 96}
100 97
101static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg) 98static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg)
@@ -111,14 +108,15 @@ static int fdtv_ca_get_msg(struct firedtv *fdtv, void *arg)
111 err = fdtv_ca_info(fdtv, arg); 108 err = fdtv_ca_info(fdtv, arg);
112 break; 109 break;
113 default: 110 default:
114 if (avc_tuner_status(fdtv, &stat)) 111 err = avc_tuner_status(fdtv, &stat);
115 err = -EFAULT; 112 if (err)
116 else if (stat.ca_mmi == 1) 113 break;
114 if (stat.ca_mmi == 1)
117 err = fdtv_ca_get_mmi(fdtv, arg); 115 err = fdtv_ca_get_mmi(fdtv, arg);
118 else { 116 else {
119 dev_info(fdtv->device, "unhandled CA message 0x%08x\n", 117 dev_info(fdtv->device, "unhandled CA message 0x%08x\n",
120 fdtv->ca_last_command); 118 fdtv->ca_last_command);
121 err = -EFAULT; 119 err = -EACCES;
122 } 120 }
123 } 121 }
124 fdtv->ca_last_command = 0; 122 fdtv->ca_last_command = 0;
@@ -141,7 +139,7 @@ static int fdtv_ca_pmt(struct firedtv *fdtv, void *arg)
141 data_length = msg->msg[3]; 139 data_length = msg->msg[3];
142 } 140 }
143 141
144 return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length) ? -EFAULT : 0; 142 return avc_ca_pmt(fdtv, &msg->msg[data_pos], data_length);
145} 143}
146 144
147static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg) 145static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
@@ -170,7 +168,7 @@ static int fdtv_ca_send_msg(struct firedtv *fdtv, void *arg)
170 default: 168 default:
171 dev_err(fdtv->device, "unhandled CA message 0x%08x\n", 169 dev_err(fdtv->device, "unhandled CA message 0x%08x\n",
172 fdtv->ca_last_command); 170 fdtv->ca_last_command);
173 err = -EFAULT; 171 err = -EACCES;
174 } 172 }
175 return err; 173 return err;
176} 174}
@@ -184,7 +182,7 @@ static int fdtv_ca_ioctl(struct file *file, unsigned int cmd, void *arg)
184 182
185 switch (cmd) { 183 switch (cmd) {
186 case CA_RESET: 184 case CA_RESET:
187 err = fdtv_ca_reset(fdtv); 185 err = avc_ca_reset(fdtv);
188 break; 186 break;
189 case CA_GET_CAP: 187 case CA_GET_CAP:
190 err = fdtv_ca_get_caps(arg); 188 err = fdtv_ca_get_caps(arg);