aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/hvc_console.c
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2005-07-07 20:56:24 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:23:39 -0400
commitacad9559f1054487292eb10d7bb81f256e9d8f2d (patch)
tree9496b1c81c776ab5c8af37246697052226a345a6 /drivers/char/hvc_console.c
parentd5ee257c3342185ba8ab642d125d192eb99ea8f2 (diff)
[PATCH] hvc_console: Separate hvc_console and vio code 2
Remove all the vio device driver code from hvc_console.c This will allow us to separate hvsi, hvc, and allow hvc_console to be used without the ppc64 vio layer. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/hvc_console.c')
-rw-r--r--drivers/char/hvc_console.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index d59c642f9654..df282cc9a7ab 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -41,7 +41,6 @@
41#include <linux/delay.h> 41#include <linux/delay.h>
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/hvconsole.h> 43#include <asm/hvconsole.h>
44#include <asm/vio.h>
45 44
46#define HVC_MAJOR 229 45#define HVC_MAJOR 229
47#define HVC_MINOR 0 46#define HVC_MINOR 0
@@ -90,7 +89,6 @@ struct hvc_struct {
90 int irq; 89 int irq;
91 struct list_head next; 90 struct list_head next;
92 struct kobject kobj; /* ref count & hvc_struct lifetime */ 91 struct kobject kobj; /* ref count & hvc_struct lifetime */
93 struct vio_dev *vdev;
94}; 92};
95 93
96/* dynamic list of hvc_struct instances */ 94/* dynamic list of hvc_struct instances */
@@ -279,6 +277,7 @@ int hvc_instantiate(uint32_t vtermno, int index)
279 277
280 return 0; 278 return 0;
281} 279}
280EXPORT_SYMBOL(hvc_instantiate);
282 281
283/* Wake the sleeping khvcd */ 282/* Wake the sleeping khvcd */
284static void hvc_kick(void) 283static void hvc_kick(void)
@@ -738,26 +737,19 @@ static struct kobj_type hvc_kobj_type = {
738 .release = destroy_hvc_struct, 737 .release = destroy_hvc_struct,
739}; 738};
740 739
741static int __devinit hvc_probe( 740struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq)
742 struct vio_dev *dev,
743 const struct vio_device_id *id)
744{ 741{
745 struct hvc_struct *hp; 742 struct hvc_struct *hp;
746 int i; 743 int i;
747 744
748 /* probed with invalid parameters. */
749 if (!dev || !id)
750 return -EPERM;
751
752 hp = kmalloc(sizeof(*hp), GFP_KERNEL); 745 hp = kmalloc(sizeof(*hp), GFP_KERNEL);
753 if (!hp) 746 if (!hp)
754 return -ENOMEM; 747 return ERR_PTR(-ENOMEM);
755 748
756 memset(hp, 0x00, sizeof(*hp)); 749 memset(hp, 0x00, sizeof(*hp));
757 hp->vtermno = dev->unit_address; 750
758 hp->vdev = dev; 751 hp->vtermno = vtermno;
759 hp->vdev->dev.driver_data = hp; 752 hp->irq = irq;
760 hp->irq = dev->irq;
761 753
762 kobject_init(&hp->kobj); 754 kobject_init(&hp->kobj);
763 hp->kobj.ktype = &hvc_kobj_type; 755 hp->kobj.ktype = &hvc_kobj_type;
@@ -782,12 +774,12 @@ static int __devinit hvc_probe(
782 list_add_tail(&(hp->next), &hvc_structs); 774 list_add_tail(&(hp->next), &hvc_structs);
783 spin_unlock(&hvc_structs_lock); 775 spin_unlock(&hvc_structs_lock);
784 776
785 return 0; 777 return hp;
786} 778}
779EXPORT_SYMBOL(hvc_alloc);
787 780
788static int __devexit hvc_remove(struct vio_dev *dev) 781int __devexit hvc_remove(struct hvc_struct *hp)
789{ 782{
790 struct hvc_struct *hp = dev->dev.driver_data;
791 unsigned long flags; 783 unsigned long flags;
792 struct kobject *kobjp; 784 struct kobject *kobjp;
793 struct tty_struct *tty; 785 struct tty_struct *tty;
@@ -820,28 +812,12 @@ static int __devexit hvc_remove(struct vio_dev *dev)
820 tty_hangup(tty); 812 tty_hangup(tty);
821 return 0; 813 return 0;
822} 814}
823 815EXPORT_SYMBOL(hvc_remove);
824char hvc_driver_name[] = "hvc_console";
825
826static struct vio_device_id hvc_driver_table[] __devinitdata= {
827 {"serial", "hvterm1"},
828 { NULL, }
829};
830MODULE_DEVICE_TABLE(vio, hvc_driver_table);
831
832static struct vio_driver hvc_vio_driver = {
833 .name = hvc_driver_name,
834 .id_table = hvc_driver_table,
835 .probe = hvc_probe,
836 .remove = hvc_remove,
837};
838 816
839/* Driver initialization. Follow console initialization. This is where the TTY 817/* Driver initialization. Follow console initialization. This is where the TTY
840 * interfaces start to become available. */ 818 * interfaces start to become available. */
841int __init hvc_init(void) 819int __init hvc_init(void)
842{ 820{
843 int rc;
844
845 /* We need more than hvc_count adapters due to hotplug additions. */ 821 /* We need more than hvc_count adapters due to hotplug additions. */
846 hvc_driver = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS); 822 hvc_driver = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS);
847 if (!hvc_driver) 823 if (!hvc_driver)
@@ -870,10 +846,7 @@ int __init hvc_init(void)
870 return -EIO; 846 return -EIO;
871 } 847 }
872 848
873 /* Register as a vio device to receive callbacks */ 849 return 0;
874 rc = vio_register_driver(&hvc_vio_driver);
875
876 return rc;
877} 850}
878module_init(hvc_init); 851module_init(hvc_init);
879 852
@@ -884,7 +857,6 @@ static void __exit hvc_exit(void)
884{ 857{
885 kthread_stop(hvc_task); 858 kthread_stop(hvc_task);
886 859
887 vio_unregister_driver(&hvc_vio_driver);
888 tty_unregister_driver(hvc_driver); 860 tty_unregister_driver(hvc_driver);
889 /* return tty_struct instances allocated in hvc_init(). */ 861 /* return tty_struct instances allocated in hvc_init(). */
890 put_tty_driver(hvc_driver); 862 put_tty_driver(hvc_driver);