Staging: quatech_usb2: TIOCMGET and TIOCMSET removal

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, September 16, 2009 - 9:01 am

Gitweb:     http://git.kernel.org/linus/dbe2481580a6933c07627d4da0d20db5fd05a044
Commit:     dbe2481580a6933c07627d4da0d20db5fd05a044
Parent:     89b5098d8ea97eb29c064a0e093f48b7618fc88e
Author:     Richard Ash <richard@audacityteam.org>
AuthorDate: Mon Aug 17 10:39:58 2009 +0100
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Tue Sep 15 12:01:36 2009 -0700

    Staging: quatech_usb2: TIOCMGET and TIOCMSET removal
    
    Patch to remove TIOCMGET and TIOCMSET from the driver ioctl method, as
    they never get used (error in vendor driver).
    
    Signed-off-by: Richard Ash <richard@audacityteam.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/quatech_usb2/quatech_usb2.c |   32 +++++++++++---------------
 1 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/quatech_usb2/quatech_usb2.c b/drivers/staging/quatech_usb2/quatech_usb2.c
index 55a25e5..a877e48 100644
--- a/drivers/staging/quatech_usb2/quatech_usb2.c
+++ b/drivers/staging/quatech_usb2/quatech_usb2.c
@@ -860,7 +860,10 @@ static int qt2_chars_in_buffer(struct tty_struct *tty)
 	return chars;
 }
 
-
+/* called when userspace does an ioctl() on the device. Note that
+ * TIOCMGET and TIOCMSET are filtered off to their own methods before they get
+ * here, so we don't have to handle them.
+ */
 static int qt2_ioctl(struct tty_struct *tty, struct file *file,
 		     unsigned int cmd, unsigned long arg)
 {
@@ -887,22 +890,12 @@ static int qt2_ioctl(struct tty_struct *tty, struct file *file,
 	dbg("%s(): port %d, UartNumber %d, tty =0x%p", __func__,
 	    port->number, UartNumber, tty);
 
-	if (cmd == TIOCMGET) {
-		return qt2_tiocmget(tty, file);
-		/* same as tiocmget function */
-	} else if (cmd == TIOCMSET) {
-		if (copy_from_user(&value, (unsigned int *)arg,
-			sizeof(unsigned int)))
-			return -EFAULT;
-		return qt2_tiocmset(tty, file, value, 0);
-		/* same as tiocmset function */
-	} else if (cmd == TIOCMBIS || cmd == TIOCMBIC) {
-		status = qt2_box_get_register(port->serial, UartNumber,
-				QT2_MODEM_CONTROL_REGISTER, &mcr_value);
-		if (status < 0)
+	if (cmd == TIOCMBIS || cmd == TIOCMBIC) {
+		if (qt2_box_get_register(port->serial, UartNumber,
+			QT2_MODEM_CONTROL_REGISTER, &mcr_value) < 0)
 			return -ESPIPE;
 		if (copy_from_user(&value, (unsigned int *)arg,
-			sizeof(unsigned int)))
+			sizeof(value)))
 			return -EFAULT;
 
 		switch (cmd) {
@@ -925,9 +918,8 @@ static int qt2_ioctl(struct tty_struct *tty, struct file *file,
 		default:
 		break;
 		}	/* end of local switch on cmd */
-		status = qt2_box_set_register(port->serial,  UartNumber,
-				QT2_MODEM_CONTROL_REGISTER, mcr_value);
-		if (status < 0) {
+		if (qt2_box_set_register(port->serial,  UartNumber,
+		    QT2_MODEM_CONTROL_REGISTER, mcr_value) < 0) {
 			return -ESPIPE;
 		} else {
 			port_extra->shadowMCR = mcr_value;
@@ -965,6 +957,10 @@ static int qt2_ioctl(struct tty_struct *tty, struct file *file,
 				return 0;
 			}
 		} /* end inifinite while */
+		/* FIXME: This while loop needs a way to break out if the device
+		 * is disconnected while a process is waiting for the MSR to
+		 * change, because once it's disconnected, it isn't going to
+		 * change state ... */
 	} else {
 		/* any other ioctls we don't know about come here */
 		dbg("%s(): No ioctl for that one. port = %d", __func__,
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Staging: quatech_usb2: TIOCMGET and TIOCMSET removal, Linux Kernel Mailing ..., (Wed Sep 16, 9:01 am)