aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/rio/rio_linux.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/rio/rio_linux.c')
-rw-r--r--drivers/char/rio/rio_linux.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index a8f68a3f14dd..2e8a6eed34be 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -173,7 +173,7 @@ static void rio_disable_tx_interrupts(void *ptr);
173static void rio_enable_tx_interrupts(void *ptr); 173static void rio_enable_tx_interrupts(void *ptr);
174static void rio_disable_rx_interrupts(void *ptr); 174static void rio_disable_rx_interrupts(void *ptr);
175static void rio_enable_rx_interrupts(void *ptr); 175static void rio_enable_rx_interrupts(void *ptr);
176static int rio_get_CD(void *ptr); 176static int rio_carrier_raised(struct tty_port *port);
177static void rio_shutdown_port(void *ptr); 177static void rio_shutdown_port(void *ptr);
178static int rio_set_real_termios(void *ptr); 178static int rio_set_real_termios(void *ptr);
179static void rio_hungup(void *ptr); 179static void rio_hungup(void *ptr);
@@ -224,7 +224,6 @@ static struct real_driver rio_real_driver = {
224 rio_enable_tx_interrupts, 224 rio_enable_tx_interrupts,
225 rio_disable_rx_interrupts, 225 rio_disable_rx_interrupts,
226 rio_enable_rx_interrupts, 226 rio_enable_rx_interrupts,
227 rio_get_CD,
228 rio_shutdown_port, 227 rio_shutdown_port,
229 rio_set_real_termios, 228 rio_set_real_termios,
230 rio_chars_in_buffer, 229 rio_chars_in_buffer,
@@ -476,9 +475,9 @@ static void rio_enable_rx_interrupts(void *ptr)
476 475
477 476
478/* Jeez. Isn't this simple? */ 477/* Jeez. Isn't this simple? */
479static int rio_get_CD(void *ptr) 478static int rio_carrier_raised(struct tty_port *port)
480{ 479{
481 struct Port *PortP = ptr; 480 struct Port *PortP = container_of(port, struct Port, gs.port);
482 int rv; 481 int rv;
483 482
484 func_enter(); 483 func_enter();
@@ -797,16 +796,9 @@ static int rio_init_drivers(void)
797 return 1; 796 return 1;
798} 797}
799 798
800 799static const struct tty_port_operations rio_port_ops = {
801static void *ckmalloc(int size) 800 .carrier_raised = rio_carrier_raised,
802{ 801};
803 void *p;
804
805 p = kzalloc(size, GFP_KERNEL);
806 return p;
807}
808
809
810 802
811static int rio_init_datastructures(void) 803static int rio_init_datastructures(void)
812{ 804{
@@ -826,33 +818,30 @@ static int rio_init_datastructures(void)
826#define TMIO_SZ sizeof(struct termios *) 818#define TMIO_SZ sizeof(struct termios *)
827 rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ); 819 rio_dprintk(RIO_DEBUG_INIT, "getting : %Zd %Zd %Zd %Zd %Zd bytes\n", RI_SZ, RIO_HOSTS * HOST_SZ, RIO_PORTS * PORT_SZ, RIO_PORTS * TMIO_SZ, RIO_PORTS * TMIO_SZ);
828 820
829 if (!(p = ckmalloc(RI_SZ))) 821 if (!(p = kzalloc(RI_SZ, GFP_KERNEL)))
830 goto free0; 822 goto free0;
831 if (!(p->RIOHosts = ckmalloc(RIO_HOSTS * HOST_SZ))) 823 if (!(p->RIOHosts = kzalloc(RIO_HOSTS * HOST_SZ, GFP_KERNEL)))
832 goto free1; 824 goto free1;
833 if (!(p->RIOPortp = ckmalloc(RIO_PORTS * PORT_SZ))) 825 if (!(p->RIOPortp = kzalloc(RIO_PORTS * PORT_SZ, GFP_KERNEL)))
834 goto free2; 826 goto free2;
835 p->RIOConf = RIOConf; 827 p->RIOConf = RIOConf;
836 rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp); 828 rio_dprintk(RIO_DEBUG_INIT, "Got : %p %p %p\n", p, p->RIOHosts, p->RIOPortp);
837 829
838#if 1 830#if 1
839 for (i = 0; i < RIO_PORTS; i++) { 831 for (i = 0; i < RIO_PORTS; i++) {
840 port = p->RIOPortp[i] = ckmalloc(sizeof(struct Port)); 832 port = p->RIOPortp[i] = kzalloc(sizeof(struct Port), GFP_KERNEL);
841 if (!port) { 833 if (!port) {
842 goto free6; 834 goto free6;
843 } 835 }
844 rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped); 836 rio_dprintk(RIO_DEBUG_INIT, "initing port %d (%d)\n", i, port->Mapped);
837 tty_port_init(&port->gs.port);
838 port->gs.port.ops = &rio_port_ops;
845 port->PortNum = i; 839 port->PortNum = i;
846 port->gs.magic = RIO_MAGIC; 840 port->gs.magic = RIO_MAGIC;
847 port->gs.close_delay = HZ / 2; 841 port->gs.close_delay = HZ / 2;
848 port->gs.closing_wait = 30 * HZ; 842 port->gs.closing_wait = 30 * HZ;
849 port->gs.rd = &rio_real_driver; 843 port->gs.rd = &rio_real_driver;
850 spin_lock_init(&port->portSem); 844 spin_lock_init(&port->portSem);
851 /*
852 * Initializing wait queue
853 */
854 init_waitqueue_head(&port->gs.port.open_wait);
855 init_waitqueue_head(&port->gs.port.close_wait);
856 } 845 }
857#else 846#else
858 /* We could postpone initializing them to when they are configured. */ 847 /* We could postpone initializing them to when they are configured. */