aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-29 15:06:38 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-02-15 19:08:35 -0500
commit290b799c390d77d27effee3ce312203aaa32ee74 (patch)
treea9dcf0b1fdc9e1aacff90afb5b3ab79983115dcc /drivers/input
parent97ae2b5c17d6cc988c6d49ae0cf95befb6b7081c (diff)
Input: psmouse - use IS_ENABLED instead of homegrown code
Instead of having various protocols provide <protocol>_supported() functions, let's use IS_ENABLED() macro that works well in "if" statements. Acked-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/cypress_ps2.c5
-rw-r--r--drivers/input/mouse/cypress_ps2.h5
-rw-r--r--drivers/input/mouse/focaltech.c10
-rw-r--r--drivers/input/mouse/focaltech.h1
-rw-r--r--drivers/input/mouse/psmouse-base.c6
-rw-r--r--drivers/input/mouse/synaptics.c10
-rw-r--r--drivers/input/mouse/synaptics.h1
7 files changed, 3 insertions, 35 deletions
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index 9118a1861a45..28dcfc822bf6 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -710,8 +710,3 @@ err_exit:
710 710
711 return -1; 711 return -1;
712} 712}
713
714bool cypress_supported(void)
715{
716 return true;
717}
diff --git a/drivers/input/mouse/cypress_ps2.h b/drivers/input/mouse/cypress_ps2.h
index 4720f21d2d70..81f68aaed7c8 100644
--- a/drivers/input/mouse/cypress_ps2.h
+++ b/drivers/input/mouse/cypress_ps2.h
@@ -172,7 +172,6 @@ struct cytp_data {
172#ifdef CONFIG_MOUSE_PS2_CYPRESS 172#ifdef CONFIG_MOUSE_PS2_CYPRESS
173int cypress_detect(struct psmouse *psmouse, bool set_properties); 173int cypress_detect(struct psmouse *psmouse, bool set_properties);
174int cypress_init(struct psmouse *psmouse); 174int cypress_init(struct psmouse *psmouse);
175bool cypress_supported(void);
176#else 175#else
177inline int cypress_detect(struct psmouse *psmouse, bool set_properties) 176inline int cypress_detect(struct psmouse *psmouse, bool set_properties)
178{ 177{
@@ -182,10 +181,6 @@ inline int cypress_init(struct psmouse *psmouse)
182{ 181{
183 return -ENOSYS; 182 return -ENOSYS;
184} 183}
185inline bool cypress_supported(void)
186{
187 return 0;
188}
189#endif /* CONFIG_MOUSE_PS2_CYPRESS */ 184#endif /* CONFIG_MOUSE_PS2_CYPRESS */
190 185
191#endif /* _CYPRESS_PS2_H */ 186#endif /* _CYPRESS_PS2_H */
diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c
index fca38ba63bbe..757f78a94aec 100644
--- a/drivers/input/mouse/focaltech.c
+++ b/drivers/input/mouse/focaltech.c
@@ -424,11 +424,6 @@ fail:
424 return error; 424 return error;
425} 425}
426 426
427bool focaltech_supported(void)
428{
429 return true;
430}
431
432#else /* CONFIG_MOUSE_PS2_FOCALTECH */ 427#else /* CONFIG_MOUSE_PS2_FOCALTECH */
433 428
434int focaltech_init(struct psmouse *psmouse) 429int focaltech_init(struct psmouse *psmouse)
@@ -438,9 +433,4 @@ int focaltech_init(struct psmouse *psmouse)
438 return 0; 433 return 0;
439} 434}
440 435
441bool focaltech_supported(void)
442{
443 return false;
444}
445
446#endif /* CONFIG_MOUSE_PS2_FOCALTECH */ 436#endif /* CONFIG_MOUSE_PS2_FOCALTECH */
diff --git a/drivers/input/mouse/focaltech.h b/drivers/input/mouse/focaltech.h
index 71870a9b548a..ca61ebff373e 100644
--- a/drivers/input/mouse/focaltech.h
+++ b/drivers/input/mouse/focaltech.h
@@ -19,6 +19,5 @@
19 19
20int focaltech_detect(struct psmouse *psmouse, bool set_properties); 20int focaltech_detect(struct psmouse *psmouse, bool set_properties);
21int focaltech_init(struct psmouse *psmouse); 21int focaltech_init(struct psmouse *psmouse);
22bool focaltech_supported(void);
23 22
24#endif 23#endif
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 68469feda470..4ccd01d7a48d 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -727,7 +727,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
727 if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) { 727 if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
728 if (max_proto > PSMOUSE_IMEX) { 728 if (max_proto > PSMOUSE_IMEX) {
729 if (!set_properties || focaltech_init(psmouse) == 0) { 729 if (!set_properties || focaltech_init(psmouse) == 0) {
730 if (focaltech_supported()) 730 if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH))
731 return PSMOUSE_FOCALTECH; 731 return PSMOUSE_FOCALTECH;
732 /* 732 /*
733 * Note that we need to also restrict 733 * Note that we need to also restrict
@@ -776,7 +776,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
776 * Try activating protocol, but check if support is enabled first, since 776 * Try activating protocol, but check if support is enabled first, since
777 * we try detecting Synaptics even when protocol is disabled. 777 * we try detecting Synaptics even when protocol is disabled.
778 */ 778 */
779 if (synaptics_supported() && 779 if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) &&
780 (!set_properties || synaptics_init(psmouse) == 0)) { 780 (!set_properties || synaptics_init(psmouse) == 0)) {
781 return PSMOUSE_SYNAPTICS; 781 return PSMOUSE_SYNAPTICS;
782 } 782 }
@@ -801,7 +801,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
801 */ 801 */
802 if (max_proto > PSMOUSE_IMEX && 802 if (max_proto > PSMOUSE_IMEX &&
803 cypress_detect(psmouse, set_properties) == 0) { 803 cypress_detect(psmouse, set_properties) == 0) {
804 if (cypress_supported()) { 804 if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
805 if (cypress_init(psmouse) == 0) 805 if (cypress_init(psmouse) == 0)
806 return PSMOUSE_CYPRESS; 806 return PSMOUSE_CYPRESS;
807 807
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 7e705ee90b86..f2cceb6493a0 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -1454,11 +1454,6 @@ int synaptics_init_relative(struct psmouse *psmouse)
1454 return __synaptics_init(psmouse, false); 1454 return __synaptics_init(psmouse, false);
1455} 1455}
1456 1456
1457bool synaptics_supported(void)
1458{
1459 return true;
1460}
1461
1462#else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 1457#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
1463 1458
1464void __init synaptics_module_init(void) 1459void __init synaptics_module_init(void)
@@ -1470,9 +1465,4 @@ int synaptics_init(struct psmouse *psmouse)
1470 return -ENOSYS; 1465 return -ENOSYS;
1471} 1466}
1472 1467
1473bool synaptics_supported(void)
1474{
1475 return false;
1476}
1477
1478#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ 1468#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 6faf9bb7c117..aedc3299b14e 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -175,6 +175,5 @@ int synaptics_detect(struct psmouse *psmouse, bool set_properties);
175int synaptics_init(struct psmouse *psmouse); 175int synaptics_init(struct psmouse *psmouse);
176int synaptics_init_relative(struct psmouse *psmouse); 176int synaptics_init_relative(struct psmouse *psmouse);
177void synaptics_reset(struct psmouse *psmouse); 177void synaptics_reset(struct psmouse *psmouse);
178bool synaptics_supported(void);
179 178
180#endif /* _SYNAPTICS_H */ 179#endif /* _SYNAPTICS_H */