Commit 520a4e37 authored by Martin Schwidefsky's avatar Martin Schwidefsky

[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: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 3902e476
...@@ -299,14 +299,14 @@ raw3215_timeout(unsigned long __data) ...@@ -299,14 +299,14 @@ raw3215_timeout(unsigned long __data)
struct raw3215_info *raw = (struct raw3215_info *) __data; struct raw3215_info *raw = (struct raw3215_info *) __data;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
if (raw->flags & RAW3215_TIMER_RUNS) { if (raw->flags & RAW3215_TIMER_RUNS) {
del_timer(&raw->timer); del_timer(&raw->timer);
raw->flags &= ~RAW3215_TIMER_RUNS; raw->flags &= ~RAW3215_TIMER_RUNS;
raw3215_mk_write_req(raw); raw3215_mk_write_req(raw);
raw3215_start_io(raw); raw3215_start_io(raw);
} }
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
/* /*
...@@ -355,10 +355,10 @@ raw3215_tasklet(void *data) ...@@ -355,10 +355,10 @@ raw3215_tasklet(void *data)
unsigned long flags; unsigned long flags;
raw = (struct raw3215_info *) data; raw = (struct raw3215_info *) data;
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw3215_mk_write_req(raw); raw3215_mk_write_req(raw);
raw3215_try_io(raw); raw3215_try_io(raw);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
/* Check for pending message from raw3215_irq */ /* Check for pending message from raw3215_irq */
if (raw->message != NULL) { if (raw->message != NULL) {
printk(raw->message, raw->msg_dstat, raw->msg_cstat); printk(raw->message, raw->msg_dstat, raw->msg_cstat);
...@@ -512,9 +512,9 @@ raw3215_make_room(struct raw3215_info *raw, unsigned int length) ...@@ -512,9 +512,9 @@ raw3215_make_room(struct raw3215_info *raw, unsigned int length)
if (RAW3215_BUFFER_SIZE - raw->count >= length) if (RAW3215_BUFFER_SIZE - raw->count >= length)
break; break;
/* there might be another cpu waiting for the lock */ /* there might be another cpu waiting for the lock */
spin_unlock(raw->lock); spin_unlock(get_ccwdev_lock(raw->cdev));
udelay(100); udelay(100);
spin_lock(raw->lock); spin_lock(get_ccwdev_lock(raw->cdev));
} }
} }
...@@ -528,7 +528,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) ...@@ -528,7 +528,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length)
int c, count; int c, count;
while (length > 0) { while (length > 0) {
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
count = (length > RAW3215_BUFFER_SIZE) ? count = (length > RAW3215_BUFFER_SIZE) ?
RAW3215_BUFFER_SIZE : length; RAW3215_BUFFER_SIZE : length;
length -= count; length -= count;
...@@ -555,7 +555,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) ...@@ -555,7 +555,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length)
/* start or queue request */ /* start or queue request */
raw3215_try_io(raw); raw3215_try_io(raw);
} }
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
} }
...@@ -568,7 +568,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch) ...@@ -568,7 +568,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch)
unsigned long flags; unsigned long flags;
unsigned int length, i; unsigned int length, i;
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
if (ch == '\t') { if (ch == '\t') {
length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE); length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE);
raw->line_pos += length; raw->line_pos += length;
...@@ -592,7 +592,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch) ...@@ -592,7 +592,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch)
/* start or queue request */ /* start or queue request */
raw3215_try_io(raw); raw3215_try_io(raw);
} }
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
/* /*
...@@ -604,13 +604,13 @@ raw3215_flush_buffer(struct raw3215_info *raw) ...@@ -604,13 +604,13 @@ raw3215_flush_buffer(struct raw3215_info *raw)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
if (raw->count > 0) { if (raw->count > 0) {
raw->flags |= RAW3215_FLUSHING; raw->flags |= RAW3215_FLUSHING;
raw3215_try_io(raw); raw3215_try_io(raw);
raw->flags &= ~RAW3215_FLUSHING; raw->flags &= ~RAW3215_FLUSHING;
} }
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
/* /*
...@@ -625,9 +625,9 @@ raw3215_startup(struct raw3215_info *raw) ...@@ -625,9 +625,9 @@ raw3215_startup(struct raw3215_info *raw)
return 0; return 0;
raw->line_pos = 0; raw->line_pos = 0;
raw->flags |= RAW3215_ACTIVE; raw->flags |= RAW3215_ACTIVE;
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw3215_try_io(raw); raw3215_try_io(raw);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
return 0; return 0;
} }
...@@ -644,21 +644,21 @@ raw3215_shutdown(struct raw3215_info *raw) ...@@ -644,21 +644,21 @@ raw3215_shutdown(struct raw3215_info *raw)
if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED)) if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED))
return; return;
/* Wait for outstanding requests, then free irq */ /* Wait for outstanding requests, then free irq */
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
if ((raw->flags & RAW3215_WORKING) || if ((raw->flags & RAW3215_WORKING) ||
raw->queued_write != NULL || raw->queued_write != NULL ||
raw->queued_read != NULL) { raw->queued_read != NULL) {
raw->flags |= RAW3215_CLOSING; raw->flags |= RAW3215_CLOSING;
add_wait_queue(&raw->empty_wait, &wait); add_wait_queue(&raw->empty_wait, &wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
schedule(); schedule();
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
remove_wait_queue(&raw->empty_wait, &wait); remove_wait_queue(&raw->empty_wait, &wait);
set_current_state(TASK_RUNNING); set_current_state(TASK_RUNNING);
raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING); raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING);
} }
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
static int static int
...@@ -686,7 +686,6 @@ raw3215_probe (struct ccw_device *cdev) ...@@ -686,7 +686,6 @@ raw3215_probe (struct ccw_device *cdev)
} }
raw->cdev = cdev; raw->cdev = cdev;
raw->lock = get_ccwdev_lock(cdev);
raw->inbuf = (char *) raw + sizeof(struct raw3215_info); raw->inbuf = (char *) raw + sizeof(struct raw3215_info);
memset(raw, 0, sizeof(struct raw3215_info)); memset(raw, 0, sizeof(struct raw3215_info));
raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE,
...@@ -809,9 +808,9 @@ con3215_unblank(void) ...@@ -809,9 +808,9 @@ con3215_unblank(void)
unsigned long flags; unsigned long flags;
raw = raw3215[0]; /* console 3215 is the first one */ raw = raw3215[0]; /* console 3215 is the first one */
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw3215_make_room(raw, RAW3215_BUFFER_SIZE); raw3215_make_room(raw, RAW3215_BUFFER_SIZE);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
static int __init static int __init
...@@ -873,7 +872,6 @@ con3215_init(void) ...@@ -873,7 +872,6 @@ con3215_init(void)
raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE); raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE);
raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE); raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);
raw->cdev = cdev; raw->cdev = cdev;
raw->lock = get_ccwdev_lock(cdev);
cdev->dev.driver_data = raw; cdev->dev.driver_data = raw;
cdev->handler = raw3215_irq; cdev->handler = raw3215_irq;
...@@ -1066,10 +1064,10 @@ tty3215_unthrottle(struct tty_struct * tty) ...@@ -1066,10 +1064,10 @@ tty3215_unthrottle(struct tty_struct * tty)
raw = (struct raw3215_info *) tty->driver_data; raw = (struct raw3215_info *) tty->driver_data;
if (raw->flags & RAW3215_THROTTLED) { if (raw->flags & RAW3215_THROTTLED) {
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw->flags &= ~RAW3215_THROTTLED; raw->flags &= ~RAW3215_THROTTLED;
raw3215_try_io(raw); raw3215_try_io(raw);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
} }
...@@ -1096,10 +1094,10 @@ tty3215_start(struct tty_struct *tty) ...@@ -1096,10 +1094,10 @@ tty3215_start(struct tty_struct *tty)
raw = (struct raw3215_info *) tty->driver_data; raw = (struct raw3215_info *) tty->driver_data;
if (raw->flags & RAW3215_STOPPED) { if (raw->flags & RAW3215_STOPPED) {
spin_lock_irqsave(raw->lock, flags); spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
raw->flags &= ~RAW3215_STOPPED; raw->flags &= ~RAW3215_STOPPED;
raw3215_try_io(raw); raw3215_try_io(raw);
spin_unlock_irqrestore(raw->lock, flags); spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment