Drop tpmode and initial stuff

Andres Salomon dilinger at debian.unroutableorg
Wed Jan 3 03:36:25 EST 2007


Commit:     9f5f04ec772716e8426ec121d3d762ed3d8b6507
Parent:     012df5ea088b7c959bc58d9b7e1729912d742598
commit 9f5f04ec772716e8426ec121d3d762ed3d8b6507
Author:     Andres Salomon <dilinger at debian.org>
AuthorDate: Wed Jan 3 03:41:52 2007 -0500
Commit:     Andres Salomon <dilinger at debian.org>
CommitDate: Wed Jan 3 03:41:52 2007 -0500

    Drop tpmode and initial stuff
    
    The 'initial' member of the olpc_data struct is completely unnecessary.
    Drop it.
    
    tpmode provided a way to specify what modes the driver supported; not
    really worth keeping around, imo.  Drop it.
    
    Signed-off-by: Andres Salomon <dilinger at debian.org>
---
 drivers/input/mouse/olpc.c |   46 ++++++++++++++++++--------------------------
 drivers/input/mouse/olpc.h |    1 -
 2 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/drivers/input/mouse/olpc.c b/drivers/input/mouse/olpc.c
index c5bbc1d..2b6278c 100644
--- a/drivers/input/mouse/olpc.c
+++ b/drivers/input/mouse/olpc.c
@@ -33,8 +33,6 @@ #include <linux/delay.h>
 
 #include "psmouse.h"
 #include "olpc.h"
-static int tpmode = 0;
-module_param(tpmode, int, 0644);
 
 static int tpdebug;
 module_param(tpdebug, int, 0644);
@@ -211,27 +209,19 @@ static struct olpc_model_info *olpc_get_
 	return NULL;
 }
 
-static int olpc_find_mode (struct psmouse *psmouse)
+static int olpc_find_mode(struct psmouse *psmouse)
 {
 	struct olpc_data *priv = psmouse->private;
-	int mode;
-
-	if (tpmode < -1 || tpmode > 4)
-		return -1;
+	int mode = priv->i->flags;
 
-	if (tpmode)
-		priv->i->flags = tpmode;
-
-	mode = priv->i->flags;
-
-	if (mode & OLPC_GS) {
-		priv->initial = OLPC_GS;
-	} else if (mode & OLPC_PT) {
-		priv->initial = OLPC_PT;
-	} else
-		return -1;
+	if (mode & OLPC_GS)
+		mode = OLPC_GS;
+	else if (mode & OLPC_PT)
+		mode = OLPC_PT;
+	else
+		mode = -1;
 
-	return priv->initial;
+	return mode;
 }
 
 /*
@@ -281,10 +271,8 @@ static int olpc_new_mode(struct psmouse 
 		printk(KERN_WARNING __FILE__ ": Switched to mode %d successful.\n", mode);
 
 failed:
-	if (ret) {
-		/* XXX: if this ever fails, we need to do a full reset! */
-		printk(KERN_WARNING __FILE__ ": Mode switch to %d failed. (%d) [%lu]\n", mode, ret, jiffies);
-	}
+	if (ret)
+		printk(KERN_WARNING __FILE__ ": Mode switch to %d failed! (%d) [%lu]\n", mode, ret, jiffies);
 	return ret;
 }
 
@@ -315,16 +303,18 @@ static int olpc_poll(struct psmouse *psm
 static int olpc_reconnect(struct psmouse *psmouse)
 {
 	struct olpc_data *priv = psmouse->private;
+	int mode;
 
 	psmouse_reset(psmouse);
 
 	if (!(priv->i = olpc_get_model(psmouse)))
 		return -1;
 
-	if (olpc_find_mode (psmouse) < 0)
+	mode = olpc_find_mode(psmouse);
+	if (mode < 0)
 		return -1;
 
-	if (olpc_absolute_mode(psmouse, priv->initial)) {
+	if (olpc_absolute_mode(psmouse, mode)) {
 		printk(KERN_ERR __FILE__ ": Failed to reenable absolute mode.\n");
 		return -1;
 	}
@@ -388,6 +378,7 @@ int olpc_init(struct psmouse *psmouse)
 	struct olpc_data *priv;
 	struct input_dev *dev = psmouse->dev;
 	struct input_dev *dev2;
+	int mode;
 
 	priv = kzalloc(sizeof(struct olpc_data), GFP_KERNEL);
 	dev2 = input_allocate_device();
@@ -400,12 +391,13 @@ int olpc_init(struct psmouse *psmouse)
 	if (!(priv->i = olpc_get_model(psmouse)))
 		goto init_fail;
 
-	if (olpc_find_mode (psmouse) < 0) {
+	mode = olpc_find_mode(psmouse);
+	if (mode < 0) {
 		printk(KERN_ERR __FILE__ ": Failed to identify proper mode\n");
 		goto init_fail;
 	}
 
-	if (olpc_absolute_mode(psmouse, priv->initial)) {
+	if (olpc_absolute_mode(psmouse, mode)) {
 		printk(KERN_ERR __FILE__ ": Failed to enable absolute mode\n");
 		goto init_fail;
 	}
diff --git a/drivers/input/mouse/olpc.h b/drivers/input/mouse/olpc.h
index cf4109b..c597a88 100644
--- a/drivers/input/mouse/olpc.h
+++ b/drivers/input/mouse/olpc.h
@@ -28,7 +28,6 @@ struct olpc_data {
 	char name[32];			/* Name */
 	char phys[32];			/* Phys */
 	struct olpc_model_info *i; /* Info */
-	int initial;
 	int pending_mode;
 	int current_mode;
 	struct work_struct mode_switch;


More information about the Commits-kernel mailing list