aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_console.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r--drivers/char/hvc_console.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index a5c6a9d7ff08..a76d2c40dd5e 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -22,7 +22,6 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include <linux/config.h>
26#include <linux/console.h> 25#include <linux/console.h>
27#include <linux/cpumask.h> 26#include <linux/cpumask.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -81,7 +80,8 @@ struct hvc_struct {
81 struct tty_struct *tty; 80 struct tty_struct *tty;
82 unsigned int count; 81 unsigned int count;
83 int do_wakeup; 82 int do_wakeup;
84 char outbuf[N_OUTBUF] __ALIGNED__; 83 char *outbuf;
84 int outbuf_size;
85 int n_outbuf; 85 int n_outbuf;
86 uint32_t vtermno; 86 uint32_t vtermno;
87 struct hv_ops *ops; 87 struct hv_ops *ops;
@@ -320,10 +320,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
320 struct kobject *kobjp; 320 struct kobject *kobjp;
321 321
322 /* Auto increments kobject reference if found. */ 322 /* Auto increments kobject reference if found. */
323 if (!(hp = hvc_get_by_index(tty->index))) { 323 if (!(hp = hvc_get_by_index(tty->index)))
324 printk(KERN_WARNING "hvc_console: tty open failed, no vty associated with tty.\n");
325 return -ENODEV; 324 return -ENODEV;
326 }
327 325
328 spin_lock_irqsave(&hp->lock, flags); 326 spin_lock_irqsave(&hp->lock, flags);
329 /* Check and then increment for fast path open. */ 327 /* Check and then increment for fast path open. */
@@ -347,7 +345,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)
347 spin_unlock_irqrestore(&hp->lock, flags); 345 spin_unlock_irqrestore(&hp->lock, flags);
348 /* check error, fallback to non-irq */ 346 /* check error, fallback to non-irq */
349 if (irq != NO_IRQ) 347 if (irq != NO_IRQ)
350 rc = request_irq(irq, hvc_handle_interrupt, SA_INTERRUPT, "hvc_console", hp); 348 rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, "hvc_console", hp);
351 349
352 /* 350 /*
353 * If the request_irq() fails and we return an error. The tty layer 351 * If the request_irq() fails and we return an error. The tty layer
@@ -506,7 +504,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count
506 if (hp->n_outbuf > 0) 504 if (hp->n_outbuf > 0)
507 hvc_push(hp); 505 hvc_push(hp);
508 506
509 while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { 507 while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) {
510 if (rsize > count) 508 if (rsize > count)
511 rsize = count; 509 rsize = count;
512 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); 510 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize);
@@ -539,7 +537,7 @@ static int hvc_write_room(struct tty_struct *tty)
539 if (!hp) 537 if (!hp)
540 return -1; 538 return -1;
541 539
542 return N_OUTBUF - hp->n_outbuf; 540 return hp->outbuf_size - hp->n_outbuf;
543} 541}
544 542
545static int hvc_chars_in_buffer(struct tty_struct *tty) 543static int hvc_chars_in_buffer(struct tty_struct *tty)
@@ -669,6 +667,7 @@ int khvcd(void *unused)
669 do { 667 do {
670 poll_mask = 0; 668 poll_mask = 0;
671 hvc_kicked = 0; 669 hvc_kicked = 0;
670 try_to_freeze();
672 wmb(); 671 wmb();
673 if (cpus_empty(cpus_in_xmon)) { 672 if (cpus_empty(cpus_in_xmon)) {
674 spin_lock(&hvc_structs_lock); 673 spin_lock(&hvc_structs_lock);
@@ -729,12 +728,13 @@ static struct kobj_type hvc_kobj_type = {
729}; 728};
730 729
731struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, 730struct 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;
@@ -820,7 +822,6 @@ int __init hvc_init(void)
820 return -ENOMEM; 822 return -ENOMEM;
821 823
822 drv->owner = THIS_MODULE; 824 drv->owner = THIS_MODULE;
823 drv->devfs_name = "hvc/";
824 drv->driver_name = "hvc"; 825 drv->driver_name = "hvc";
825 drv->name = "hvc"; 826 drv->name = "hvc";
826 drv->major = HVC_MAJOR; 827 drv->major = HVC_MAJOR;