aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-09-19 16:13:21 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:21 -0400
commit6f6412b4c76441f2060e580b8d5cbda07dabde37 (patch)
tree9970a24ad9f8f602f1ea0fb4300218e1d753eec9 /drivers
parent1e2b025453d45d35b07d8105bea7fc9d339ff562 (diff)
isicom: Split the close hardware bits out
Start to extract and build a model for a common tty_port_close() Signed-off-by: Alan Cox <alan@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/isicom.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 4f1f4cd670da..08f574333a57 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -952,19 +952,12 @@ static void isicom_flush_buffer(struct tty_struct *tty)
952 tty_wakeup(tty); 952 tty_wakeup(tty);
953} 953}
954 954
955static void isicom_close(struct tty_struct *tty, struct file *filp) 955static void isicom_close_port(struct tty_port *port)
956{ 956{
957 struct isi_port *ip = tty->driver_data; 957 struct isi_port *ip = container_of(port, struct isi_port, port);
958 struct tty_port *port = &ip->port; 958 struct isi_board *card = ip->card;
959 struct isi_board *card;
960 unsigned long flags; 959 unsigned long flags;
961 960
962 BUG_ON(!ip);
963
964 card = ip->card;
965 if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
966 return;
967
968 /* indicate to the card that no more data can be received 961 /* indicate to the card that no more data can be received
969 on this port */ 962 on this port */
970 spin_lock_irqsave(&card->card_lock, flags); 963 spin_lock_irqsave(&card->card_lock, flags);
@@ -974,9 +967,19 @@ static void isicom_close(struct tty_struct *tty, struct file *filp)
974 } 967 }
975 isicom_shutdown_port(ip); 968 isicom_shutdown_port(ip);
976 spin_unlock_irqrestore(&card->card_lock, flags); 969 spin_unlock_irqrestore(&card->card_lock, flags);
970}
977 971
972static void isicom_close(struct tty_struct *tty, struct file *filp)
973{
974 struct isi_port *ip = tty->driver_data;
975 struct tty_port *port = &ip->port;
976 if (isicom_paranoia_check(ip, tty->name, "isicom_close"))
977 return;
978
979 if (tty_port_close_start(port, tty, filp) == 0)
980 return;
981 isicom_close_port(port);
978 isicom_flush_buffer(tty); 982 isicom_flush_buffer(tty);
979
980 tty_port_close_end(port, tty); 983 tty_port_close_end(port, tty);
981} 984}
982 985