aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/i4l.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/gigaset/i4l.c')
-rw-r--r--drivers/isdn/gigaset/i4l.c56
1 files changed, 33 insertions, 23 deletions
diff --git a/drivers/isdn/gigaset/i4l.c b/drivers/isdn/gigaset/i4l.c
index 9e089f06a942..3c127a8cbaf2 100644
--- a/drivers/isdn/gigaset/i4l.c
+++ b/drivers/isdn/gigaset/i4l.c
@@ -46,7 +46,8 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
46 return -ENODEV; 46 return -ENODEV;
47 } 47 }
48 if (channel < 0 || channel >= cs->channels) { 48 if (channel < 0 || channel >= cs->channels) {
49 err("%s: invalid channel ID (%d)", __func__, channel); 49 dev_err(cs->dev, "%s: invalid channel ID (%d)\n",
50 __func__, channel);
50 return -ENODEV; 51 return -ENODEV;
51 } 52 }
52 bcs = &cs->bcs[channel]; 53 bcs = &cs->bcs[channel];
@@ -58,11 +59,13 @@ static int writebuf_from_LL(int driverID, int channel, int ack,
58 59
59 if (!len) { 60 if (!len) {
60 if (ack) 61 if (ack)
61 notice("%s: not ACKing empty packet", __func__); 62 dev_notice(cs->dev, "%s: not ACKing empty packet\n",
63 __func__);
62 return 0; 64 return 0;
63 } 65 }
64 if (len > MAX_BUF_SIZE) { 66 if (len > MAX_BUF_SIZE) {
65 err("%s: packet too large (%d bytes)", __func__, len); 67 dev_err(cs->dev, "%s: packet too large (%d bytes)\n",
68 __func__, len);
66 return -EINVAL; 69 return -EINVAL;
67 } 70 }
68 71
@@ -116,8 +119,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
116 gigaset_debugdrivers(); 119 gigaset_debugdrivers();
117 120
118 if (!cs) { 121 if (!cs) {
119 warn("LL tried to access unknown device with nr. %d", 122 err("%s: invalid driver ID (%d)", __func__, cntrl->driver);
120 cntrl->driver);
121 return -ENODEV; 123 return -ENODEV;
122 } 124 }
123 125
@@ -126,7 +128,7 @@ static int command_from_LL(isdn_ctrl *cntrl)
126 gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)", 128 gig_dbg(DEBUG_ANY, "ISDN_CMD_IOCTL (driver: %d, arg: %ld)",
127 cntrl->driver, cntrl->arg); 129 cntrl->driver, cntrl->arg);
128 130
129 warn("ISDN_CMD_IOCTL is not supported."); 131 dev_warn(cs->dev, "ISDN_CMD_IOCTL not supported\n");
130 return -EINVAL; 132 return -EINVAL;
131 133
132 case ISDN_CMD_DIAL: 134 case ISDN_CMD_DIAL:
@@ -138,22 +140,23 @@ static int command_from_LL(isdn_ctrl *cntrl)
138 cntrl->parm.setup.si1, cntrl->parm.setup.si2); 140 cntrl->parm.setup.si1, cntrl->parm.setup.si2);
139 141
140 if (cntrl->arg >= cs->channels) { 142 if (cntrl->arg >= cs->channels) {
141 err("ISDN_CMD_DIAL: invalid channel (%d)", 143 dev_err(cs->dev,
142 (int) cntrl->arg); 144 "ISDN_CMD_DIAL: invalid channel (%d)\n",
145 (int) cntrl->arg);
143 return -EINVAL; 146 return -EINVAL;
144 } 147 }
145 148
146 bcs = cs->bcs + cntrl->arg; 149 bcs = cs->bcs + cntrl->arg;
147 150
148 if (!gigaset_get_channel(bcs)) { 151 if (!gigaset_get_channel(bcs)) {
149 err("ISDN_CMD_DIAL: channel not free"); 152 dev_err(cs->dev, "ISDN_CMD_DIAL: channel not free\n");
150 return -EBUSY; 153 return -EBUSY;
151 } 154 }
152 155
153 sp = kmalloc(sizeof *sp, GFP_ATOMIC); 156 sp = kmalloc(sizeof *sp, GFP_ATOMIC);
154 if (!sp) { 157 if (!sp) {
155 gigaset_free_channel(bcs); 158 gigaset_free_channel(bcs);
156 err("ISDN_CMD_DIAL: out of memory"); 159 dev_err(cs->dev, "ISDN_CMD_DIAL: out of memory\n");
157 return -ENOMEM; 160 return -ENOMEM;
158 } 161 }
159 *sp = cntrl->parm.setup; 162 *sp = cntrl->parm.setup;
@@ -173,8 +176,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
173 gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD"); 176 gig_dbg(DEBUG_ANY, "ISDN_CMD_ACCEPTD");
174 177
175 if (cntrl->arg >= cs->channels) { 178 if (cntrl->arg >= cs->channels) {
176 err("ISDN_CMD_ACCEPTD: invalid channel (%d)", 179 dev_err(cs->dev,
177 (int) cntrl->arg); 180 "ISDN_CMD_ACCEPTD: invalid channel (%d)\n",
181 (int) cntrl->arg);
178 return -EINVAL; 182 return -EINVAL;
179 } 183 }
180 184
@@ -196,8 +200,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
196 (int) cntrl->arg); 200 (int) cntrl->arg);
197 201
198 if (cntrl->arg >= cs->channels) { 202 if (cntrl->arg >= cs->channels) {
199 err("ISDN_CMD_HANGUP: invalid channel (%u)", 203 dev_err(cs->dev,
200 (unsigned) cntrl->arg); 204 "ISDN_CMD_HANGUP: invalid channel (%d)\n",
205 (int) cntrl->arg);
201 return -EINVAL; 206 return -EINVAL;
202 } 207 }
203 208
@@ -224,8 +229,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
224 cntrl->arg & 0xff, (cntrl->arg >> 8)); 229 cntrl->arg & 0xff, (cntrl->arg >> 8));
225 230
226 if ((cntrl->arg & 0xff) >= cs->channels) { 231 if ((cntrl->arg & 0xff) >= cs->channels) {
227 err("ISDN_CMD_SETL2: invalid channel (%u)", 232 dev_err(cs->dev,
228 (unsigned) cntrl->arg & 0xff); 233 "ISDN_CMD_SETL2: invalid channel (%d)\n",
234 (int) cntrl->arg & 0xff);
229 return -EINVAL; 235 return -EINVAL;
230 } 236 }
231 237
@@ -244,14 +250,16 @@ static int command_from_LL(isdn_ctrl *cntrl)
244 cntrl->arg & 0xff, (cntrl->arg >> 8)); 250 cntrl->arg & 0xff, (cntrl->arg >> 8));
245 251
246 if ((cntrl->arg & 0xff) >= cs->channels) { 252 if ((cntrl->arg & 0xff) >= cs->channels) {
247 err("ISDN_CMD_SETL3: invalid channel (%u)", 253 dev_err(cs->dev,
248 (unsigned) cntrl->arg & 0xff); 254 "ISDN_CMD_SETL3: invalid channel (%d)\n",
255 (int) cntrl->arg & 0xff);
249 return -EINVAL; 256 return -EINVAL;
250 } 257 }
251 258
252 if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) { 259 if (cntrl->arg >> 8 != ISDN_PROTO_L3_TRANS) {
253 err("ISDN_CMD_SETL3: invalid protocol %lu", 260 dev_err(cs->dev,
254 cntrl->arg >> 8); 261 "ISDN_CMD_SETL3: invalid protocol %lu\n",
262 cntrl->arg >> 8);
255 return -EINVAL; 263 return -EINVAL;
256 } 264 }
257 265
@@ -262,8 +270,9 @@ static int command_from_LL(isdn_ctrl *cntrl)
262 case ISDN_CMD_ALERT: 270 case ISDN_CMD_ALERT:
263 gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME 271 gig_dbg(DEBUG_ANY, "ISDN_CMD_ALERT"); //FIXME
264 if (cntrl->arg >= cs->channels) { 272 if (cntrl->arg >= cs->channels) {
265 err("ISDN_CMD_ALERT: invalid channel (%d)", 273 dev_err(cs->dev,
266 (int) cntrl->arg); 274 "ISDN_CMD_ALERT: invalid channel (%d)\n",
275 (int) cntrl->arg);
267 return -EINVAL; 276 return -EINVAL;
268 } 277 }
269 //bcs = cs->bcs + cntrl->arg; 278 //bcs = cs->bcs + cntrl->arg;
@@ -295,7 +304,8 @@ static int command_from_LL(isdn_ctrl *cntrl)
295 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL"); 304 gig_dbg(DEBUG_ANY, "ISDN_CMD_GETSIL");
296 break; 305 break;
297 default: 306 default:
298 err("unknown command %d from LL", cntrl->command); 307 dev_err(cs->dev, "unknown command %d from LL\n",
308 cntrl->command);
299 return -EINVAL; 309 return -EINVAL;
300 } 310 }
301 311