aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_console.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-22 15:48:03 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-22 15:48:03 -0400
commit14d1adfc59ba66932ef167fdff62983e7c2b0197 (patch)
tree34bad21bf4ec220be87fa5d79ff41dd98e7dad9f /drivers/char/hvc_console.c
parente478bec0ba0a83a48a0f6982934b6de079e7e6b3 (diff)
parent69917c26c840e7de94522bf90fb190de63bf92bd (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (114 commits) [POWERPC] Fix ohare IDE irq workaround on old powermacs [POWERPC] EEH: Power4 systems sometimes need multiple resets. [POWERPC] Include <asm/mmu.h> in arch/powerpc/sysdev/fsl_soc.h for phys_addr_t. [POWERPC] Demacrofy arch/powerpc/platforms/maple/pci.c [POWERPC] Maple U3 HT - reject inappropriate config space access [POWERPC] Fix IPIC pending register assignments [POWERPC] powerpc: fix building gdb against asm/ptrace.h [POWERPC] Remove DISCONTIGMEM cruft from page.h [POWERPC] Merge iSeries i/o operations with the rest [POWERPC] 40x: Fix debug status register defines [POWERPC] Fix compile error in sbc8560 [POWERPC] EEH: support MMIO enable recovery step [POWERPC] EEH: enable MMIO/DMA on frozen slot [POWERPC] EEH: code comment cleanup [POWERPC] EEH: balance pcidev_get/put calls [POWERPC] PPC: Fix xmon stack frame address in backtrace [POWERPC] Add AT_PLATFORM value for Xilinx Virtex-4 FX [POWERPC] Start arch/powerpc/boot code reorganization [POWERPC] Define of_read_ulong helper [POWERPC] iseries: eliminate a couple of warnings ...
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r--drivers/char/hvc_console.c18
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
544static int hvc_chars_in_buffer(struct tty_struct *tty) 543static int hvc_chars_in_buffer(struct tty_struct *tty)
@@ -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;