Re: [PATCH libinput 2/6] Change a few functions that only ever returned 0 to voids

2016-07-19 Thread Peter Hutterer
On Tue, Jul 19, 2016 at 12:49:21PM -0700, Yong Bakos wrote:
> Hi Peter,
> I'm curious about the explicit return at the end of tp_process_button,
> inline below...
> 
> 
> > On Jul 18, 2016, at 5:49 PM, Peter Hutterer  
> > wrote:
> > 
> > These are internal functions, if we need them to return an error code we can
> > change that at any time. Meanwhile, if we only ever return 0 anyway we might
> > as well just make them voids to save on error paths.
> > 
> > Signed-off-by: Peter Hutterer 
> > ---
> > src/evdev-mt-touchpad-buttons.c | 14 +++
> > src/evdev-mt-touchpad-edge-scroll.c |  4 +-
> > src/evdev-mt-touchpad-gestures.c|  3 +-
> > src/evdev-mt-touchpad-tap.c |  4 +-
> > src/evdev-mt-touchpad.c | 77 
> > -
> > src/evdev-mt-touchpad.h | 12 +++---
> > src/evdev-tablet.c  |  5 +--
> > src/evdev.c | 34 ++--
> > src/evdev.h |  4 +-
> > 9 files changed, 53 insertions(+), 104 deletions(-)
> > 
> > diff --git a/src/evdev-mt-touchpad-buttons.c 
> > b/src/evdev-mt-touchpad-buttons.c
> > index 85a355f..ba0a016 100644
> > --- a/src/evdev-mt-touchpad-buttons.c
> > +++ b/src/evdev-mt-touchpad-buttons.c
> > @@ -452,7 +452,7 @@ tp_button_handle_event(struct tp_dispatch *tp,
> >   button_state_to_str(t->button.state));
> > }
> > 
> > -int
> > +void
> > tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
> > {
> > struct tp_touch *t;
> > @@ -488,8 +488,6 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t 
> > time)
> > if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
> > tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
> > }
> > -
> > -   return 0;
> > }
> > 
> > static void
> > @@ -500,7 +498,7 @@ tp_button_handle_timeout(uint64_t now, void *data)
> > tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
> > }
> > 
> > -int
> > +void
> > tp_process_button(struct tp_dispatch *tp,
> >   const struct input_event *e,
> >   uint64_t time)
> > @@ -513,7 +511,7 @@ tp_process_button(struct tp_dispatch *tp,
> > log_bug_kernel(libinput,
> >"received %s button event on a clickpad\n",
> >libevdev_event_code_get_name(EV_KEY, e->code));
> > -   return 0;
> > +   return;
> > }
> > 
> > if (e->value) {
> > @@ -524,7 +522,7 @@ tp_process_button(struct tp_dispatch *tp,
> > tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
> > }
> > 
> > -   return 0;
> > +   return;
> > }
> 
> Why the explicit return here?

no reason, just an oversight, I've removed it locally. Thanks.

Cheers,
   Peter

> > 
> > void
> > @@ -831,7 +829,7 @@ tp_init_middlebutton_emulation(struct tp_dispatch *tp,
> > want_config_option);
> > }
> > 
> > -int
> > +void
> > tp_init_buttons(struct tp_dispatch *tp,
> > struct evdev_device *device)
> > {
> > @@ -884,8 +882,6 @@ tp_init_buttons(struct tp_dispatch *tp,
> > tp_libinput_context(tp),
> > tp_button_handle_timeout, t);
> > }
> > -
> > -   return 0;
> > }
> > 
> > void
> > diff --git a/src/evdev-mt-touchpad-edge-scroll.c 
> > b/src/evdev-mt-touchpad-edge-scroll.c
> > index 610744a..22cb5ae 100644
> > --- a/src/evdev-mt-touchpad-edge-scroll.c
> > +++ b/src/evdev-mt-touchpad-edge-scroll.c
> > @@ -281,7 +281,7 @@ tp_edge_scroll_handle_timeout(uint64_t now, void *data)
> > tp_edge_scroll_handle_event(t->tp, t, SCROLL_EVENT_TIMEOUT);
> > }
> > 
> > -int
> > +void
> > tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
> > {
> > struct tp_touch *t;
> > @@ -316,8 +316,6 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct 
> > evdev_device *device)
> > tp_libinput_context(tp),
> > tp_edge_scroll_handle_timeout, t);
> > }
> > -
> > -   return 0;
> > }
> > 
> > void
> > diff --git a/src/evdev-mt-touchpad-gestures.c 
> > b/src/evdev-mt-touchpad-gestures.c
> > index a910bec..acfc875 100644
> > --- a/src/evdev-mt-touchpad-gestures.c
> > +++ b/src/evdev-mt-touchpad-gestures.c
> > @@ -621,7 +621,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, 
> > uint64_t time)
> > }
> > }
> > 
> > -int
> > +void
> > tp_init_gesture(struct tp_dispatch *tp)
> > {
> > /* two-finger scrolling is always enabled, this flag just
> > @@ -634,7 +634,6 @@ tp_init_gesture(struct tp_dispatch *tp)
> > libinput_timer_init(&tp->gesture.finger_count_switch_timer,
> > tp_libinput_context(tp),
> > tp_gesture_finger_count_switch_timeout, tp);
> > -   return 0;
> > }
> > 
> > void
> > diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
> > index 232cd6a..c2b331c 100644
> > --- a/src/evdev-mt-touchpad-tap.c
> > ++

Re: [PATCH libinput 2/6] Change a few functions that only ever returned 0 to voids

2016-07-19 Thread Yong Bakos
Hi Peter,
I'm curious about the explicit return at the end of tp_process_button,
inline below...


> On Jul 18, 2016, at 5:49 PM, Peter Hutterer  wrote:
> 
> These are internal functions, if we need them to return an error code we can
> change that at any time. Meanwhile, if we only ever return 0 anyway we might
> as well just make them voids to save on error paths.
> 
> Signed-off-by: Peter Hutterer 
> ---
> src/evdev-mt-touchpad-buttons.c | 14 +++
> src/evdev-mt-touchpad-edge-scroll.c |  4 +-
> src/evdev-mt-touchpad-gestures.c|  3 +-
> src/evdev-mt-touchpad-tap.c |  4 +-
> src/evdev-mt-touchpad.c | 77 -
> src/evdev-mt-touchpad.h | 12 +++---
> src/evdev-tablet.c  |  5 +--
> src/evdev.c | 34 ++--
> src/evdev.h |  4 +-
> 9 files changed, 53 insertions(+), 104 deletions(-)
> 
> diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
> index 85a355f..ba0a016 100644
> --- a/src/evdev-mt-touchpad-buttons.c
> +++ b/src/evdev-mt-touchpad-buttons.c
> @@ -452,7 +452,7 @@ tp_button_handle_event(struct tp_dispatch *tp,
> button_state_to_str(t->button.state));
> }
> 
> -int
> +void
> tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
> {
>   struct tp_touch *t;
> @@ -488,8 +488,6 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t 
> time)
>   if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
>   tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
>   }
> -
> - return 0;
> }
> 
> static void
> @@ -500,7 +498,7 @@ tp_button_handle_timeout(uint64_t now, void *data)
>   tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
> }
> 
> -int
> +void
> tp_process_button(struct tp_dispatch *tp,
> const struct input_event *e,
> uint64_t time)
> @@ -513,7 +511,7 @@ tp_process_button(struct tp_dispatch *tp,
>   log_bug_kernel(libinput,
>  "received %s button event on a clickpad\n",
>  libevdev_event_code_get_name(EV_KEY, e->code));
> - return 0;
> + return;
>   }
> 
>   if (e->value) {
> @@ -524,7 +522,7 @@ tp_process_button(struct tp_dispatch *tp,
>   tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
>   }
> 
> - return 0;
> + return;
> }

Why the explicit return here?

yong


> 
> void
> @@ -831,7 +829,7 @@ tp_init_middlebutton_emulation(struct tp_dispatch *tp,
>   want_config_option);
> }
> 
> -int
> +void
> tp_init_buttons(struct tp_dispatch *tp,
>   struct evdev_device *device)
> {
> @@ -884,8 +882,6 @@ tp_init_buttons(struct tp_dispatch *tp,
>   tp_libinput_context(tp),
>   tp_button_handle_timeout, t);
>   }
> -
> - return 0;
> }
> 
> void
> diff --git a/src/evdev-mt-touchpad-edge-scroll.c 
> b/src/evdev-mt-touchpad-edge-scroll.c
> index 610744a..22cb5ae 100644
> --- a/src/evdev-mt-touchpad-edge-scroll.c
> +++ b/src/evdev-mt-touchpad-edge-scroll.c
> @@ -281,7 +281,7 @@ tp_edge_scroll_handle_timeout(uint64_t now, void *data)
>   tp_edge_scroll_handle_event(t->tp, t, SCROLL_EVENT_TIMEOUT);
> }
> 
> -int
> +void
> tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
> {
>   struct tp_touch *t;
> @@ -316,8 +316,6 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct 
> evdev_device *device)
>   tp_libinput_context(tp),
>   tp_edge_scroll_handle_timeout, t);
>   }
> -
> - return 0;
> }
> 
> void
> diff --git a/src/evdev-mt-touchpad-gestures.c 
> b/src/evdev-mt-touchpad-gestures.c
> index a910bec..acfc875 100644
> --- a/src/evdev-mt-touchpad-gestures.c
> +++ b/src/evdev-mt-touchpad-gestures.c
> @@ -621,7 +621,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t 
> time)
>   }
> }
> 
> -int
> +void
> tp_init_gesture(struct tp_dispatch *tp)
> {
>   /* two-finger scrolling is always enabled, this flag just
> @@ -634,7 +634,6 @@ tp_init_gesture(struct tp_dispatch *tp)
>   libinput_timer_init(&tp->gesture.finger_count_switch_timer,
>   tp_libinput_context(tp),
>   tp_gesture_finger_count_switch_timeout, tp);
> - return 0;
> }
> 
> void
> diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
> index 232cd6a..c2b331c 100644
> --- a/src/evdev-mt-touchpad-tap.c
> +++ b/src/evdev-mt-touchpad-tap.c
> @@ -1010,7 +1010,7 @@ tp_tap_config_get_default_draglock_enabled(struct 
> libinput_device *device)
>   return tp_drag_lock_default(evdev);
> }
> 
> -int
> +void
> tp_init_tap(struct tp_dispatch *tp)
> {
>   tp->tap.config.count = tp_tap_config_count;
> @@ -1033,8 +1033,6 @@ tp_init_tap(struct tp_dispatch *tp)
>   li

[PATCH libinput 2/6] Change a few functions that only ever returned 0 to voids

2016-07-18 Thread Peter Hutterer
These are internal functions, if we need them to return an error code we can
change that at any time. Meanwhile, if we only ever return 0 anyway we might
as well just make them voids to save on error paths.

Signed-off-by: Peter Hutterer 
---
 src/evdev-mt-touchpad-buttons.c | 14 +++
 src/evdev-mt-touchpad-edge-scroll.c |  4 +-
 src/evdev-mt-touchpad-gestures.c|  3 +-
 src/evdev-mt-touchpad-tap.c |  4 +-
 src/evdev-mt-touchpad.c | 77 -
 src/evdev-mt-touchpad.h | 12 +++---
 src/evdev-tablet.c  |  5 +--
 src/evdev.c | 34 ++--
 src/evdev.h |  4 +-
 9 files changed, 53 insertions(+), 104 deletions(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 85a355f..ba0a016 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -452,7 +452,7 @@ tp_button_handle_event(struct tp_dispatch *tp,
  button_state_to_str(t->button.state));
 }
 
-int
+void
 tp_button_handle_state(struct tp_dispatch *tp, uint64_t time)
 {
struct tp_touch *t;
@@ -488,8 +488,6 @@ tp_button_handle_state(struct tp_dispatch *tp, uint64_t 
time)
if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS)
tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time);
}
-
-   return 0;
 }
 
 static void
@@ -500,7 +498,7 @@ tp_button_handle_timeout(uint64_t now, void *data)
tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now);
 }
 
-int
+void
 tp_process_button(struct tp_dispatch *tp,
  const struct input_event *e,
  uint64_t time)
@@ -513,7 +511,7 @@ tp_process_button(struct tp_dispatch *tp,
log_bug_kernel(libinput,
   "received %s button event on a clickpad\n",
   libevdev_event_code_get_name(EV_KEY, e->code));
-   return 0;
+   return;
}
 
if (e->value) {
@@ -524,7 +522,7 @@ tp_process_button(struct tp_dispatch *tp,
tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE;
}
 
-   return 0;
+   return;
 }
 
 void
@@ -831,7 +829,7 @@ tp_init_middlebutton_emulation(struct tp_dispatch *tp,
want_config_option);
 }
 
-int
+void
 tp_init_buttons(struct tp_dispatch *tp,
struct evdev_device *device)
 {
@@ -884,8 +882,6 @@ tp_init_buttons(struct tp_dispatch *tp,
tp_libinput_context(tp),
tp_button_handle_timeout, t);
}
-
-   return 0;
 }
 
 void
diff --git a/src/evdev-mt-touchpad-edge-scroll.c 
b/src/evdev-mt-touchpad-edge-scroll.c
index 610744a..22cb5ae 100644
--- a/src/evdev-mt-touchpad-edge-scroll.c
+++ b/src/evdev-mt-touchpad-edge-scroll.c
@@ -281,7 +281,7 @@ tp_edge_scroll_handle_timeout(uint64_t now, void *data)
tp_edge_scroll_handle_event(t->tp, t, SCROLL_EVENT_TIMEOUT);
 }
 
-int
+void
 tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device)
 {
struct tp_touch *t;
@@ -316,8 +316,6 @@ tp_edge_scroll_init(struct tp_dispatch *tp, struct 
evdev_device *device)
tp_libinput_context(tp),
tp_edge_scroll_handle_timeout, t);
}
-
-   return 0;
 }
 
 void
diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index a910bec..acfc875 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -621,7 +621,7 @@ tp_gesture_handle_state(struct tp_dispatch *tp, uint64_t 
time)
}
 }
 
-int
+void
 tp_init_gesture(struct tp_dispatch *tp)
 {
/* two-finger scrolling is always enabled, this flag just
@@ -634,7 +634,6 @@ tp_init_gesture(struct tp_dispatch *tp)
libinput_timer_init(&tp->gesture.finger_count_switch_timer,
tp_libinput_context(tp),
tp_gesture_finger_count_switch_timeout, tp);
-   return 0;
 }
 
 void
diff --git a/src/evdev-mt-touchpad-tap.c b/src/evdev-mt-touchpad-tap.c
index 232cd6a..c2b331c 100644
--- a/src/evdev-mt-touchpad-tap.c
+++ b/src/evdev-mt-touchpad-tap.c
@@ -1010,7 +1010,7 @@ tp_tap_config_get_default_draglock_enabled(struct 
libinput_device *device)
return tp_drag_lock_default(evdev);
 }
 
-int
+void
 tp_init_tap(struct tp_dispatch *tp)
 {
tp->tap.config.count = tp_tap_config_count;
@@ -1033,8 +1033,6 @@ tp_init_tap(struct tp_dispatch *tp)
libinput_timer_init(&tp->tap.timer,
tp_libinput_context(tp),
tp_tap_handle_timeout, tp);
-
-   return 0;
 }
 
 void
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 87d81c5..fe0d4a4 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1781,7 +1781,6 @@ tp_init_acc