touchpad: invert an if condition to allow for early return

if (foo) {
	    everything
	}

changed to :

	if (!foo)
	    return
	everything

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2017-09-20 13:19:36 +10:00
parent 6b99fabfe8
commit fb787e7a7e

View file

@ -2076,22 +2076,23 @@ tp_pair_tablet_mode_switch(struct evdev_device *touchpad,
if ((tablet_mode_switch->tags & EVDEV_TAG_TABLET_MODE_SWITCH) == 0)
return;
if (tp->tablet_mode_switch.tablet_mode_switch == NULL) {
evdev_log_debug(touchpad,
"tablet_mode_switch: activated for %s<->%s\n",
touchpad->devname,
tablet_mode_switch->devname);
if (tp->tablet_mode_switch.tablet_mode_switch)
return;
libinput_device_add_event_listener(&tablet_mode_switch->base,
&tp->tablet_mode_switch.listener,
tp_switch_event, tp);
tp->tablet_mode_switch.tablet_mode_switch = tablet_mode_switch;
evdev_log_debug(touchpad,
"tablet_mode_switch: activated for %s<->%s\n",
touchpad->devname,
tablet_mode_switch->devname);
if (evdev_device_switch_get_state(tablet_mode_switch,
LIBINPUT_SWITCH_TABLET_MODE)
== LIBINPUT_SWITCH_STATE_ON) {
tp_suspend(tp, touchpad);
}
libinput_device_add_event_listener(&tablet_mode_switch->base,
&tp->tablet_mode_switch.listener,
tp_switch_event, tp);
tp->tablet_mode_switch.tablet_mode_switch = tablet_mode_switch;
if (evdev_device_switch_get_state(tablet_mode_switch,
LIBINPUT_SWITCH_TABLET_MODE)
== LIBINPUT_SWITCH_STATE_ON) {
tp_suspend(tp, touchpad);
}
}