1 /* vcc.c: sun4v virtual channel concentrator
3 * Copyright (C) 2017 Oracle. All rights reserved.
6 #include <linux/delay.h>
7 #include <linux/interrupt.h>
8 #include <linux/module.h>
9 #include <linux/slab.h>
10 #include <linux/sysfs.h>
11 #include <linux/tty.h>
12 #include <linux/tty_flip.h>
16 #define DRV_MODULE_NAME "vcc"
17 #define DRV_MODULE_VERSION "1.1"
18 #define DRV_MODULE_RELDATE "July 1, 2017"
20 static char version[] =
21 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")";
23 MODULE_DESCRIPTION("Sun LDOM virtual console concentrator driver");
24 MODULE_LICENSE("GPL");
25 MODULE_VERSION(DRV_MODULE_VERSION);
28 struct vio_driver_state vio;
32 struct tty_struct *tty; /* only populated while dev is open */
33 unsigned long index; /* index into the vcc_table */
40 /* This buffer is required to support the tty write_room interface
41 * and guarantee that any characters that the driver accepts will
42 * be eventually sent, either immediately or later.
45 struct vio_vcc buffer;
47 struct timer_list rx_timer;
48 struct timer_list tx_timer;
51 /* Microseconds that thread will delay waiting for a vcc port ref */
52 #define VCC_REF_DELAY 100
54 #define VCC_MAX_PORTS 1024
55 #define VCC_MINOR_START 0 /* must be zero */
56 #define VCC_BUFF_LEN VIO_VCC_MTU_SIZE
58 #define VCC_CTL_BREAK -1
59 #define VCC_CTL_HUP -2
61 static const char vcc_driver_name[] = "vcc";
62 static const char vcc_device_node[] = "vcc";
63 static struct tty_driver *vcc_tty_driver;
65 static struct vcc_port *vcc_table[VCC_MAX_PORTS];
66 static DEFINE_SPINLOCK(vcc_table_lock);
72 module_param(vcc_dbg, uint, 0664);
73 module_param(vcc_dbg_ldc, uint, 0664);
74 module_param(vcc_dbg_vio, uint, 0664);
76 #define VCC_DBG_DRV 0x1
77 #define VCC_DBG_LDC 0x2
78 #define VCC_DBG_PKT 0x4
80 #define vccdbg(f, a...) \
82 if (vcc_dbg & VCC_DBG_DRV) \
88 if (vcc_dbg & VCC_DBG_LDC) \
92 #define vccdbgp(pkt) \
94 if (vcc_dbg & VCC_DBG_PKT) { \
96 for (i = 0; i < pkt.tag.stype; i++) \
97 pr_info("[%c]", pkt.data[i]); \
101 /* Note: Be careful when adding flags to this line discipline. Don't
102 * add anything that will cause echoing or we'll go into recursive
103 * loop echoing chars back and forth with the console drivers.
105 static const struct ktermios vcc_tty_termios = {
106 .c_iflag = IGNBRK | IGNPAR,
108 .c_cflag = B38400 | CS8 | CREAD | HUPCL,
115 * vcc_table_add() - Add VCC port to the VCC table
116 * @port: pointer to the VCC port
118 * Return: index of the port in the VCC table on success,
121 static int vcc_table_add(struct vcc_port *port)
126 spin_lock_irqsave(&vcc_table_lock, flags);
127 for (i = VCC_MINOR_START; i < VCC_MAX_PORTS; i++) {
133 spin_unlock_irqrestore(&vcc_table_lock, flags);
135 if (i < VCC_MAX_PORTS)
142 * vcc_table_remove() - Removes a VCC port from the VCC table
143 * @index: Index into the VCC table
145 static void vcc_table_remove(unsigned long index)
149 if (WARN_ON(index >= VCC_MAX_PORTS))
152 spin_lock_irqsave(&vcc_table_lock, flags);
153 vcc_table[index] = NULL;
154 spin_unlock_irqrestore(&vcc_table_lock, flags);
158 * vcc_get() - Gets a reference to VCC port
159 * @index: Index into the VCC table
160 * @excl: Indicates if an exclusive access is requested
162 * Return: reference to the VCC port, if found
163 * NULL, if port not found
165 static struct vcc_port *vcc_get(unsigned long index, bool excl)
167 struct vcc_port *port;
171 spin_lock_irqsave(&vcc_table_lock, flags);
173 port = vcc_table[index];
175 spin_unlock_irqrestore(&vcc_table_lock, flags);
180 if (port->excl_locked) {
181 spin_unlock_irqrestore(&vcc_table_lock, flags);
182 udelay(VCC_REF_DELAY);
186 spin_unlock_irqrestore(&vcc_table_lock, flags);
191 spin_unlock_irqrestore(&vcc_table_lock, flags);
192 /* Threads wanting exclusive access will wait half the time,
193 * probably giving them higher priority in the case of
196 udelay(VCC_REF_DELAY/2);
201 port->excl_locked = true;
202 spin_unlock_irqrestore(&vcc_table_lock, flags);
208 * vcc_put() - Returns a reference to VCC port
209 * @port: pointer to VCC port
210 * @excl: Indicates if the returned reference is an exclusive reference
212 * Note: It's the caller's responsibility to ensure the correct value
215 static void vcc_put(struct vcc_port *port, bool excl)
222 spin_lock_irqsave(&vcc_table_lock, flags);
224 /* check if caller attempted to put with the wrong flags */
225 if (WARN_ON((excl && !port->excl_locked) ||
226 (!excl && port->excl_locked)))
232 port->excl_locked = false;
235 spin_unlock_irqrestore(&vcc_table_lock, flags);
239 * vcc_get_ne() - Get a non-exclusive reference to VCC port
240 * @index: Index into the VCC table
242 * Gets a non-exclusive reference to VCC port, if it's not removed
244 * Return: pointer to the VCC port, if found
245 * NULL, if port not found
247 static struct vcc_port *vcc_get_ne(unsigned long index)
249 struct vcc_port *port;
251 port = vcc_get(index, false);
253 if (port && port->removed) {
254 vcc_put(port, false);
261 static void vcc_kick_rx(struct vcc_port *port)
263 struct vio_driver_state *vio = &port->vio;
265 assert_spin_locked(&port->lock);
267 if (!timer_pending(&port->rx_timer) && !port->removed) {
268 disable_irq_nosync(vio->vdev->rx_irq);
269 port->rx_timer.expires = (jiffies + 1);
270 add_timer(&port->rx_timer);
274 static void vcc_kick_tx(struct vcc_port *port)
276 assert_spin_locked(&port->lock);
278 if (!timer_pending(&port->tx_timer) && !port->removed) {
279 port->tx_timer.expires = (jiffies + 1);
280 add_timer(&port->tx_timer);
284 static int vcc_rx_check(struct tty_struct *tty, int size)
286 if (WARN_ON(!tty || !tty->port))
289 /* tty_buffer_request_room won't sleep because it uses
290 * GFP_ATOMIC flag to allocate buffer
292 if (test_bit(TTY_THROTTLED, &tty->flags) ||
293 (tty_buffer_request_room(tty->port, VCC_BUFF_LEN) < VCC_BUFF_LEN))
299 static int vcc_rx(struct tty_struct *tty, char *buf, int size)
303 if (WARN_ON(!tty || !tty->port))
306 len = tty_insert_flip_string(tty->port, buf, size);
308 tty_flip_buffer_push(tty->port);
313 static int vcc_ldc_read(struct vcc_port *port)
315 struct vio_driver_state *vio = &port->vio;
316 struct tty_struct *tty;
322 rv = ldc_rx_reset(vio->lp);
323 vccdbg("VCC: reset rx q: rv=%d\n", rv);
327 /* Read as long as LDC has incoming data. */
329 if (!vcc_rx_check(tty, VIO_VCC_MTU_SIZE)) {
336 rv = ldc_read(vio->lp, &pkt, sizeof(pkt));
340 vccdbg("VCC: ldc_read()=%d\n", rv);
341 vccdbg("TAG [%02x:%02x:%04x:%08x]\n",
342 pkt.tag.type, pkt.tag.stype,
343 pkt.tag.stype_env, pkt.tag.sid);
345 if (pkt.tag.type == VIO_TYPE_DATA) {
347 /* vcc_rx_check ensures memory availability */
348 vcc_rx(tty, pkt.data, pkt.tag.stype);
350 pr_err("VCC: unknown msg [%02x:%02x:%04x:%08x]\n",
351 pkt.tag.type, pkt.tag.stype,
352 pkt.tag.stype_env, pkt.tag.sid);
357 WARN_ON(rv != LDC_PACKET_SIZE);
364 static void vcc_rx_timer(unsigned long index)
366 struct vio_driver_state *vio;
367 struct vcc_port *port;
371 port = vcc_get_ne(index);
375 spin_lock_irqsave(&port->lock, flags);
376 port->rx_timer.expires = 0;
380 enable_irq(vio->vdev->rx_irq);
382 if (!port->tty || port->removed)
385 rv = vcc_ldc_read(port);
386 if (rv == -ECONNRESET)
390 spin_unlock_irqrestore(&port->lock, flags);
391 vcc_put(port, false);
394 static void vcc_tx_timer(unsigned long index)
396 struct vcc_port *port;
402 port = vcc_get_ne(index);
406 spin_lock_irqsave(&port->lock, flags);
407 port->tx_timer.expires = 0;
409 if (!port->tty || port->removed)
412 tosend = min(VCC_BUFF_LEN, port->chars_in_buffer);
417 pkt->tag.type = VIO_TYPE_DATA;
418 pkt->tag.stype = tosend;
419 vccdbgl(port->vio.lp);
421 rv = ldc_write(port->vio.lp, pkt, (VIO_TAG_SIZE + tosend));
425 vccdbg("VCC: ldc_write()=%d\n", rv);
428 struct tty_struct *tty = port->tty;
430 port->chars_in_buffer = 0;
436 spin_unlock_irqrestore(&port->lock, flags);
437 vcc_put(port, false);
441 * vcc_event() - LDC event processing engine
442 * @arg: VCC private data
445 * Handles LDC events for VCC
447 static void vcc_event(void *arg, int event)
449 struct vio_driver_state *vio;
450 struct vcc_port *port;
457 spin_lock_irqsave(&port->lock, flags);
460 case LDC_EVENT_RESET:
462 vio_link_state_change(vio, event);
465 case LDC_EVENT_DATA_READY:
466 rv = vcc_ldc_read(port);
467 if (rv == -ECONNRESET)
472 pr_err("VCC: unexpected LDC event(%d)\n", event);
475 spin_unlock_irqrestore(&port->lock, flags);
478 static struct ldc_channel_config vcc_ldc_cfg = {
480 .mtu = VIO_VCC_MTU_SIZE,
481 .mode = LDC_MODE_RAW,
485 /* Ordered from largest major to lowest */
486 static struct vio_version vcc_versions[] = {
487 { .major = 1, .minor = 0 },
490 static struct tty_port_operations vcc_port_ops = { 0 };
492 static ssize_t vcc_sysfs_domain_show(struct device *dev,
493 struct device_attribute *attr,
496 struct vcc_port *port;
499 port = dev_get_drvdata(dev);
503 rv = scnprintf(buf, PAGE_SIZE, "%s\n", port->domain);
508 static int vcc_send_ctl(struct vcc_port *port, int ctl)
513 pkt.tag.type = VIO_TYPE_CTRL;
517 rv = ldc_write(port->vio.lp, &pkt, sizeof(pkt.tag));
519 vccdbg("VCC: ldc_write(%ld)=%d\n", sizeof(pkt.tag), rv);
524 static ssize_t vcc_sysfs_break_store(struct device *dev,
525 struct device_attribute *attr,
526 const char *buf, size_t count)
528 struct vcc_port *port;
533 port = dev_get_drvdata(dev);
537 spin_lock_irqsave(&port->lock, flags);
539 if (sscanf(buf, "%ud", &brk) != 1 || brk != 1)
541 else if (vcc_send_ctl(port, VCC_CTL_BREAK) < 0)
544 spin_unlock_irqrestore(&port->lock, flags);
549 static DEVICE_ATTR(domain, 0400, vcc_sysfs_domain_show, NULL);
550 static DEVICE_ATTR(break, 0200, NULL, vcc_sysfs_break_store);
552 static struct attribute *vcc_sysfs_entries[] = {
553 &dev_attr_domain.attr,
554 &dev_attr_break.attr,
558 static struct attribute_group vcc_attribute_group = {
560 .attrs = vcc_sysfs_entries,
564 * vcc_probe() - Initialize VCC port
565 * @vdev: Pointer to VIO device of the new VCC port
568 * Initializes a VCC port to receive serial console data from
569 * the guest domain. Sets up a TTY end point on the control
570 * domain. Sets up VIO/LDC link between the guest & control
573 * Return: status of the probe
575 static int vcc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
577 struct mdesc_handle *hp;
578 struct vcc_port *port;
585 vccdbg("VCC: name=%s\n", dev_name(&vdev->dev));
587 if (!vcc_tty_driver) {
588 pr_err("VCC: TTY driver not registered\n");
592 port = kzalloc(sizeof(struct vcc_port), GFP_KERNEL);
596 name = kstrdup(dev_name(&vdev->dev), GFP_KERNEL);
598 rv = vio_driver_init(&port->vio, vdev, VDEV_CONSOLE_CON, vcc_versions,
599 ARRAY_SIZE(vcc_versions), NULL, name);
603 port->vio.debug = vcc_dbg_vio;
604 vcc_ldc_cfg.debug = vcc_dbg_ldc;
606 rv = vio_ldc_alloc(&port->vio, &vcc_ldc_cfg, port);
610 spin_lock_init(&port->lock);
612 port->index = vcc_table_add(port);
613 if (port->index == -1) {
614 pr_err("VCC: no more TTY indices left for allocation\n");
619 /* Register the device using VCC table index as TTY index */
620 dev = tty_register_device(vcc_tty_driver, port->index, &vdev->dev);
628 node = vio_vdev_node(hp, vdev);
629 if (node == MDESC_NODE_NULL) {
635 domain = mdesc_get_property(hp, node, "vcc-domain-name", NULL);
641 port->domain = kstrdup(domain, GFP_KERNEL);
645 rv = sysfs_create_group(&vdev->dev.kobj, &vcc_attribute_group);
649 init_timer(&port->rx_timer);
650 port->rx_timer.function = vcc_rx_timer;
651 port->rx_timer.data = port->index;
653 init_timer(&port->tx_timer);
654 port->tx_timer.function = vcc_tx_timer;
655 port->tx_timer.data = port->index;
657 dev_set_drvdata(&vdev->dev, port);
659 /* It's possible to receive IRQs in the middle of vio_port_up. Disable
660 * IRQs until the port is up.
662 disable_irq_nosync(vdev->rx_irq);
663 vio_port_up(&port->vio);
664 enable_irq(vdev->rx_irq);
671 tty_unregister_device(vcc_tty_driver, port->index);
673 vcc_table_remove(port->index);
675 vio_ldc_free(&port->vio);
684 * vcc_remove() - Terminate a VCC port
685 * @vdev: Pointer to VIO device of the VCC port
687 * Terminates a VCC port. Sets up the teardown of TTY and
688 * VIO/LDC link between guest and primary domains.
690 * Return: status of removal
692 static int vcc_remove(struct vio_dev *vdev)
694 struct vcc_port *port = dev_get_drvdata(&vdev->dev);
699 del_timer_sync(&port->rx_timer);
700 del_timer_sync(&port->tx_timer);
702 /* If there's a process with the device open, do a synchronous
703 * hangup of the TTY. This *may* cause the process to call close
704 * asynchronously, but it's not guaranteed.
707 tty_vhangup(port->tty);
709 /* Get exclusive reference to VCC, ensures that there are no other
710 * clients to this port
712 port = vcc_get(port->index, true);
717 tty_unregister_device(vcc_tty_driver, port->index);
719 del_timer_sync(&port->vio.timer);
720 vio_ldc_free(&port->vio);
721 sysfs_remove_group(&vdev->dev.kobj, &vcc_attribute_group);
722 dev_set_drvdata(&vdev->dev, NULL);
724 port->removed = true;
727 vcc_table_remove(port->index);
729 kfree(port->vio.name);
737 static const struct vio_device_id vcc_match[] = {
743 MODULE_DEVICE_TABLE(vio, vcc_match);
745 static struct vio_driver vcc_driver = {
746 .id_table = vcc_match,
748 .remove = vcc_remove,
752 static int vcc_open(struct tty_struct *tty, struct file *vcc_file)
754 struct vcc_port *port;
756 if (unlikely(!tty)) {
757 pr_err("VCC: open: Invalid TTY handle\n");
764 port = vcc_get_ne(tty->index);
765 if (unlikely(!port)) {
766 pr_err("VCC: open: Failed to find VCC port\n");
770 if (unlikely(!port->vio.lp)) {
771 pr_err("VCC: open: LDC channel not configured\n");
772 vcc_put(port, false);
775 vccdbgl(port->vio.lp);
777 vcc_put(port, false);
779 if (unlikely(!tty->port)) {
780 pr_err("VCC: open: TTY port not found\n");
784 if (unlikely(!tty->port->ops)) {
785 pr_err("VCC: open: TTY ops not defined\n");
789 return tty_port_open(tty->port, tty, vcc_file);
792 static void vcc_close(struct tty_struct *tty, struct file *vcc_file)
794 if (unlikely(!tty)) {
795 pr_err("VCC: close: Invalid TTY handle\n");
799 if (unlikely(tty->count > 1))
802 if (unlikely(!tty->port)) {
803 pr_err("VCC: close: TTY port not found\n");
807 tty_port_close(tty->port, tty, vcc_file);
810 static void vcc_ldc_hup(struct vcc_port *port)
814 spin_lock_irqsave(&port->lock, flags);
816 if (vcc_send_ctl(port, VCC_CTL_HUP) < 0)
819 spin_unlock_irqrestore(&port->lock, flags);
822 static void vcc_hangup(struct tty_struct *tty)
824 struct vcc_port *port;
826 if (unlikely(!tty)) {
827 pr_err("VCC: hangup: Invalid TTY handle\n");
831 port = vcc_get_ne(tty->index);
832 if (unlikely(!port)) {
833 pr_err("VCC: hangup: Failed to find VCC port\n");
837 if (unlikely(!tty->port)) {
838 pr_err("VCC: hangup: TTY port not found\n");
839 vcc_put(port, false);
845 vcc_put(port, false);
847 tty_port_hangup(tty->port);
850 static int vcc_write(struct tty_struct *tty, const unsigned char *buf,
853 struct vcc_port *port;
860 if (unlikely(!tty)) {
861 pr_err("VCC: write: Invalid TTY handle\n");
865 port = vcc_get_ne(tty->index);
866 if (unlikely(!port)) {
867 pr_err("VCC: write: Failed to find VCC port");
871 spin_lock_irqsave(&port->lock, flags);
874 pkt->tag.type = VIO_TYPE_DATA;
877 /* Minimum of data to write and space available */
878 tosend = min(count, (VCC_BUFF_LEN - port->chars_in_buffer));
883 memcpy(&pkt->data[port->chars_in_buffer], &buf[total_sent],
885 port->chars_in_buffer += tosend;
886 pkt->tag.stype = tosend;
888 vccdbg("TAG [%02x:%02x:%04x:%08x]\n", pkt->tag.type,
889 pkt->tag.stype, pkt->tag.stype_env, pkt->tag.sid);
890 vccdbg("DATA [%s]\n", pkt->data);
891 vccdbgl(port->vio.lp);
893 /* Since we know we have enough room in VCC buffer for tosend
894 * we record that it was sent regardless of whether the
895 * hypervisor actually took it because we have it buffered.
897 rv = ldc_write(port->vio.lp, pkt, (VIO_TAG_SIZE + tosend));
898 vccdbg("VCC: write: ldc_write(%d)=%d\n",
899 (VIO_TAG_SIZE + tosend), rv);
901 total_sent += tosend;
908 port->chars_in_buffer = 0;
911 spin_unlock_irqrestore(&port->lock, flags);
913 vcc_put(port, false);
915 vccdbg("VCC: write: total=%d rv=%d", total_sent, rv);
917 return total_sent ? total_sent : rv;
920 static int vcc_write_room(struct tty_struct *tty)
922 struct vcc_port *port;
925 if (unlikely(!tty)) {
926 pr_err("VCC: write_room: Invalid TTY handle\n");
930 port = vcc_get_ne(tty->index);
931 if (unlikely(!port)) {
932 pr_err("VCC: write_room: Failed to find VCC port\n");
936 num = VCC_BUFF_LEN - port->chars_in_buffer;
938 vcc_put(port, false);
943 static int vcc_chars_in_buffer(struct tty_struct *tty)
945 struct vcc_port *port;
948 if (unlikely(!tty)) {
949 pr_err("VCC: chars_in_buffer: Invalid TTY handle\n");
953 port = vcc_get_ne(tty->index);
954 if (unlikely(!port)) {
955 pr_err("VCC: chars_in_buffer: Failed to find VCC port\n");
959 num = port->chars_in_buffer;
961 vcc_put(port, false);
966 static int vcc_break_ctl(struct tty_struct *tty, int state)
968 struct vcc_port *port;
971 if (unlikely(!tty)) {
972 pr_err("VCC: break_ctl: Invalid TTY handle\n");
976 port = vcc_get_ne(tty->index);
977 if (unlikely(!port)) {
978 pr_err("VCC: break_ctl: Failed to find VCC port\n");
984 vcc_put(port, false);
988 spin_lock_irqsave(&port->lock, flags);
990 if (vcc_send_ctl(port, VCC_CTL_BREAK) < 0)
993 spin_unlock_irqrestore(&port->lock, flags);
995 vcc_put(port, false);
1000 static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)
1002 struct vcc_port *port_vcc;
1003 struct tty_port *port_tty;
1006 if (unlikely(!tty)) {
1007 pr_err("VCC: install: Invalid TTY handle\n");
1011 if (tty->index >= VCC_MAX_PORTS)
1014 ret = tty_standard_install(driver, tty);
1018 port_tty = kzalloc(sizeof(struct tty_port), GFP_KERNEL);
1022 port_vcc = vcc_get(tty->index, true);
1024 pr_err("VCC: install: Failed to find VCC port\n");
1030 tty_port_init(port_tty);
1031 port_tty->ops = &vcc_port_ops;
1032 tty->port = port_tty;
1034 port_vcc->tty = tty;
1036 vcc_put(port_vcc, true);
1041 static void vcc_cleanup(struct tty_struct *tty)
1043 struct vcc_port *port;
1045 if (unlikely(!tty)) {
1046 pr_err("VCC: cleanup: Invalid TTY handle\n");
1050 port = vcc_get(tty->index, true);
1054 if (port->removed) {
1055 vcc_table_remove(tty->index);
1056 kfree(port->vio.name);
1057 kfree(port->domain);
1060 vcc_put(port, true);
1064 tty_port_destroy(tty->port);
1069 static const struct tty_operations vcc_ops = {
1072 .hangup = vcc_hangup,
1074 .write_room = vcc_write_room,
1075 .chars_in_buffer = vcc_chars_in_buffer,
1076 .break_ctl = vcc_break_ctl,
1077 .install = vcc_install,
1078 .cleanup = vcc_cleanup,
1081 #define VCC_TTY_FLAGS (TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_REAL_RAW)
1083 static int vcc_tty_init(void)
1087 pr_info("VCC: %s\n", version);
1089 vcc_tty_driver = tty_alloc_driver(VCC_MAX_PORTS, VCC_TTY_FLAGS);
1090 if (IS_ERR(vcc_tty_driver)) {
1091 pr_err("VCC: TTY driver alloc failed\n");
1092 return PTR_ERR(vcc_tty_driver);
1095 vcc_tty_driver->driver_name = vcc_driver_name;
1096 vcc_tty_driver->name = vcc_device_node;
1098 vcc_tty_driver->minor_start = VCC_MINOR_START;
1099 vcc_tty_driver->type = TTY_DRIVER_TYPE_SYSTEM;
1100 vcc_tty_driver->init_termios = vcc_tty_termios;
1102 tty_set_operations(vcc_tty_driver, &vcc_ops);
1104 rv = tty_register_driver(vcc_tty_driver);
1106 pr_err("VCC: TTY driver registration failed\n");
1107 put_tty_driver(vcc_tty_driver);
1108 vcc_tty_driver = NULL;
1112 vccdbg("VCC: TTY driver registered\n");
1117 static void vcc_tty_exit(void)
1119 tty_unregister_driver(vcc_tty_driver);
1120 put_tty_driver(vcc_tty_driver);
1121 vccdbg("VCC: TTY driver unregistered\n");
1123 vcc_tty_driver = NULL;
1126 static int __init vcc_init(void)
1130 rv = vcc_tty_init();
1132 pr_err("VCC: TTY init failed\n");
1136 rv = vio_register_driver(&vcc_driver);
1138 pr_err("VCC: VIO driver registration failed\n");
1141 vccdbg("VCC: VIO driver registered successfully\n");
1147 static void __exit vcc_exit(void)
1149 vio_unregister_driver(&vcc_driver);
1150 vccdbg("VCC: VIO driver unregistered\n");
1152 vccdbg("VCC: TTY driver unregistered\n");
1155 module_init(vcc_init);
1156 module_exit(vcc_exit);