From patchwork Mon Oct 30 17:40:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10032959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 42D43603B4 for ; Mon, 30 Oct 2017 17:40:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31EBD288B9 for ; Mon, 30 Oct 2017 17:40:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26D2228926; Mon, 30 Oct 2017 17:40:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C91CA28901 for ; Mon, 30 Oct 2017 17:40:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932721AbdJ3Rk5 (ORCPT ); Mon, 30 Oct 2017 13:40:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40672 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932673AbdJ3Rk4 (ORCPT ); Mon, 30 Oct 2017 13:40:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84577743; Mon, 30 Oct 2017 17:40:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 84577743 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=hdegoede@redhat.com Received: from shalem.localdomain.com (ovpn-116-133.ams2.redhat.com [10.36.116.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ECEE600C9; Mon, 30 Oct 2017 17:40:55 +0000 (UTC) From: Hans de Goede To: Dmitry Torokhov , Benjamin Tissoires Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH v3 2/4] Input: gpio_keys - Use a single suspended flag per device Date: Mon, 30 Oct 2017 18:40:48 +0100 Message-Id: <20171030174050.30375-2-hdegoede@redhat.com> In-Reply-To: <20171030174050.30375-1-hdegoede@redhat.com> References: <20171030174050.30375-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 30 Oct 2017 17:40:56 +0000 (UTC) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need to have a suspended flag per button, this also allows gpio_keys_resume to set suspended to false after calling gpio_keys_report_state, which will allow testing the suspended flag in gpio_keys_report_state in a follow-up patch. Signed-off-by: Hans de Goede --- Changes in v3: -This is a new patch in v3 of this patch-set --- drivers/input/keyboard/gpio_keys.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 36ab7daba957..9b51aa56cc83 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -50,7 +50,6 @@ struct gpio_button_data { spinlock_t lock; bool disabled; bool key_pressed; - bool suspended; }; struct gpio_keys_drvdata { @@ -58,6 +57,7 @@ struct gpio_keys_drvdata { struct input_dev *input; struct mutex disable_lock; unsigned short *keymap; + bool suspended; struct gpio_button_data data[0]; }; @@ -404,7 +404,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) const struct gpio_keys_button *button = bdata->button; pm_stay_awake(input->dev.parent); - if (bdata->suspended && + if (bdata->ddata->suspended && (button->type == 0 || button->type == EV_KEY)) { /* * Simulate wakeup key press in case the key has @@ -859,7 +859,6 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev) struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->wakeup) enable_irq_wake(bdata->irq); - bdata->suspended = true; } } else { mutex_lock(&input->mutex); @@ -868,6 +867,7 @@ static int __maybe_unused gpio_keys_suspend(struct device *dev) mutex_unlock(&input->mutex); } + ddata->suspended = true; return 0; } @@ -883,7 +883,6 @@ static int __maybe_unused gpio_keys_resume(struct device *dev) struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->wakeup) disable_irq_wake(bdata->irq); - bdata->suspended = false; } } else { mutex_lock(&input->mutex); @@ -896,6 +895,7 @@ static int __maybe_unused gpio_keys_resume(struct device *dev) return error; gpio_keys_report_state(ddata); + ddata->suspended = false; return 0; }