On Wed, Nov 27, 2019 at 02:06:02PM +0100, Marco Felsch wrote: > On 19-11-27 14:59, Andy Shevchenko wrote: > > On Wed, Nov 27, 2019 at 01:09:48PM +0100, Marco Felsch wrote: > > Perhaps > > > > static void edt_ft5x06_ts_toggle_gpio(struct gpio_desc *gpiod) > > { > > ... > > } > > > > ...resume(...) > > { > > ... > > if (wake_gpio) > > ...toggle_gpio(wake_gpio); > > else if (reset_gpio) > > ...toggle_gpio(reset_gpio); > > ... > > } > > > > ? > > Thanks fpr your suggestion but we need to differentiate between reset > and wake logic level. The wake-gpio keeps asserted while the reset is > released. So the edt_ft5x06_ts_toggle_gpio() needs at least a 'is_reset' > parameter but then the simplification is gone. How about this: static void edt_ft5x06_ts_toggle_gpio(struct gpio_desc *gpiod, int value) { gpiod_...(..., !value); ... gpiod_...(..., value); ... } ...resume(...) { ... if (wake_gpio) ...toggle_gpio(wake_gpio, 1); else if (reset_gpio) ...toggle_gpio(reset_gpio, 0); ... } ? -- With Best Regards, Andy Shevchenko