diff options
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r-- | drivers/char/hvc_console.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 613d67f1c7f0..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) |
@@ -729,12 +728,13 @@ static struct kobj_type hvc_kobj_type = { | |||
729 | }; | 728 | }; |
730 | 729 | ||
731 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | 730 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, |
732 | struct hv_ops *ops) | 731 | struct hv_ops *ops, int outbuf_size) |
733 | { | 732 | { |
734 | struct hvc_struct *hp; | 733 | struct hvc_struct *hp; |
735 | int i; | 734 | int i; |
736 | 735 | ||
737 | hp = kmalloc(sizeof(*hp), GFP_KERNEL); | 736 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
737 | GFP_KERNEL); | ||
738 | if (!hp) | 738 | if (!hp) |
739 | return ERR_PTR(-ENOMEM); | 739 | return ERR_PTR(-ENOMEM); |
740 | 740 | ||
@@ -743,6 +743,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | |||
743 | hp->vtermno = vtermno; | 743 | hp->vtermno = vtermno; |
744 | hp->irq = irq; | 744 | hp->irq = irq; |
745 | hp->ops = ops; | 745 | hp->ops = ops; |
746 | hp->outbuf_size = outbuf_size; | ||
747 | hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; | ||
746 | 748 | ||
747 | kobject_init(&hp->kobj); | 749 | kobject_init(&hp->kobj); |
748 | hp->kobj.ktype = &hvc_kobj_type; | 750 | hp->kobj.ktype = &hvc_kobj_type; |