Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -35
-5
drivers/input/mouse/cypress_ps2.c
··· 710 710 711 711 return -1; 712 712 } 713 - 714 - bool cypress_supported(void) 715 - { 716 - return true; 717 - }
-5
drivers/input/mouse/cypress_ps2.h
··· 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 { ··· 180 181 inline int cypress_init(struct psmouse *psmouse) 181 182 { 182 183 return -ENOSYS; 183 - } 184 - inline bool cypress_supported(void) 185 - { 186 - return 0; 187 184 } 188 185 #endif /* CONFIG_MOUSE_PS2_CYPRESS */ 189 186
-10
drivers/input/mouse/focaltech.c
··· 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) ··· 431 436 focaltech_reset(psmouse); 432 437 433 438 return 0; 434 - } 435 - 436 - bool focaltech_supported(void) 437 - { 438 - return false; 439 439 } 440 440 441 441 #endif /* CONFIG_MOUSE_PS2_FOCALTECH */
-1
drivers/input/mouse/focaltech.h
··· 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
+3 -3
drivers/input/mouse/psmouse-base.c
··· 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 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 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
-10
drivers/input/mouse/synaptics.c
··· 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) ··· 1463 1468 int synaptics_init(struct psmouse *psmouse) 1464 1469 { 1465 1470 return -ENOSYS; 1466 - } 1467 - 1468 - bool synaptics_supported(void) 1469 - { 1470 - return false; 1471 1471 } 1472 1472 1473 1473 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
-1
drivers/input/mouse/synaptics.h
··· 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 */