Skip to contentSkip to conversation

input - wacom : rearrange type enum

PATCH In review Ping Cheng 3 participants 3 messages May 12, 2012 – May 23, 2012

Subsystems (2)
lore
Share & tools
lore

Ping Cheng

author
#0 lore raw

PATCH 1/2 input - wacom : rearrange type enum

So we can simplify a few type related if statements

---
 drivers/input/tablet/wacom_sys.c |   10 +++-------
 drivers/input/tablet/wacom_wac.c |    6 ++----
 drivers/input/tablet/wacom_wac.h |    6 +++---
 3 files changed, 8 insertions(+), 14 deletions(-)
drivers/input/tablet/wacom_sys.c +3 -7
index b3a8bd3..79b5cfb 100644
@@ -440,8 +440,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
 	/* ask to report Wacom data */
 	if (features->device_type == BTN_TOOL_FINGER) {
 		/* if it is an MT Tablet PC touch */
-		if (features->type == TABLETPC2FG ||
-		    features->type == MTSCREEN) {
+		if (features->type > TABLETPC) {
 			do {
 				rep_data[0] = 3;
 				rep_data[1] = 4;
@@ -460,7 +459,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
 			} while ((error < 0 || rep_data[1] != 4) &&
 				 limit++ < WAC_MSG_RETRIES);
 		}
-	} else if (features->type != TABLETPC &&
+	} else if (features->type <= BAMBOO_PT &&
 		   features->type != WIRELESS &&
 		   features->device_type == BTN_TOOL_PEN) {
 		do {
@@ -510,10 +509,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
 	}
 
 	/* only devices that support touch need to retrieve the info */
-	if (features->type != TABLETPC &&
-	    features->type != TABLETPC2FG &&
-	    features->type != BAMBOO_PT &&
-	    features->type != MTSCREEN) {
+	if (features->type < BAMBOO_PT) {
 		goto out;
 	}
 
drivers/input/tablet/wacom_wac.c +2 -4
index 004bc1b..c40dcb7 100644
@@ -1317,10 +1317,8 @@ void wacom_setup_device_quirks(struct wacom_features *features)
 	}
 
 	/* these device have multiple inputs */
-	if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-	    features->type == BAMBOO_PT || features->type == WIRELESS ||
-	    (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
-	    features->type == MTSCREEN)
+	if (features->type >= WIRELESS ||
+	    (features->type >= INTUOS5S && features->type <= INTUOS5L))
 		features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
 	/* quirk for bamboo touch with 2 low res touches */
drivers/input/tablet/wacom_wac.h +3 -3
index 78fbd3f..8708043 100644
@@ -62,8 +62,6 @@ enum {
 	PTU,
 	PL,
 	DTU,
-	BAMBOO_PT,
-	WIRELESS,
 	INTUOS,
 	INTUOS3S,
 	INTUOS3,
@@ -79,7 +77,9 @@ enum {
 	CINTIQ,
 	WACOM_BEE,
 	WACOM_MO,
-	TABLETPC,
+	WIRELESS,
+	BAMBOO_PT,
+	TABLETPC,   /* add new TPC below */
 	TABLETPC2FG,
 	MTSCREEN,
 	MAX_TYPE
Signature · 1 line
1.7.9.5
Acked-by on v1 1/2
#1 lore raw

For both patches:

Quoted 88 lines · Ping Cheng

So we can simplify a few type related if statements

---

 drivers/input/tablet/wacom_sys.c |   10 +++-------
 drivers/input/tablet/wacom_wac.c |    6 ++----
 drivers/input/tablet/wacom_wac.h |    6 +++---
 3 files changed, 8 insertions(+), 14 deletions(-)
drivers/input/tablet/wacom_sys.c +2 -3
index b3a8bd3..79b5cfb 100644
@@ -440,8 +440,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
        /* ask to report Wacom data */
        if (features->device_type == BTN_TOOL_FINGER) {
                /* if it is an MT Tablet PC touch */
-               if (features->type == TABLETPC2FG ||
-                   features->type == MTSCREEN) {
+               if (features->type > TABLETPC) {
                        do {
                                rep_data[0] = 3;
                                rep_data[1] = 4;
@@ -460,7 +459,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
                        } while ((error < 0 || rep_data[1] != 4) &&
                                 limit++ < WAC_MSG_RETRIES);
                }
-       } else if (features->type != TABLETPC &&
+       } else if (features->type <= BAMBOO_PT &&

                  features->type != WIRELESS && features->device_type == BTN_TOOL_PEN) { do {

drivers/input/tablet/wacom_sys.c +1 -4
@@ -510,10 +509,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
        }
 
        /* only devices that support touch need to retrieve the info */
-       if (features->type != TABLETPC &&
-           features->type != TABLETPC2FG &&
-           features->type != BAMBOO_PT &&
-           features->type != MTSCREEN) {
+       if (features->type < BAMBOO_PT) {
                goto out;
        }
 
drivers/input/tablet/wacom_wac.c +2 -4
index 004bc1b..c40dcb7 100644
@@ -1317,10 +1317,8 @@ void wacom_setup_device_quirks(struct wacom_features *features)
        }
 
        /* these device have multiple inputs */
-       if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-           features->type == BAMBOO_PT || features->type == WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
-           features->type == MTSCREEN)
+       if (features->type >= WIRELESS ||
+           (features->type >= INTUOS5S && features->type <= INTUOS5L))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
        /* quirk for bamboo touch with 2 low res touches */
drivers/input/tablet/wacom_wac.h +3 -3
index 78fbd3f..8708043 100644
@@ -62,8 +62,6 @@ enum {
        PTU,
        PL,
        DTU,
-       BAMBOO_PT,
-       WIRELESS,
        INTUOS,
        INTUOS3S,
        INTUOS3,
@@ -79,7 +77,9 @@ enum {
        CINTIQ,
        WACOM_BEE,
        WACOM_MO,
-       TABLETPC,
+       WIRELESS,
+       BAMBOO_PT,
+       TABLETPC,   /* add new TPC below */
        TABLETPC2FG,
        MTSCREEN,

       MAX_TYPE
--
1.7.9.5

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v1 1/2
#2 lore raw
In reply to Ping Cheng
Quoted 88 lines · Ping Cheng

So we can simplify a few type related if statements

---

 drivers/input/tablet/wacom_sys.c |   10 +++-------
 drivers/input/tablet/wacom_wac.c |    6 ++----
 drivers/input/tablet/wacom_wac.h |    6 +++---
 3 files changed, 8 insertions(+), 14 deletions(-)
drivers/input/tablet/wacom_sys.c +2 -3
index b3a8bd3..79b5cfb 100644
@@ -440,8 +440,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
        /* ask to report Wacom data */
        if (features->device_type == BTN_TOOL_FINGER) {
                /* if it is an MT Tablet PC touch */
-               if (features->type == TABLETPC2FG ||
-                   features->type == MTSCREEN) {
+               if (features->type > TABLETPC) {
                        do {
                                rep_data[0] = 3;
                                rep_data[1] = 4;
@@ -460,7 +459,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
                        } while ((error < 0 || rep_data[1] != 4) &&
                                 limit++ < WAC_MSG_RETRIES);
                }
-       } else if (features->type != TABLETPC &&
+       } else if (features->type <= BAMBOO_PT &&

                  features->type != WIRELESS && features->device_type == BTN_TOOL_PEN) { do {

drivers/input/tablet/wacom_sys.c +1 -4
@@ -510,10 +509,7 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
        }
 
        /* only devices that support touch need to retrieve the info */
-       if (features->type != TABLETPC &&
-           features->type != TABLETPC2FG &&
-           features->type != BAMBOO_PT &&
-           features->type != MTSCREEN) {
+       if (features->type < BAMBOO_PT) {
                goto out;
        }
 
drivers/input/tablet/wacom_wac.c +2 -4
index 004bc1b..c40dcb7 100644
@@ -1317,10 +1317,8 @@ void wacom_setup_device_quirks(struct wacom_features *features)
        }
 
        /* these device have multiple inputs */
-       if (features->type == TABLETPC || features->type == TABLETPC2FG ||
-           features->type == BAMBOO_PT || features->type == WIRELESS ||
-           (features->type >= INTUOS5S && features->type <= INTUOS5L) ||
-           features->type == MTSCREEN)
+       if (features->type >= WIRELESS ||
+           (features->type >= INTUOS5S && features->type <= INTUOS5L))
                features->quirks |= WACOM_QUIRK_MULTI_INPUT;
 
        /* quirk for bamboo touch with 2 low res touches */
drivers/input/tablet/wacom_wac.h +3 -3
index 78fbd3f..8708043 100644
@@ -62,8 +62,6 @@ enum {
        PTU,
        PL,
        DTU,
-       BAMBOO_PT,
-       WIRELESS,
        INTUOS,
        INTUOS3S,
        INTUOS3,
@@ -79,7 +77,9 @@ enum {
        CINTIQ,
        WACOM_BEE,
        WACOM_MO,
-       TABLETPC,
+       WIRELESS,
+       BAMBOO_PT,
+       TABLETPC,   /* add new TPC below */
        TABLETPC2FG,
        MTSCREEN,

       MAX_TYPE
--
1.7.9.5

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

In case this is waiting for a review to come in, for both patches in the set:

Jason

---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html