diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-09-11 13:14:09 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-09-12 20:30:44 -0400 |
commit | 2c75ada6250990ea859b0b5498cb0b7c2823a9d7 (patch) | |
tree | e39a322d8400c85fbebfb658955a240aff4a4049 /drivers/input | |
parent | 76460a7becadbda5589057ee8394cbc98717c324 (diff) |
Input: psmouse - add psmouse_matches_pnp_id helper function
The matches_pnp_id function from the synaptics driver is useful for other
drivers too. Make it a generic psmouse helper function.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 14 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse.h | 1 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 17 |
3 files changed, 18 insertions, 14 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index cff065f6261c..bc1bc2653f15 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -462,6 +462,20 @@ static int psmouse_poll(struct psmouse *psmouse) | |||
462 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); | 462 | PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)); |
463 | } | 463 | } |
464 | 464 | ||
465 | /* | ||
466 | * psmouse_matches_pnp_id - check if psmouse matches one of the passed in ids. | ||
467 | */ | ||
468 | bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) | ||
469 | { | ||
470 | int i; | ||
471 | |||
472 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) | ||
473 | for (i = 0; ids[i]; i++) | ||
474 | if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) | ||
475 | return true; | ||
476 | |||
477 | return false; | ||
478 | } | ||
465 | 479 | ||
466 | /* | 480 | /* |
467 | * Genius NetMouse magic init. | 481 | * Genius NetMouse magic init. |
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h index 2f0b39d59a9b..f4cf664c7db3 100644 --- a/drivers/input/mouse/psmouse.h +++ b/drivers/input/mouse/psmouse.h | |||
@@ -108,6 +108,7 @@ void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution); | |||
108 | psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse); | 108 | psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse); |
109 | int psmouse_activate(struct psmouse *psmouse); | 109 | int psmouse_activate(struct psmouse *psmouse); |
110 | int psmouse_deactivate(struct psmouse *psmouse); | 110 | int psmouse_deactivate(struct psmouse *psmouse); |
111 | bool psmouse_matches_pnp_id(struct psmouse *psmouse, const char * const ids[]); | ||
111 | 112 | ||
112 | struct psmouse_attribute { | 113 | struct psmouse_attribute { |
113 | struct device_attribute dattr; | 114 | struct device_attribute dattr; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index e8573c68f77e..854caca6e86e 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -185,18 +185,6 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
185 | NULL | 185 | NULL |
186 | }; | 186 | }; |
187 | 187 | ||
188 | static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) | ||
189 | { | ||
190 | int i; | ||
191 | |||
192 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) | ||
193 | for (i = 0; ids[i]; i++) | ||
194 | if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) | ||
195 | return true; | ||
196 | |||
197 | return false; | ||
198 | } | ||
199 | |||
200 | /***************************************************************************** | 188 | /***************************************************************************** |
201 | * Synaptics communications functions | 189 | * Synaptics communications functions |
202 | ****************************************************************************/ | 190 | ****************************************************************************/ |
@@ -362,7 +350,8 @@ static int synaptics_resolution(struct psmouse *psmouse) | |||
362 | } | 350 | } |
363 | 351 | ||
364 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { | 352 | for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) { |
365 | if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) { | 353 | if (psmouse_matches_pnp_id(psmouse, |
354 | min_max_pnpid_table[i].pnp_ids)) { | ||
366 | priv->x_min = min_max_pnpid_table[i].x_min; | 355 | priv->x_min = min_max_pnpid_table[i].x_min; |
367 | priv->x_max = min_max_pnpid_table[i].x_max; | 356 | priv->x_max = min_max_pnpid_table[i].x_max; |
368 | priv->y_min = min_max_pnpid_table[i].y_min; | 357 | priv->y_min = min_max_pnpid_table[i].y_min; |
@@ -1456,7 +1445,7 @@ static void set_input_params(struct psmouse *psmouse, | |||
1456 | 1445 | ||
1457 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 1446 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
1458 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | 1447 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
1459 | if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) | 1448 | if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) |
1460 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); | 1449 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); |
1461 | /* Clickpads report only left button */ | 1450 | /* Clickpads report only left button */ |
1462 | __clear_bit(BTN_RIGHT, dev->keybit); | 1451 | __clear_bit(BTN_RIGHT, dev->keybit); |