diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-05-20 01:53:23 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-05-26 18:01:32 -0400 |
commit | e2f611029b370bb7a04236215ad4b36aa8cb98cd (patch) | |
tree | d53262e1baecc0b07e8a4fdbb711ad6313135a11 | |
parent | 6d396ede224dc596d92d7cab433713536e68916c (diff) |
Input: synaptics - add a matches_pnp_id helper function
This is a preparation patch for simplifying the min/max quirk table.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/mouse/synaptics.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 898e8bb170f9..395ec9c5ae9a 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -156,6 +156,18 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
156 | NULL | 156 | NULL |
157 | }; | 157 | }; |
158 | 158 | ||
159 | static bool matches_pnp_id(struct psmouse *psmouse, const char * const ids[]) | ||
160 | { | ||
161 | int i; | ||
162 | |||
163 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) | ||
164 | for (i = 0; ids[i]; i++) | ||
165 | if (strstr(psmouse->ps2dev.serio->firmware_id, ids[i])) | ||
166 | return true; | ||
167 | |||
168 | return false; | ||
169 | } | ||
170 | |||
159 | /***************************************************************************** | 171 | /***************************************************************************** |
160 | * Synaptics communications functions | 172 | * Synaptics communications functions |
161 | ****************************************************************************/ | 173 | ****************************************************************************/ |
@@ -1365,17 +1377,8 @@ static void set_input_params(struct psmouse *psmouse, | |||
1365 | 1377 | ||
1366 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 1378 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
1367 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | 1379 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
1368 | /* See if this buttonpad has a top button area */ | 1380 | if (matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) |
1369 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) { | 1381 | __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); |
1370 | for (i = 0; topbuttonpad_pnp_ids[i]; i++) { | ||
1371 | if (strstr(psmouse->ps2dev.serio->firmware_id, | ||
1372 | topbuttonpad_pnp_ids[i])) { | ||
1373 | __set_bit(INPUT_PROP_TOPBUTTONPAD, | ||
1374 | dev->propbit); | ||
1375 | break; | ||
1376 | } | ||
1377 | } | ||
1378 | } | ||
1379 | /* Clickpads report only left button */ | 1382 | /* Clickpads report only left button */ |
1380 | __clear_bit(BTN_RIGHT, dev->keybit); | 1383 | __clear_bit(BTN_RIGHT, dev->keybit); |
1381 | __clear_bit(BTN_MIDDLE, dev->keybit); | 1384 | __clear_bit(BTN_MIDDLE, dev->keybit); |