diff options
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r-- | drivers/char/hvc_console.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index ca2f538e549e..a76d2c40dd5e 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -80,7 +80,8 @@ struct hvc_struct { | |||
80 | struct tty_struct *tty; | 80 | struct tty_struct *tty; |
81 | unsigned int count; | 81 | unsigned int count; |
82 | int do_wakeup; | 82 | int do_wakeup; |
83 | char outbuf[N_OUTBUF] __ALIGNED__; | 83 | char *outbuf; |
84 | int outbuf_size; | ||
84 | int n_outbuf; | 85 | int n_outbuf; |
85 | uint32_t vtermno; | 86 | uint32_t vtermno; |
86 | struct hv_ops *ops; | 87 | struct hv_ops *ops; |
@@ -319,10 +320,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
319 | struct kobject *kobjp; | 320 | struct kobject *kobjp; |
320 | 321 | ||
321 | /* Auto increments kobject reference if found. */ | 322 | /* Auto increments kobject reference if found. */ |
322 | if (!(hp = hvc_get_by_index(tty->index))) { | 323 | if (!(hp = hvc_get_by_index(tty->index))) |
323 | printk(KERN_WARNING "hvc_console: tty open failed, no vty associated with tty.\n"); | ||
324 | return -ENODEV; | 324 | return -ENODEV; |
325 | } | ||
326 | 325 | ||
327 | spin_lock_irqsave(&hp->lock, flags); | 326 | spin_lock_irqsave(&hp->lock, flags); |
328 | /* Check and then increment for fast path open. */ | 327 | /* Check and then increment for fast path open. */ |
@@ -505,7 +504,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count | |||
505 | if (hp->n_outbuf > 0) | 504 | if (hp->n_outbuf > 0) |
506 | hvc_push(hp); | 505 | hvc_push(hp); |
507 | 506 | ||
508 | while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { | 507 | while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) { |
509 | if (rsize > count) | 508 | if (rsize > count) |
510 | rsize = count; | 509 | rsize = count; |
511 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); | 510 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); |
@@ -538,7 +537,7 @@ static int hvc_write_room(struct tty_struct *tty) | |||
538 | if (!hp) | 537 | if (!hp) |
539 | return -1; | 538 | return -1; |
540 | 539 | ||
541 | return N_OUTBUF - hp->n_outbuf; | 540 | return hp->outbuf_size - hp->n_outbuf; |
542 | } | 541 | } |
543 | 542 | ||
544 | static int hvc_chars_in_buffer(struct tty_struct *tty) | 543 | static int hvc_chars_in_buffer(struct tty_struct *tty) |
@@ -668,6 +667,7 @@ int khvcd(void *unused) | |||
668 | do { | 667 | do { |
669 | poll_mask = 0; | 668 | poll_mask = 0; |
670 | hvc_kicked = 0; | 669 | hvc_kicked = 0; |
670 | try_to_freeze(); | ||
671 | wmb(); | 671 | wmb(); |
672 | if (cpus_empty(cpus_in_xmon)) { | 672 | if (cpus_empty(cpus_in_xmon)) { |
673 | spin_lock(&hvc_structs_lock); | 673 | spin_lock(&hvc_structs_lock); |
@@ -728,12 +728,13 @@ static struct kobj_type hvc_kobj_type = { | |||
728 | }; | 728 | }; |
729 | 729 | ||
730 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | 730 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, |
731 | struct hv_ops *ops) | 731 | struct hv_ops *ops, int outbuf_size) |
732 | { | 732 | { |
733 | struct hvc_struct *hp; | 733 | struct hvc_struct *hp; |
734 | int i; | 734 | int i; |
735 | 735 | ||
736 | hp = kmalloc(sizeof(*hp), GFP_KERNEL); | 736 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
737 | GFP_KERNEL); | ||
737 | if (!hp) | 738 | if (!hp) |
738 | return ERR_PTR(-ENOMEM); | 739 | return ERR_PTR(-ENOMEM); |
739 | 740 | ||
@@ -742,6 +743,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | |||
742 | hp->vtermno = vtermno; | 743 | hp->vtermno = vtermno; |
743 | hp->irq = irq; | 744 | hp->irq = irq; |
744 | hp->ops = ops; | 745 | hp->ops = ops; |
746 | hp->outbuf_size = outbuf_size; | ||
747 | hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; | ||
745 | 748 | ||
746 | kobject_init(&hp->kobj); | 749 | kobject_init(&hp->kobj); |
747 | hp->kobj.ktype = &hvc_kobj_type; | 750 | hp->kobj.ktype = &hvc_kobj_type; |