aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/isicom.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 08f574333a57..426bfdd7f3e0 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -846,37 +846,53 @@ static int isicom_carrier_raised(struct tty_port *port)
846 return (ip->status & ISI_DCD)?1 : 0; 846 return (ip->status & ISI_DCD)?1 : 0;
847} 847}
848 848
849static int isicom_open(struct tty_struct *tty, struct file *filp) 849static struct tty_port *isicom_find_port(struct tty_struct *tty)
850{ 850{
851 struct isi_port *port; 851 struct isi_port *port;
852 struct isi_board *card; 852 struct isi_board *card;
853 unsigned int board; 853 unsigned int board;
854 int error, line; 854 int line = tty->index;
855 855
856 line = tty->index;
857 if (line < 0 || line > PORT_COUNT-1) 856 if (line < 0 || line > PORT_COUNT-1)
858 return -ENODEV; 857 return NULL;
859 board = BOARD(line); 858 board = BOARD(line);
860 card = &isi_card[board]; 859 card = &isi_card[board];
861 860
862 if (!(card->status & FIRMWARE_LOADED)) 861 if (!(card->status & FIRMWARE_LOADED))
863 return -ENODEV; 862 return NULL;
864 863
865 /* open on a port greater than the port count for the card !!! */ 864 /* open on a port greater than the port count for the card !!! */
866 if (line > ((board * 16) + card->port_count - 1)) 865 if (line > ((board * 16) + card->port_count - 1))
867 return -ENODEV; 866 return NULL;
868 867
869 port = &isi_ports[line]; 868 port = &isi_ports[line];
870 if (isicom_paranoia_check(port, tty->name, "isicom_open")) 869 if (isicom_paranoia_check(port, tty->name, "isicom_open"))
871 return -ENODEV; 870 return NULL;
871
872 return &port->port;
873}
874
875static int isicom_open(struct tty_struct *tty, struct file *filp)
876{
877 struct isi_port *port;
878 struct isi_board *card;
879 struct tty_port *tport;
880 int error = 0;
872 881
882 tport = isicom_find_port(tty);
883 if (tport == NULL)
884 return -ENODEV;
885 port = container_of(tport, struct isi_port, port);
886 card = &isi_card[BOARD(tty->index)];
873 isicom_setup_board(card); 887 isicom_setup_board(card);
874 888
875 /* FIXME: locking on port.count etc */ 889 /* FIXME: locking on port.count etc */
876 port->port.count++; 890 port->port.count++;
877 tty->driver_data = port; 891 tty->driver_data = port;
878 tty_port_tty_set(&port->port, tty); 892 tty_port_tty_set(&port->port, tty);
879 error = isicom_setup_port(tty); 893 /* FIXME: Locking on Initialized flag */
894 if (!test_bit(ASYNCB_INITIALIZED, &tport->flags))
895 error = isicom_setup_port(tty);
880 if (error == 0) 896 if (error == 0)
881 error = tty_port_block_til_ready(&port->port, tty, filp); 897 error = tty_port_block_til_ready(&port->port, tty, filp);
882 return error; 898 return error;