Commit 290b799c390d77d27effee3ce312203aaa32ee74

Authored by Dmitry Torokhov
1 parent 97ae2b5c17

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>

Showing 7 changed files with 3 additions and 35 deletions Side-by-side Diff

drivers/input/mouse/cypress_ps2.c
... ... @@ -710,9 +710,4 @@
710 710  
711 711 return -1;
712 712 }
713   -
714   -bool cypress_supported(void)
715   -{
716   - return true;
717   -}
drivers/input/mouse/cypress_ps2.h
... ... @@ -172,7 +172,6 @@
172 172 #ifdef CONFIG_MOUSE_PS2_CYPRESS
173 173 int cypress_detect(struct psmouse *psmouse, bool set_properties);
174 174 int cypress_init(struct psmouse *psmouse);
175   -bool cypress_supported(void);
176 175 #else
177 176 inline int cypress_detect(struct psmouse *psmouse, bool set_properties)
178 177 {
... ... @@ -181,10 +180,6 @@
181 180 inline int cypress_init(struct psmouse *psmouse)
182 181 {
183 182 return -ENOSYS;
184   -}
185   -inline bool cypress_supported(void)
186   -{
187   - return 0;
188 183 }
189 184 #endif /* CONFIG_MOUSE_PS2_CYPRESS */
190 185  
drivers/input/mouse/focaltech.c
... ... @@ -424,11 +424,6 @@
424 424 return error;
425 425 }
426 426  
427   -bool focaltech_supported(void)
428   -{
429   - return true;
430   -}
431   -
432 427 #else /* CONFIG_MOUSE_PS2_FOCALTECH */
433 428  
434 429 int focaltech_init(struct psmouse *psmouse)
... ... @@ -436,11 +431,6 @@
436 431 focaltech_reset(psmouse);
437 432  
438 433 return 0;
439   -}
440   -
441   -bool focaltech_supported(void)
442   -{
443   - return false;
444 434 }
445 435  
446 436 #endif /* CONFIG_MOUSE_PS2_FOCALTECH */
drivers/input/mouse/focaltech.h
... ... @@ -19,7 +19,6 @@
19 19  
20 20 int focaltech_detect(struct psmouse *psmouse, bool set_properties);
21 21 int focaltech_init(struct psmouse *psmouse);
22   -bool focaltech_supported(void);
23 22  
24 23 #endif
drivers/input/mouse/psmouse-base.c
... ... @@ -727,7 +727,7 @@
727 727 if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
728 728 if (max_proto > PSMOUSE_IMEX) {
729 729 if (!set_properties || focaltech_init(psmouse) == 0) {
730   - if (focaltech_supported())
  730 + if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH))
731 731 return PSMOUSE_FOCALTECH;
732 732 /*
733 733 * Note that we need to also restrict
... ... @@ -776,7 +776,7 @@
776 776 * Try activating protocol, but check if support is enabled first, since
777 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 780 (!set_properties || synaptics_init(psmouse) == 0)) {
781 781 return PSMOUSE_SYNAPTICS;
782 782 }
... ... @@ -801,7 +801,7 @@
801 801 */
802 802 if (max_proto > PSMOUSE_IMEX &&
803 803 cypress_detect(psmouse, set_properties) == 0) {
804   - if (cypress_supported()) {
  804 + if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
805 805 if (cypress_init(psmouse) == 0)
806 806 return PSMOUSE_CYPRESS;
807 807  
drivers/input/mouse/synaptics.c
... ... @@ -1454,11 +1454,6 @@
1454 1454 return __synaptics_init(psmouse, false);
1455 1455 }
1456 1456  
1457   -bool synaptics_supported(void)
1458   -{
1459   - return true;
1460   -}
1461   -
1462 1457 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
1463 1458  
1464 1459 void __init synaptics_module_init(void)
... ... @@ -1468,11 +1463,6 @@
1468 1463 int synaptics_init(struct psmouse *psmouse)
1469 1464 {
1470 1465 return -ENOSYS;
1471   -}
1472   -
1473   -bool synaptics_supported(void)
1474   -{
1475   - return false;
1476 1466 }
1477 1467  
1478 1468 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
drivers/input/mouse/synaptics.h
... ... @@ -175,7 +175,6 @@
175 175 int synaptics_init(struct psmouse *psmouse);
176 176 int synaptics_init_relative(struct psmouse *psmouse);
177 177 void synaptics_reset(struct psmouse *psmouse);
178   -bool synaptics_supported(void);
179 178  
180 179 #endif /* _SYNAPTICS_H */