From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Hans de Goede <hdegoede@redhat.com>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Thomas Hellstrom <thellstrom@vmware.com>,
pali.rohar@gmail.com, jckeerthan@gmail.com,
till2.schaefer@uni-dortmund.de, linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] Input: psmouse - move protocol descriptions around
Date: Sat, 28 Nov 2015 21:13:54 -0800 [thread overview]
Message-ID: <1448774036-39040-5-git-send-email-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <1448774036-39040-1-git-send-email-dmitry.torokhov@gmail.com>
We move protocol descriptions and psmouse_find_by_type() and
pmouse_find_by_name() so that we can use them without forward declarations
in the subsequent patches.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/mouse/psmouse-base.c | 379 ++++++++++++++++++-------------------
1 file changed, 189 insertions(+), 190 deletions(-)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index c2bd866..b92c1bd 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -683,6 +683,195 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties)
return 0;
}
+static const struct psmouse_protocol psmouse_protocols[] = {
+ {
+ .type = PSMOUSE_PS2,
+ .name = "PS/2",
+ .alias = "bare",
+ .maxproto = true,
+ .ignore_parity = true,
+ .detect = ps2bare_detect,
+ },
+#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
+ {
+ .type = PSMOUSE_PS2PP,
+ .name = "PS2++",
+ .alias = "logitech",
+ .detect = ps2pp_init,
+ },
+#endif
+ {
+ .type = PSMOUSE_THINKPS,
+ .name = "ThinkPS/2",
+ .alias = "thinkps",
+ .detect = thinking_detect,
+ },
+#ifdef CONFIG_MOUSE_PS2_CYPRESS
+ {
+ .type = PSMOUSE_CYPRESS,
+ .name = "CyPS/2",
+ .alias = "cypress",
+ .detect = cypress_detect,
+ .init = cypress_init,
+ },
+#endif
+ {
+ .type = PSMOUSE_GENPS,
+ .name = "GenPS/2",
+ .alias = "genius",
+ .detect = genius_detect,
+ },
+ {
+ .type = PSMOUSE_IMPS,
+ .name = "ImPS/2",
+ .alias = "imps",
+ .maxproto = true,
+ .ignore_parity = true,
+ .detect = intellimouse_detect,
+ },
+ {
+ .type = PSMOUSE_IMEX,
+ .name = "ImExPS/2",
+ .alias = "exps",
+ .maxproto = true,
+ .ignore_parity = true,
+ .detect = im_explorer_detect,
+ },
+#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
+ {
+ .type = PSMOUSE_SYNAPTICS,
+ .name = "SynPS/2",
+ .alias = "synaptics",
+ .detect = synaptics_detect,
+ .init = synaptics_init,
+ },
+ {
+ .type = PSMOUSE_SYNAPTICS_RELATIVE,
+ .name = "SynRelPS/2",
+ .alias = "synaptics-relative",
+ .detect = synaptics_detect,
+ .init = synaptics_init_relative,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_ALPS
+ {
+ .type = PSMOUSE_ALPS,
+ .name = "AlpsPS/2",
+ .alias = "alps",
+ .detect = alps_detect,
+ .init = alps_init,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
+ {
+ .type = PSMOUSE_LIFEBOOK,
+ .name = "LBPS/2",
+ .alias = "lifebook",
+ .init = lifebook_init,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
+ {
+ .type = PSMOUSE_TRACKPOINT,
+ .name = "TPPS/2",
+ .alias = "trackpoint",
+ .detect = trackpoint_detect,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
+ {
+ .type = PSMOUSE_TOUCHKIT_PS2,
+ .name = "touchkitPS/2",
+ .alias = "touchkit",
+ .detect = touchkit_ps2_detect,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_OLPC
+ {
+ .type = PSMOUSE_HGPK,
+ .name = "OLPC HGPK",
+ .alias = "hgpk",
+ .detect = hgpk_detect,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_ELANTECH
+ {
+ .type = PSMOUSE_ELANTECH,
+ .name = "ETPS/2",
+ .alias = "elantech",
+ .detect = elantech_detect,
+ .init = elantech_init,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_SENTELIC
+ {
+ .type = PSMOUSE_FSP,
+ .name = "FSPPS/2",
+ .alias = "fsp",
+ .detect = fsp_detect,
+ .init = fsp_init,
+ },
+#endif
+ {
+ .type = PSMOUSE_CORTRON,
+ .name = "CortronPS/2",
+ .alias = "cortps",
+ .detect = cortron_detect,
+ },
+#ifdef CONFIG_MOUSE_PS2_FOCALTECH
+ {
+ .type = PSMOUSE_FOCALTECH,
+ .name = "FocalTechPS/2",
+ .alias = "focaltech",
+ .detect = focaltech_detect,
+ .init = focaltech_init,
+ },
+#endif
+#ifdef CONFIG_MOUSE_PS2_VMMOUSE
+ {
+ .type = PSMOUSE_VMMOUSE,
+ .name = VMMOUSE_PSNAME,
+ .alias = "vmmouse",
+ .detect = vmmouse_detect,
+ .init = vmmouse_init,
+ },
+#endif
+ {
+ .type = PSMOUSE_AUTO,
+ .name = "auto",
+ .alias = "any",
+ .maxproto = true,
+ },
+};
+
+static const struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++)
+ if (psmouse_protocols[i].type == type)
+ return &psmouse_protocols[i];
+
+ WARN_ON(1);
+ return &psmouse_protocols[0];
+}
+
+static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len)
+{
+ const struct psmouse_protocol *p;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) {
+ p = &psmouse_protocols[i];
+
+ if ((strlen(p->name) == len && !strncmp(p->name, name, len)) ||
+ (strlen(p->alias) == len && !strncmp(p->alias, name, len)))
+ return &psmouse_protocols[i];
+ }
+
+ return NULL;
+}
+
/*
* Apply default settings to the psmouse structure. Most of them will
* be overridden by individual protocol initialization routines.
@@ -954,196 +1143,6 @@ static int psmouse_extensions(struct psmouse *psmouse,
return PSMOUSE_PS2;
}
-static const struct psmouse_protocol psmouse_protocols[] = {
- {
- .type = PSMOUSE_PS2,
- .name = "PS/2",
- .alias = "bare",
- .maxproto = true,
- .ignore_parity = true,
- .detect = ps2bare_detect,
- },
-#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
- {
- .type = PSMOUSE_PS2PP,
- .name = "PS2++",
- .alias = "logitech",
- .detect = ps2pp_init,
- },
-#endif
- {
- .type = PSMOUSE_THINKPS,
- .name = "ThinkPS/2",
- .alias = "thinkps",
- .detect = thinking_detect,
- },
-#ifdef CONFIG_MOUSE_PS2_CYPRESS
- {
- .type = PSMOUSE_CYPRESS,
- .name = "CyPS/2",
- .alias = "cypress",
- .detect = cypress_detect,
- .init = cypress_init,
- },
-#endif
- {
- .type = PSMOUSE_GENPS,
- .name = "GenPS/2",
- .alias = "genius",
- .detect = genius_detect,
- },
- {
- .type = PSMOUSE_IMPS,
- .name = "ImPS/2",
- .alias = "imps",
- .maxproto = true,
- .ignore_parity = true,
- .detect = intellimouse_detect,
- },
- {
- .type = PSMOUSE_IMEX,
- .name = "ImExPS/2",
- .alias = "exps",
- .maxproto = true,
- .ignore_parity = true,
- .detect = im_explorer_detect,
- },
-#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
- {
- .type = PSMOUSE_SYNAPTICS,
- .name = "SynPS/2",
- .alias = "synaptics",
- .detect = synaptics_detect,
- .init = synaptics_init,
- },
- {
- .type = PSMOUSE_SYNAPTICS_RELATIVE,
- .name = "SynRelPS/2",
- .alias = "synaptics-relative",
- .detect = synaptics_detect,
- .init = synaptics_init_relative,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_ALPS
- {
- .type = PSMOUSE_ALPS,
- .name = "AlpsPS/2",
- .alias = "alps",
- .detect = alps_detect,
- .init = alps_init,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
- {
- .type = PSMOUSE_LIFEBOOK,
- .name = "LBPS/2",
- .alias = "lifebook",
- .init = lifebook_init,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
- {
- .type = PSMOUSE_TRACKPOINT,
- .name = "TPPS/2",
- .alias = "trackpoint",
- .detect = trackpoint_detect,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
- {
- .type = PSMOUSE_TOUCHKIT_PS2,
- .name = "touchkitPS/2",
- .alias = "touchkit",
- .detect = touchkit_ps2_detect,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_OLPC
- {
- .type = PSMOUSE_HGPK,
- .name = "OLPC HGPK",
- .alias = "hgpk",
- .detect = hgpk_detect,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_ELANTECH
- {
- .type = PSMOUSE_ELANTECH,
- .name = "ETPS/2",
- .alias = "elantech",
- .detect = elantech_detect,
- .init = elantech_init,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_SENTELIC
- {
- .type = PSMOUSE_FSP,
- .name = "FSPPS/2",
- .alias = "fsp",
- .detect = fsp_detect,
- .init = fsp_init,
- },
-#endif
- {
- .type = PSMOUSE_CORTRON,
- .name = "CortronPS/2",
- .alias = "cortps",
- .detect = cortron_detect,
- },
-#ifdef CONFIG_MOUSE_PS2_FOCALTECH
- {
- .type = PSMOUSE_FOCALTECH,
- .name = "FocalTechPS/2",
- .alias = "focaltech",
- .detect = focaltech_detect,
- .init = focaltech_init,
- },
-#endif
-#ifdef CONFIG_MOUSE_PS2_VMMOUSE
- {
- .type = PSMOUSE_VMMOUSE,
- .name = VMMOUSE_PSNAME,
- .alias = "vmmouse",
- .detect = vmmouse_detect,
- .init = vmmouse_init,
- },
-#endif
- {
- .type = PSMOUSE_AUTO,
- .name = "auto",
- .alias = "any",
- .maxproto = true,
- },
-};
-
-static const struct psmouse_protocol *psmouse_protocol_by_type(enum psmouse_type type)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++)
- if (psmouse_protocols[i].type == type)
- return &psmouse_protocols[i];
-
- WARN_ON(1);
- return &psmouse_protocols[0];
-}
-
-static const struct psmouse_protocol *psmouse_protocol_by_name(const char *name, size_t len)
-{
- const struct psmouse_protocol *p;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(psmouse_protocols); i++) {
- p = &psmouse_protocols[i];
-
- if ((strlen(p->name) == len && !strncmp(p->name, name, len)) ||
- (strlen(p->alias) == len && !strncmp(p->alias, name, len)))
- return &psmouse_protocols[i];
- }
-
- return NULL;
-}
-
-
/*
* psmouse_probe() probes for a PS/2 mouse.
*/
--
2.6.0.rc2.230.g3dd15c0
next prev parent reply other threads:[~2015-11-29 5:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-29 5:13 [PATCH 0/6] Only probe select protocols on pass through PS/2 prots Dmitry Torokhov
2015-11-29 5:13 ` [PATCH 1/6] Input: psmouse - use switch statement in psmouse_process_byte() Dmitry Torokhov
2015-12-11 11:37 ` Pali Rohár
2015-11-29 5:13 ` [PATCH 2/6] Input: psmouse - fix comment style Dmitry Torokhov
2015-12-11 11:39 ` Pali Rohár
2015-11-29 5:13 ` [PATCH 3/6] Input: psmouse - rearrange Focaltech init code Dmitry Torokhov
2015-12-11 11:44 ` Pali Rohár
2015-11-29 5:13 ` Dmitry Torokhov [this message]
2015-12-11 11:46 ` [PATCH 4/6] Input: psmouse - move protocol descriptions around Pali Rohár
2015-11-29 5:13 ` [PATCH 5/6] Input: psmouse - factor out common protocol probing code Dmitry Torokhov
2015-12-02 15:20 ` Hans de Goede
2015-12-02 19:18 ` Dmitry Torokhov
2015-12-03 8:33 ` Hans de Goede
2015-11-29 5:13 ` [PATCH 6/6] Input: psmouse - limit protocols that we try on passthrough ports Dmitry Torokhov
2015-12-02 15:21 ` Hans de Goede
2015-12-11 11:50 ` Pali Rohár
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448774036-39040-5-git-send-email-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=hdegoede@redhat.com \
--cc=jckeerthan@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=thellstrom@vmware.com \
--cc=till2.schaefer@uni-dortmund.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).