aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset/interface.c
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2006-04-11 01:55:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-11 09:18:49 -0400
commit784d5858aac58c06608def862d73ae9a32f5ee23 (patch)
tree992ba2e122df6fc90a935dcc1629186bc7e168ac /drivers/isdn/gigaset/interface.c
parentec81b5e6294088dc4738d0e8c2316c0dc081215c (diff)
[PATCH] isdn4linux: Siemens Gigaset drivers: logging usage
With Hansjoerg Lipp <hjlipp@web.de> Improve error reporting of the Gigaset drivers, by using the dev_err/dev_warn/dev_info macros from device.h instead of err/warn/info from usb.h whereever possible. Also rename the private dbg macro to gig_dbg in order to avoid confusion with the macro of the same name in usb.h. Signed-off-by: Hansjoerg Lipp <hjlipp@web.de> Signed-off-by: Tilman Schmidt <tilman@imap.cc> Cc: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/interface.c')
-rw-r--r--drivers/isdn/gigaset/interface.c157
1 files changed, 80 insertions, 77 deletions
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index c225de9620b1..f3dce8c4831b 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -22,7 +22,7 @@ static int if_lock(struct cardstate *cs, int *arg)
22{ 22{
23 int cmd = *arg; 23 int cmd = *arg;
24 24
25 dbg(DEBUG_IF, "%u: if_lock (%d)", cs->minor_index, cmd); 25 gig_dbg(DEBUG_IF, "%u: if_lock (%d)", cs->minor_index, cmd);
26 26
27 if (cmd > 1) 27 if (cmd > 1)
28 return -EINVAL; 28 return -EINVAL;
@@ -42,12 +42,12 @@ static int if_lock(struct cardstate *cs, int *arg)
42 42
43 cs->waiting = 1; 43 cs->waiting = 1;
44 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_LOCK, 44 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_LOCK,
45 NULL, cmd, NULL)) { 45 NULL, cmd, NULL)) {
46 cs->waiting = 0; 46 cs->waiting = 0;
47 return -ENOMEM; 47 return -ENOMEM;
48 } 48 }
49 49
50 dbg(DEBUG_CMD, "scheduling IF_LOCK"); 50 gig_dbg(DEBUG_CMD, "scheduling IF_LOCK");
51 gigaset_schedule_event(cs); 51 gigaset_schedule_event(cs);
52 52
53 wait_event(cs->waitqueue, !cs->waiting); 53 wait_event(cs->waitqueue, !cs->waiting);
@@ -66,7 +66,7 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
66 static const unsigned compat[4] = GIG_COMPAT; 66 static const unsigned compat[4] = GIG_COMPAT;
67 unsigned cmd = arg[0]; 67 unsigned cmd = arg[0];
68 68
69 dbg(DEBUG_IF, "%u: if_version (%d)", cs->minor_index, cmd); 69 gig_dbg(DEBUG_IF, "%u: if_version (%d)", cs->minor_index, cmd);
70 70
71 switch (cmd) { 71 switch (cmd) {
72 case GIGVER_DRIVER: 72 case GIGVER_DRIVER:
@@ -78,12 +78,12 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
78 case GIGVER_FWBASE: 78 case GIGVER_FWBASE:
79 cs->waiting = 1; 79 cs->waiting = 1;
80 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_VER, 80 if (!gigaset_add_event(cs, &cs->at_state, EV_IF_VER,
81 NULL, 0, arg)) { 81 NULL, 0, arg)) {
82 cs->waiting = 0; 82 cs->waiting = 0;
83 return -ENOMEM; 83 return -ENOMEM;
84 } 84 }
85 85
86 dbg(DEBUG_CMD, "scheduling IF_VER"); 86 gig_dbg(DEBUG_CMD, "scheduling IF_VER");
87 gigaset_schedule_event(cs); 87 gigaset_schedule_event(cs);
88 88
89 wait_event(cs->waitqueue, !cs->waiting); 89 wait_event(cs->waitqueue, !cs->waiting);
@@ -99,7 +99,7 @@ static int if_version(struct cardstate *cs, unsigned arg[4])
99 99
100static int if_config(struct cardstate *cs, int *arg) 100static int if_config(struct cardstate *cs, int *arg)
101{ 101{
102 dbg(DEBUG_IF, "%u: if_config (%d)", cs->minor_index, *arg); 102 gig_dbg(DEBUG_IF, "%u: if_config (%d)", cs->minor_index, *arg);
103 103
104 if (*arg != 1) 104 if (*arg != 1)
105 return -EINVAL; 105 return -EINVAL;
@@ -117,7 +117,7 @@ static int if_config(struct cardstate *cs, int *arg)
117static int if_open(struct tty_struct *tty, struct file *filp); 117static int if_open(struct tty_struct *tty, struct file *filp);
118static void if_close(struct tty_struct *tty, struct file *filp); 118static void if_close(struct tty_struct *tty, struct file *filp);
119static int if_ioctl(struct tty_struct *tty, struct file *file, 119static int if_ioctl(struct tty_struct *tty, struct file *file,
120 unsigned int cmd, unsigned long arg); 120 unsigned int cmd, unsigned long arg);
121static int if_write_room(struct tty_struct *tty); 121static int if_write_room(struct tty_struct *tty);
122static int if_chars_in_buffer(struct tty_struct *tty); 122static int if_chars_in_buffer(struct tty_struct *tty);
123static void if_throttle(struct tty_struct *tty); 123static void if_throttle(struct tty_struct *tty);
@@ -125,9 +125,9 @@ static void if_unthrottle(struct tty_struct *tty);
125static void if_set_termios(struct tty_struct *tty, struct termios *old); 125static void if_set_termios(struct tty_struct *tty, struct termios *old);
126static int if_tiocmget(struct tty_struct *tty, struct file *file); 126static int if_tiocmget(struct tty_struct *tty, struct file *file);
127static int if_tiocmset(struct tty_struct *tty, struct file *file, 127static int if_tiocmset(struct tty_struct *tty, struct file *file,
128 unsigned int set, unsigned int clear); 128 unsigned int set, unsigned int clear);
129static int if_write(struct tty_struct *tty, 129static int if_write(struct tty_struct *tty,
130 const unsigned char *buf, int count); 130 const unsigned char *buf, int count);
131 131
132static struct tty_operations if_ops = { 132static struct tty_operations if_ops = {
133 .open = if_open, 133 .open = if_open,
@@ -151,8 +151,8 @@ static int if_open(struct tty_struct *tty, struct file *filp)
151 struct cardstate *cs; 151 struct cardstate *cs;
152 unsigned long flags; 152 unsigned long flags;
153 153
154 dbg(DEBUG_IF, "%d+%d: %s()", tty->driver->minor_start, tty->index, 154 gig_dbg(DEBUG_IF, "%d+%d: %s()",
155 __FUNCTION__); 155 tty->driver->minor_start, tty->index, __func__);
156 156
157 tty->driver_data = NULL; 157 tty->driver_data = NULL;
158 158
@@ -184,16 +184,16 @@ static void if_close(struct tty_struct *tty, struct file *filp)
184 184
185 cs = (struct cardstate *) tty->driver_data; 185 cs = (struct cardstate *) tty->driver_data;
186 if (!cs) { 186 if (!cs) {
187 err("cs==NULL in %s", __FUNCTION__); 187 err("cs==NULL in %s", __func__);
188 return; 188 return;
189 } 189 }
190 190
191 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 191 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
192 192
193 down(&cs->sem); 193 down(&cs->sem);
194 194
195 if (!cs->open_count) 195 if (!cs->open_count)
196 warn("%s: device not opened", __FUNCTION__); 196 warn("%s: device not opened", __func__);
197 else { 197 else {
198 if (!--cs->open_count) { 198 if (!--cs->open_count) {
199 spin_lock_irqsave(&cs->lock, flags); 199 spin_lock_irqsave(&cs->lock, flags);
@@ -206,7 +206,7 @@ static void if_close(struct tty_struct *tty, struct file *filp)
206} 206}
207 207
208static int if_ioctl(struct tty_struct *tty, struct file *file, 208static int if_ioctl(struct tty_struct *tty, struct file *file,
209 unsigned int cmd, unsigned long arg) 209 unsigned int cmd, unsigned long arg)
210{ 210{
211 struct cardstate *cs; 211 struct cardstate *cs;
212 int retval = -ENODEV; 212 int retval = -ENODEV;
@@ -216,17 +216,17 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
216 216
217 cs = (struct cardstate *) tty->driver_data; 217 cs = (struct cardstate *) tty->driver_data;
218 if (!cs) { 218 if (!cs) {
219 err("cs==NULL in %s", __FUNCTION__); 219 err("cs==NULL in %s", __func__);
220 return -ENODEV; 220 return -ENODEV;
221 } 221 }
222 222
223 dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __FUNCTION__, cmd); 223 gig_dbg(DEBUG_IF, "%u: %s(0x%x)", cs->minor_index, __func__, cmd);
224 224
225 if (down_interruptible(&cs->sem)) 225 if (down_interruptible(&cs->sem))
226 return -ERESTARTSYS; // FIXME -EINTR? 226 return -ERESTARTSYS; // FIXME -EINTR?
227 227
228 if (!cs->open_count) 228 if (!cs->open_count)
229 warn("%s: device not opened", __FUNCTION__); 229 warn("%s: device not opened", __func__);
230 else { 230 else {
231 retval = 0; 231 retval = 0;
232 switch (cmd) { 232 switch (cmd) {
@@ -247,33 +247,33 @@ static int if_ioctl(struct tty_struct *tty, struct file *file,
247 case GIGASET_BRKCHARS: 247 case GIGASET_BRKCHARS:
248 //FIXME test if MS_LOCKED 248 //FIXME test if MS_LOCKED
249 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS", 249 gigaset_dbg_buffer(DEBUG_IF, "GIGASET_BRKCHARS",
250 6, (const unsigned char *) arg, 1); 250 6, (const unsigned char *) arg, 1);
251 if (!atomic_read(&cs->connected)) { 251 if (!atomic_read(&cs->connected)) {
252 dbg(DEBUG_ANY, 252 gig_dbg(DEBUG_ANY,
253 "can't communicate with unplugged device"); 253 "can't communicate with unplugged device");
254 retval = -ENODEV; 254 retval = -ENODEV;
255 break; 255 break;
256 } 256 }
257 retval = copy_from_user(&buf, 257 retval = copy_from_user(&buf,
258 (const unsigned char __user *) arg, 6) 258 (const unsigned char __user *) arg, 6)
259 ? -EFAULT : 0; 259 ? -EFAULT : 0;
260 if (retval >= 0) 260 if (retval >= 0)
261 retval = cs->ops->brkchars(cs, buf); 261 retval = cs->ops->brkchars(cs, buf);
262 break; 262 break;
263 case GIGASET_VERSION: 263 case GIGASET_VERSION:
264 retval = copy_from_user(version, 264 retval = copy_from_user(version,
265 (unsigned __user *) arg, 265 (unsigned __user *) arg, sizeof version)
266 sizeof version) ? -EFAULT : 0; 266 ? -EFAULT : 0;
267 if (retval >= 0) 267 if (retval >= 0)
268 retval = if_version(cs, version); 268 retval = if_version(cs, version);
269 if (retval >= 0) 269 if (retval >= 0)
270 retval = copy_to_user((unsigned __user *) arg, 270 retval = copy_to_user((unsigned __user *) arg,
271 version, sizeof version) 271 version, sizeof version)
272 ? -EFAULT : 0; 272 ? -EFAULT : 0;
273 break; 273 break;
274 default: 274 default:
275 dbg(DEBUG_ANY, "%s: arg not supported - 0x%04x", 275 gig_dbg(DEBUG_ANY, "%s: arg not supported - 0x%04x",
276 __FUNCTION__, cmd); 276 __func__, cmd);
277 retval = -ENOIOCTLCMD; 277 retval = -ENOIOCTLCMD;
278 } 278 }
279 } 279 }
@@ -290,11 +290,11 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)
290 290
291 cs = (struct cardstate *) tty->driver_data; 291 cs = (struct cardstate *) tty->driver_data;
292 if (!cs) { 292 if (!cs) {
293 err("cs==NULL in %s", __FUNCTION__); 293 err("cs==NULL in %s", __func__);
294 return -ENODEV; 294 return -ENODEV;
295 } 295 }
296 296
297 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 297 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
298 298
299 if (down_interruptible(&cs->sem)) 299 if (down_interruptible(&cs->sem))
300 return -ERESTARTSYS; // FIXME -EINTR? 300 return -ERESTARTSYS; // FIXME -EINTR?
@@ -308,7 +308,7 @@ static int if_tiocmget(struct tty_struct *tty, struct file *file)
308} 308}
309 309
310static int if_tiocmset(struct tty_struct *tty, struct file *file, 310static int if_tiocmset(struct tty_struct *tty, struct file *file,
311 unsigned int set, unsigned int clear) 311 unsigned int set, unsigned int clear)
312{ 312{
313 struct cardstate *cs; 313 struct cardstate *cs;
314 int retval; 314 int retval;
@@ -316,18 +316,18 @@ static int if_tiocmset(struct tty_struct *tty, struct file *file,
316 316
317 cs = (struct cardstate *) tty->driver_data; 317 cs = (struct cardstate *) tty->driver_data;
318 if (!cs) { 318 if (!cs) {
319 err("cs==NULL in %s", __FUNCTION__); 319 err("cs==NULL in %s", __func__);
320 return -ENODEV; 320 return -ENODEV;
321 } 321 }
322 322
323 dbg(DEBUG_IF, 323 gig_dbg(DEBUG_IF, "%u: %s(0x%x, 0x%x)",
324 "%u: %s(0x%x, 0x%x)", cs->minor_index, __FUNCTION__, set, clear); 324 cs->minor_index, __func__, set, clear);
325 325
326 if (down_interruptible(&cs->sem)) 326 if (down_interruptible(&cs->sem))
327 return -ERESTARTSYS; // FIXME -EINTR? 327 return -ERESTARTSYS; // FIXME -EINTR?
328 328
329 if (!atomic_read(&cs->connected)) { 329 if (!atomic_read(&cs->connected)) {
330 dbg(DEBUG_ANY, "can't communicate with unplugged device"); 330 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
331 retval = -ENODEV; 331 retval = -ENODEV;
332 } else { 332 } else {
333 mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR); 333 mc = (cs->control_state | set) & ~clear & (TIOCM_RTS|TIOCM_DTR);
@@ -347,26 +347,26 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
347 347
348 cs = (struct cardstate *) tty->driver_data; 348 cs = (struct cardstate *) tty->driver_data;
349 if (!cs) { 349 if (!cs) {
350 err("cs==NULL in %s", __FUNCTION__); 350 err("cs==NULL in %s", __func__);
351 return -ENODEV; 351 return -ENODEV;
352 } 352 }
353 353
354 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 354 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
355 355
356 if (down_interruptible(&cs->sem)) 356 if (down_interruptible(&cs->sem))
357 return -ERESTARTSYS; // FIXME -EINTR? 357 return -ERESTARTSYS; // FIXME -EINTR?
358 358
359 if (!cs->open_count) 359 if (!cs->open_count)
360 warn("%s: device not opened", __FUNCTION__); 360 warn("%s: device not opened", __func__);
361 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 361 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
362 warn("can't write to unlocked device"); 362 warn("can't write to unlocked device");
363 retval = -EBUSY; 363 retval = -EBUSY;
364 } else if (!atomic_read(&cs->connected)) { 364 } else if (!atomic_read(&cs->connected)) {
365 dbg(DEBUG_ANY, "can't write to unplugged device"); 365 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
366 retval = -EBUSY; //FIXME 366 retval = -EBUSY; //FIXME
367 } else { 367 } else {
368 retval = cs->ops->write_cmd(cs, buf, count, 368 retval = cs->ops->write_cmd(cs, buf, count,
369 &cs->if_wake_tasklet); 369 &cs->if_wake_tasklet);
370 } 370 }
371 371
372 up(&cs->sem); 372 up(&cs->sem);
@@ -381,22 +381,22 @@ static int if_write_room(struct tty_struct *tty)
381 381
382 cs = (struct cardstate *) tty->driver_data; 382 cs = (struct cardstate *) tty->driver_data;
383 if (!cs) { 383 if (!cs) {
384 err("cs==NULL in %s", __FUNCTION__); 384 err("cs==NULL in %s", __func__);
385 return -ENODEV; 385 return -ENODEV;
386 } 386 }
387 387
388 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 388 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
389 389
390 if (down_interruptible(&cs->sem)) 390 if (down_interruptible(&cs->sem))
391 return -ERESTARTSYS; // FIXME -EINTR? 391 return -ERESTARTSYS; // FIXME -EINTR?
392 392
393 if (!cs->open_count) 393 if (!cs->open_count)
394 warn("%s: device not opened", __FUNCTION__); 394 warn("%s: device not opened", __func__);
395 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 395 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
396 warn("can't write to unlocked device"); 396 warn("can't write to unlocked device");
397 retval = -EBUSY; //FIXME 397 retval = -EBUSY; //FIXME
398 } else if (!atomic_read(&cs->connected)) { 398 } else if (!atomic_read(&cs->connected)) {
399 dbg(DEBUG_ANY, "can't write to unplugged device"); 399 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
400 retval = -EBUSY; //FIXME 400 retval = -EBUSY; //FIXME
401 } else 401 } else
402 retval = cs->ops->write_room(cs); 402 retval = cs->ops->write_room(cs);
@@ -413,22 +413,22 @@ static int if_chars_in_buffer(struct tty_struct *tty)
413 413
414 cs = (struct cardstate *) tty->driver_data; 414 cs = (struct cardstate *) tty->driver_data;
415 if (!cs) { 415 if (!cs) {
416 err("cs==NULL in %s", __FUNCTION__); 416 err("cs==NULL in %s", __func__);
417 return -ENODEV; 417 return -ENODEV;
418 } 418 }
419 419
420 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 420 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
421 421
422 if (down_interruptible(&cs->sem)) 422 if (down_interruptible(&cs->sem))
423 return -ERESTARTSYS; // FIXME -EINTR? 423 return -ERESTARTSYS; // FIXME -EINTR?
424 424
425 if (!cs->open_count) 425 if (!cs->open_count)
426 warn("%s: device not opened", __FUNCTION__); 426 warn("%s: device not opened", __func__);
427 else if (atomic_read(&cs->mstate) != MS_LOCKED) { 427 else if (atomic_read(&cs->mstate) != MS_LOCKED) {
428 warn("can't write to unlocked device"); 428 warn("can't write to unlocked device");
429 retval = -EBUSY; 429 retval = -EBUSY;
430 } else if (!atomic_read(&cs->connected)) { 430 } else if (!atomic_read(&cs->connected)) {
431 dbg(DEBUG_ANY, "can't write to unplugged device"); 431 gig_dbg(DEBUG_ANY, "can't write to unplugged device");
432 retval = -EBUSY; //FIXME 432 retval = -EBUSY; //FIXME
433 } else 433 } else
434 retval = cs->ops->chars_in_buffer(cs); 434 retval = cs->ops->chars_in_buffer(cs);
@@ -444,16 +444,16 @@ static void if_throttle(struct tty_struct *tty)
444 444
445 cs = (struct cardstate *) tty->driver_data; 445 cs = (struct cardstate *) tty->driver_data;
446 if (!cs) { 446 if (!cs) {
447 err("cs==NULL in %s", __FUNCTION__); 447 err("cs==NULL in %s", __func__);
448 return; 448 return;
449 } 449 }
450 450
451 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 451 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
452 452
453 down(&cs->sem); 453 down(&cs->sem);
454 454
455 if (!cs->open_count) 455 if (!cs->open_count)
456 warn("%s: device not opened", __FUNCTION__); 456 warn("%s: device not opened", __func__);
457 else { 457 else {
458 //FIXME 458 //FIXME
459 } 459 }
@@ -467,16 +467,16 @@ static void if_unthrottle(struct tty_struct *tty)
467 467
468 cs = (struct cardstate *) tty->driver_data; 468 cs = (struct cardstate *) tty->driver_data;
469 if (!cs) { 469 if (!cs) {
470 err("cs==NULL in %s", __FUNCTION__); 470 err("cs==NULL in %s", __func__);
471 return; 471 return;
472 } 472 }
473 473
474 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 474 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
475 475
476 down(&cs->sem); 476 down(&cs->sem);
477 477
478 if (!cs->open_count) 478 if (!cs->open_count)
479 warn("%s: device not opened", __FUNCTION__); 479 warn("%s: device not opened", __func__);
480 else { 480 else {
481 //FIXME 481 //FIXME
482 } 482 }
@@ -494,21 +494,21 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
494 494
495 cs = (struct cardstate *) tty->driver_data; 495 cs = (struct cardstate *) tty->driver_data;
496 if (!cs) { 496 if (!cs) {
497 err("cs==NULL in %s", __FUNCTION__); 497 err("cs==NULL in %s", __func__);
498 return; 498 return;
499 } 499 }
500 500
501 dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __FUNCTION__); 501 gig_dbg(DEBUG_IF, "%u: %s()", cs->minor_index, __func__);
502 502
503 down(&cs->sem); 503 down(&cs->sem);
504 504
505 if (!cs->open_count) { 505 if (!cs->open_count) {
506 warn("%s: device not opened", __FUNCTION__); 506 warn("%s: device not opened", __func__);
507 goto out; 507 goto out;
508 } 508 }
509 509
510 if (!atomic_read(&cs->connected)) { 510 if (!atomic_read(&cs->connected)) {
511 dbg(DEBUG_ANY, "can't communicate with unplugged device"); 511 gig_dbg(DEBUG_ANY, "can't communicate with unplugged device");
512 goto out; 512 goto out;
513 } 513 }
514 514
@@ -516,8 +516,8 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
516 iflag = tty->termios->c_iflag; 516 iflag = tty->termios->c_iflag;
517 cflag = tty->termios->c_cflag; 517 cflag = tty->termios->c_cflag;
518 old_cflag = old ? old->c_cflag : cflag; //FIXME? 518 old_cflag = old ? old->c_cflag : cflag; //FIXME?
519 dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x", cs->minor_index, 519 gig_dbg(DEBUG_IF, "%u: iflag %x cflag %x old %x",
520 iflag, cflag, old_cflag); 520 cs->minor_index, iflag, cflag, old_cflag);
521 521
522 /* get a local copy of the current port settings */ 522 /* get a local copy of the current port settings */
523 control_state = cs->control_state; 523 control_state = cs->control_state;
@@ -529,14 +529,15 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
529 * Premature optimization is the root of all evil. 529 * Premature optimization is the root of all evil.
530 */ 530 */
531 531
532 /* reassert DTR and (maybe) RTS on transition from B0 */ 532 /* reassert DTR and (maybe) RTS on transition from B0 */
533 if ((old_cflag & CBAUD) == B0) { 533 if ((old_cflag & CBAUD) == B0) {
534 new_state = control_state | TIOCM_DTR; 534 new_state = control_state | TIOCM_DTR;
535 /* don't set RTS if using hardware flow control */ 535 /* don't set RTS if using hardware flow control */
536 if (!(old_cflag & CRTSCTS)) 536 if (!(old_cflag & CRTSCTS))
537 new_state |= TIOCM_RTS; 537 new_state |= TIOCM_RTS;
538 dbg(DEBUG_IF, "%u: from B0 - set DTR%s", cs->minor_index, 538 gig_dbg(DEBUG_IF, "%u: from B0 - set DTR%s",
539 (new_state & TIOCM_RTS) ? " only" : "/RTS"); 539 cs->minor_index,
540 (new_state & TIOCM_RTS) ? " only" : "/RTS");
540 cs->ops->set_modem_ctrl(cs, control_state, new_state); 541 cs->ops->set_modem_ctrl(cs, control_state, new_state);
541 control_state = new_state; 542 control_state = new_state;
542 } 543 }
@@ -545,7 +546,7 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
545 546
546 if ((cflag & CBAUD) == B0) { 547 if ((cflag & CBAUD) == B0) {
547 /* Drop RTS and DTR */ 548 /* Drop RTS and DTR */
548 dbg(DEBUG_IF, "%u: to B0 - drop DTR/RTS", cs->minor_index); 549 gig_dbg(DEBUG_IF, "%u: to B0 - drop DTR/RTS", cs->minor_index);
549 new_state = control_state & ~(TIOCM_DTR | TIOCM_RTS); 550 new_state = control_state & ~(TIOCM_DTR | TIOCM_RTS);
550 cs->ops->set_modem_ctrl(cs, control_state, new_state); 551 cs->ops->set_modem_ctrl(cs, control_state, new_state);
551 control_state = new_state; 552 control_state = new_state;
@@ -565,14 +566,16 @@ static void if_set_termios(struct tty_struct *tty, struct termios *old)
565 * Just do what we have seen with SniffUSB on Win98. 566 * Just do what we have seen with SniffUSB on Win98.
566 */ 567 */
567 /* Drop DTR/RTS if no flow control otherwise assert */ 568 /* Drop DTR/RTS if no flow control otherwise assert */
568 dbg(DEBUG_IF, "%u: control_state %x", cs->minor_index, control_state); 569 gig_dbg(DEBUG_IF, "%u: control_state %x",
570 cs->minor_index, control_state);
569 new_state = control_state; 571 new_state = control_state;
570 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS)) 572 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS))
571 new_state |= TIOCM_DTR | TIOCM_RTS; 573 new_state |= TIOCM_DTR | TIOCM_RTS;
572 else 574 else
573 new_state &= ~(TIOCM_DTR | TIOCM_RTS); 575 new_state &= ~(TIOCM_DTR | TIOCM_RTS);
574 if (new_state != control_state) { 576 if (new_state != control_state) {
575 dbg(DEBUG_IF, "%u: new_state %x", cs->minor_index, new_state); 577 gig_dbg(DEBUG_IF, "%u: new_state %x",
578 cs->minor_index, new_state);
576 gigaset_set_modem_ctrl(cs, control_state, new_state); 579 gigaset_set_modem_ctrl(cs, control_state, new_state);
577 control_state = new_state; 580 control_state = new_state;
578 } 581 }
@@ -598,7 +601,7 @@ static void if_wake(unsigned long data)
598 601
599 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && 602 if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
600 tty->ldisc.write_wakeup) { 603 tty->ldisc.write_wakeup) {
601 dbg(DEBUG_IF, "write wakeup call"); 604 gig_dbg(DEBUG_IF, "write wakeup call");
602 tty->ldisc.write_wakeup(tty); 605 tty->ldisc.write_wakeup(tty);
603 } 606 }
604 607
@@ -633,14 +636,14 @@ void gigaset_if_free(struct cardstate *cs)
633} 636}
634 637
635void gigaset_if_receive(struct cardstate *cs, 638void gigaset_if_receive(struct cardstate *cs,
636 unsigned char *buffer, size_t len) 639 unsigned char *buffer, size_t len)
637{ 640{
638 unsigned long flags; 641 unsigned long flags;
639 struct tty_struct *tty; 642 struct tty_struct *tty;
640 643
641 spin_lock_irqsave(&cs->lock, flags); 644 spin_lock_irqsave(&cs->lock, flags);
642 if ((tty = cs->tty) == NULL) 645 if ((tty = cs->tty) == NULL)
643 dbg(DEBUG_ANY, "receive on closed device"); 646 gig_dbg(DEBUG_ANY, "receive on closed device");
644 else { 647 else {
645 tty_buffer_request_room(tty, len); 648 tty_buffer_request_room(tty, len);
646 tty_insert_flip_string(tty, buffer, len); 649 tty_insert_flip_string(tty, buffer, len);
@@ -653,13 +656,13 @@ EXPORT_SYMBOL_GPL(gigaset_if_receive);
653/* gigaset_if_initdriver 656/* gigaset_if_initdriver
654 * Initialize tty interface. 657 * Initialize tty interface.
655 * parameters: 658 * parameters:
656 * drv Driver 659 * drv Driver
657 * procname Name of the driver (e.g. for /proc/tty/drivers) 660 * procname Name of the driver (e.g. for /proc/tty/drivers)
658 * devname Name of the device files (prefix without minor number) 661 * devname Name of the device files (prefix without minor number)
659 * devfsname Devfs name of the device files without %d 662 * devfsname Devfs name of the device files without %d
660 */ 663 */
661void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname, 664void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
662 const char *devname, const char *devfsname) 665 const char *devname, const char *devfsname)
663{ 666{
664 unsigned minors = drv->minors; 667 unsigned minors = drv->minors;
665 int ret; 668 int ret;
@@ -694,7 +697,7 @@ void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
694 warn("failed to register tty driver (error %d)", ret); 697 warn("failed to register tty driver (error %d)", ret);
695 goto error; 698 goto error;
696 } 699 }
697 dbg(DEBUG_IF, "tty driver initialized"); 700 gig_dbg(DEBUG_IF, "tty driver initialized");
698 drv->have_tty = 1; 701 drv->have_tty = 1;
699 return; 702 return;
700 703