aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2006-12-04 09:40:07 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2006-12-04 09:40:07 -0500
commit520a4e3728c214db6e91ade7b70443c2b9382de0 (patch)
tree727464527455bd0e25770e9861112e079f973625 /drivers/s390/char
parent3902e47628dcaf79b2c7a6a59f6978d968eff288 (diff)
[S390] 3215 device locking.
Remove lock pointer from 3215 device structure. Use get_ccwdev_lock for each use of the lock in the ccw-device structure. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/con3215.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index d7de175d53f0..c9321b920e90 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -299,14 +299,14 @@ raw3215_timeout(unsigned long __data)
299 struct raw3215_info *raw = (struct raw3215_info *) __data; 299 struct raw3215_info *raw = (struct raw3215_info *) __data;
300 unsigned long flags; 300 unsigned long flags;
301 301
302 spin_lock_irqsave(raw->lock, flags); 302 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
303 if (raw->flags & RAW3215_TIMER_RUNS) { 303 if (raw->flags & RAW3215_TIMER_RUNS) {
304 del_timer(&raw->timer); 304 del_timer(&raw->timer);
305 raw->flags &= ~RAW3215_TIMER_RUNS; 305 raw->flags &= ~RAW3215_TIMER_RUNS;
306 raw3215_mk_write_req(raw); 306 raw3215_mk_write_req(raw);
307 raw3215_start_io(raw); 307 raw3215_start_io(raw);
308 } 308 }
309 spin_unlock_irqrestore(raw->lock, flags); 309 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
310} 310}
311 311
312/* 312/*
@@ -355,10 +355,10 @@ raw3215_tasklet(void *data)
355 unsigned long flags; 355 unsigned long flags;
356 356
357 raw = (struct raw3215_info *) data; 357 raw = (struct raw3215_info *) data;
358 spin_lock_irqsave(raw->lock, flags); 358 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
359 raw3215_mk_write_req(raw); 359 raw3215_mk_write_req(raw);
360 raw3215_try_io(raw); 360 raw3215_try_io(raw);
361 spin_unlock_irqrestore(raw->lock, flags); 361 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
362 /* Check for pending message from raw3215_irq */ 362 /* Check for pending message from raw3215_irq */
363 if (raw->message != NULL) { 363 if (raw->message != NULL) {
364 printk(raw->message, raw->msg_dstat, raw->msg_cstat); 364 printk(raw->message, raw->msg_dstat, raw->msg_cstat);
@@ -512,9 +512,9 @@ raw3215_make_room(struct raw3215_info *raw, unsigned int length)
512 if (RAW3215_BUFFER_SIZE - raw->count >= length) 512 if (RAW3215_BUFFER_SIZE - raw->count >= length)
513 break; 513 break;
514 /* there might be another cpu waiting for the lock */ 514 /* there might be another cpu waiting for the lock */
515 spin_unlock(raw->lock); 515 spin_unlock(get_ccwdev_lock(raw->cdev));
516 udelay(100); 516 udelay(100);
517 spin_lock(raw->lock); 517 spin_lock(get_ccwdev_lock(raw->cdev));
518 } 518 }
519} 519}
520 520
@@ -528,7 +528,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length)
528 int c, count; 528 int c, count;
529 529
530 while (length > 0) { 530 while (length > 0) {
531 spin_lock_irqsave(raw->lock, flags); 531 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
532 count = (length > RAW3215_BUFFER_SIZE) ? 532 count = (length > RAW3215_BUFFER_SIZE) ?
533 RAW3215_BUFFER_SIZE : length; 533 RAW3215_BUFFER_SIZE : length;
534 length -= count; 534 length -= count;
@@ -555,7 +555,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length)
555 /* start or queue request */ 555 /* start or queue request */
556 raw3215_try_io(raw); 556 raw3215_try_io(raw);
557 } 557 }
558 spin_unlock_irqrestore(raw->lock, flags); 558 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
559 } 559 }
560} 560}
561 561
@@ -568,7 +568,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch)
568 unsigned long flags; 568 unsigned long flags;
569 unsigned int length, i; 569 unsigned int length, i;
570 570
571 spin_lock_irqsave(raw->lock, flags); 571 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
572 if (ch == '\t') { 572 if (ch == '\t') {
573 length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE); 573 length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE);
574 raw->line_pos += length; 574 raw->line_pos += length;
@@ -592,7 +592,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch)
592 /* start or queue request */ 592 /* start or queue request */
593 raw3215_try_io(raw); 593 raw3215_try_io(raw);
594 } 594 }
595 spin_unlock_irqrestore(raw->lock, flags); 595 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
596} 596}
597 597
598/* 598/*
@@ -604,13 +604,13 @@ raw3215_flush_buffer(struct raw3215_info *raw)
604{ 604{
605 unsigned long flags; 605 unsigned long flags;
606 606
607 spin_lock_irqsave(raw->lock, flags); 607 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
608 if (raw->count > 0) { 608 if (raw->count > 0) {
609 raw->flags |= RAW3215_FLUSHING; 609 raw->flags |= RAW3215_FLUSHING;
610 raw3215_try_io(raw); 610 raw3215_try_io(raw);
611 raw->flags &= ~RAW3215_FLUSHING; 611 raw->flags &= ~RAW3215_FLUSHING;
612 } 612 }
613 spin_unlock_irqrestore(raw->lock, flags); 613 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
614} 614}
615 615
616/* 616/*
@@ -625,9 +625,9 @@ raw3215_startup(struct raw3215_info *raw)
625 return 0; 625 return 0;
626 raw->line_pos = 0; 626 raw->line_pos = 0;
627 raw->flags |= RAW3215_ACTIVE; 627 raw->flags |= RAW3215_ACTIVE;
628 spin_lock_irqsave(raw->lock, flags); 628 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
629 raw3215_try_io(raw); 629 raw3215_try_io(raw);
630 spin_unlock_irqrestore(raw->lock, flags); 630 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
631 631
632 return 0; 632 return 0;
633} 633}
@@ -644,21 +644,21 @@ raw3215_shutdown(struct raw3215_info *raw)
644 if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED)) 644 if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED))
645 return; 645 return;
646 /* Wait for outstanding requests, then free irq */ 646 /* Wait for outstanding requests, then free irq */
647 spin_lock_irqsave(raw->lock, flags); 647 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
648 if ((raw->flags & RAW3215_WORKING) || 648 if ((raw->flags & RAW3215_WORKING) ||
649 raw->queued_write != NULL || 649 raw->queued_write != NULL ||
650 raw->queued_read != NULL) { 650 raw->queued_read != NULL) {
651 raw->flags |= RAW3215_CLOSING; 651 raw->flags |= RAW3215_CLOSING;
652 add_wait_queue(&raw->empty_wait, &wait); 652 add_wait_queue(&raw->empty_wait, &wait);
653 set_current_state(TASK_INTERRUPTIBLE); 653 set_current_state(TASK_INTERRUPTIBLE);
654 spin_unlock_irqrestore(raw->lock, flags); 654 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
655 schedule(); 655 schedule();
656 spin_lock_irqsave(raw->lock, flags); 656 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
657 remove_wait_queue(&raw->empty_wait, &wait); 657 remove_wait_queue(&raw->empty_wait, &wait);
658 set_current_state(TASK_RUNNING); 658 set_current_state(TASK_RUNNING);
659 raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING); 659 raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING);
660 } 660 }
661 spin_unlock_irqrestore(raw->lock, flags); 661 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
662} 662}
663 663
664static int 664static int
@@ -686,7 +686,6 @@ raw3215_probe (struct ccw_device *cdev)
686 } 686 }
687 687
688 raw->cdev = cdev; 688 raw->cdev = cdev;
689 raw->lock = get_ccwdev_lock(cdev);
690 raw->inbuf = (char *) raw + sizeof(struct raw3215_info); 689 raw->inbuf = (char *) raw + sizeof(struct raw3215_info);
691 memset(raw, 0, sizeof(struct raw3215_info)); 690 memset(raw, 0, sizeof(struct raw3215_info));
692 raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, 691 raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE,
@@ -809,9 +808,9 @@ con3215_unblank(void)
809 unsigned long flags; 808 unsigned long flags;
810 809
811 raw = raw3215[0]; /* console 3215 is the first one */ 810 raw = raw3215[0]; /* console 3215 is the first one */
812 spin_lock_irqsave(raw->lock, flags); 811 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
813 raw3215_make_room(raw, RAW3215_BUFFER_SIZE); 812 raw3215_make_room(raw, RAW3215_BUFFER_SIZE);
814 spin_unlock_irqrestore(raw->lock, flags); 813 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
815} 814}
816 815
817static int __init 816static int __init
@@ -873,7 +872,6 @@ con3215_init(void)
873 raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE); 872 raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE);
874 raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE); 873 raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);
875 raw->cdev = cdev; 874 raw->cdev = cdev;
876 raw->lock = get_ccwdev_lock(cdev);
877 cdev->dev.driver_data = raw; 875 cdev->dev.driver_data = raw;
878 cdev->handler = raw3215_irq; 876 cdev->handler = raw3215_irq;
879 877
@@ -1066,10 +1064,10 @@ tty3215_unthrottle(struct tty_struct * tty)
1066 1064
1067 raw = (struct raw3215_info *) tty->driver_data; 1065 raw = (struct raw3215_info *) tty->driver_data;
1068 if (raw->flags & RAW3215_THROTTLED) { 1066 if (raw->flags & RAW3215_THROTTLED) {
1069 spin_lock_irqsave(raw->lock, flags); 1067 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
1070 raw->flags &= ~RAW3215_THROTTLED; 1068 raw->flags &= ~RAW3215_THROTTLED;
1071 raw3215_try_io(raw); 1069 raw3215_try_io(raw);
1072 spin_unlock_irqrestore(raw->lock, flags); 1070 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
1073 } 1071 }
1074} 1072}
1075 1073
@@ -1096,10 +1094,10 @@ tty3215_start(struct tty_struct *tty)
1096 1094
1097 raw = (struct raw3215_info *) tty->driver_data; 1095 raw = (struct raw3215_info *) tty->driver_data;
1098 if (raw->flags & RAW3215_STOPPED) { 1096 if (raw->flags & RAW3215_STOPPED) {
1099 spin_lock_irqsave(raw->lock, flags); 1097 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
1100 raw->flags &= ~RAW3215_STOPPED; 1098 raw->flags &= ~RAW3215_STOPPED;
1101 raw3215_try_io(raw); 1099 raw3215_try_io(raw);
1102 spin_unlock_irqrestore(raw->lock, flags); 1100 spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
1103 } 1101 }
1104} 1102}
1105 1103