Input: psmouse - use IS_ENABLED instead of homegrown code
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 29 Dec 2014 20:06:38 +0000 (12:06 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 16 Feb 2015 00:08:35 +0000 (16:08 -0800)
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>
drivers/input/mouse/cypress_ps2.c
drivers/input/mouse/cypress_ps2.h
drivers/input/mouse/focaltech.c
drivers/input/mouse/focaltech.h
drivers/input/mouse/psmouse-base.c
drivers/input/mouse/synaptics.c
drivers/input/mouse/synaptics.h

index 9118a1861a45cf0629f6380112eafeb2cc9b13b9..28dcfc822bf647f4386239d49487e111020a2272 100644 (file)
@@ -710,8 +710,3 @@ err_exit:
 
        return -1;
 }
-
-bool cypress_supported(void)
-{
-       return true;
-}
index 4720f21d2d70cfe2dbf20a626a5133010ba3e320..81f68aaed7c8567d3cfbfb4afc56008815ead34d 100644 (file)
@@ -172,7 +172,6 @@ struct cytp_data {
 #ifdef CONFIG_MOUSE_PS2_CYPRESS
 int cypress_detect(struct psmouse *psmouse, bool set_properties);
 int cypress_init(struct psmouse *psmouse);
-bool cypress_supported(void);
 #else
 inline int cypress_detect(struct psmouse *psmouse, bool set_properties)
 {
@@ -182,10 +181,6 @@ inline int cypress_init(struct psmouse *psmouse)
 {
        return -ENOSYS;
 }
-inline bool cypress_supported(void)
-{
-       return 0;
-}
 #endif /* CONFIG_MOUSE_PS2_CYPRESS */
 
 #endif  /* _CYPRESS_PS2_H */
index fca38ba63bbe7f73f6e01195bd2e20395d683dd5..757f78a94aeccb1be6b80819f75752a09e705bf6 100644 (file)
@@ -424,11 +424,6 @@ fail:
        return error;
 }
 
-bool focaltech_supported(void)
-{
-       return true;
-}
-
 #else /* CONFIG_MOUSE_PS2_FOCALTECH */
 
 int focaltech_init(struct psmouse *psmouse)
@@ -438,9 +433,4 @@ int focaltech_init(struct psmouse *psmouse)
        return 0;
 }
 
-bool focaltech_supported(void)
-{
-       return false;
-}
-
 #endif /* CONFIG_MOUSE_PS2_FOCALTECH */
index 71870a9b548a8cd0a695fb9327b88e75daa83eb8..ca61ebff373e99a194011c1d8554d8ffb0766981 100644 (file)
@@ -19,6 +19,5 @@
 
 int focaltech_detect(struct psmouse *psmouse, bool set_properties);
 int focaltech_init(struct psmouse *psmouse);
-bool focaltech_supported(void);
 
 #endif
index 68469feda470d9d8b34c249cbcd02426795f94c8..4ccd01d7a48de9639a637db4a757c2c09c6c6836 100644 (file)
@@ -727,7 +727,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
        if (psmouse_do_detect(focaltech_detect, psmouse, set_properties) == 0) {
                if (max_proto > PSMOUSE_IMEX) {
                        if (!set_properties || focaltech_init(psmouse) == 0) {
-                               if (focaltech_supported())
+                               if (IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH))
                                        return PSMOUSE_FOCALTECH;
                                /*
                                 * Note that we need to also restrict
@@ -776,7 +776,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
  * Try activating protocol, but check if support is enabled first, since
  * we try detecting Synaptics even when protocol is disabled.
  */
-                       if (synaptics_supported() &&
+                       if (IS_ENABLED(CONFIG_MOUSE_PS2_SYNAPTICS) &&
                            (!set_properties || synaptics_init(psmouse) == 0)) {
                                return PSMOUSE_SYNAPTICS;
                        }
@@ -801,7 +801,7 @@ static int psmouse_extensions(struct psmouse *psmouse,
  */
        if (max_proto > PSMOUSE_IMEX &&
                        cypress_detect(psmouse, set_properties) == 0) {
-               if (cypress_supported()) {
+               if (IS_ENABLED(CONFIG_MOUSE_PS2_CYPRESS)) {
                        if (cypress_init(psmouse) == 0)
                                return PSMOUSE_CYPRESS;
 
index 7e705ee90b86cf0c86729aacbf6c7a1d981b0a12..f2cceb6493a0aea304c838043735ac3889041438 100644 (file)
@@ -1454,11 +1454,6 @@ int synaptics_init_relative(struct psmouse *psmouse)
        return __synaptics_init(psmouse, false);
 }
 
-bool synaptics_supported(void)
-{
-       return true;
-}
-
 #else /* CONFIG_MOUSE_PS2_SYNAPTICS */
 
 void __init synaptics_module_init(void)
@@ -1470,9 +1465,4 @@ int synaptics_init(struct psmouse *psmouse)
        return -ENOSYS;
 }
 
-bool synaptics_supported(void)
-{
-       return false;
-}
-
 #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
index 6faf9bb7c117d46f40af90a9232fc2810c921155..aedc3299b14e2b753c1e9d51da95b0953ea081cb 100644 (file)
@@ -175,6 +175,5 @@ int synaptics_detect(struct psmouse *psmouse, bool set_properties);
 int synaptics_init(struct psmouse *psmouse);
 int synaptics_init_relative(struct psmouse *psmouse);
 void synaptics_reset(struct psmouse *psmouse);
-bool synaptics_supported(void);
 
 #endif /* _SYNAPTICS_H */