Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 290b799c authored by Dmitry Torokhov's avatar Dmitry Torokhov
Browse files

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: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 97ae2b5c
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -710,8 +710,3 @@ int cypress_init(struct psmouse *psmouse)

	return -1;
}

bool cypress_supported(void)
{
	return true;
}
+0 −5
Original line number Diff line number Diff line
@@ -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 */
+0 −10
Original line number Diff line number Diff line
@@ -424,11 +424,6 @@ int focaltech_init(struct psmouse *psmouse)
	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 */
+0 −1
Original line number Diff line number Diff line
@@ -19,6 +19,5 @@

int focaltech_detect(struct psmouse *psmouse, bool set_properties);
int focaltech_init(struct psmouse *psmouse);
bool focaltech_supported(void);

#endif
+3 −3
Original line number Diff line number Diff line
@@ -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;

Loading