Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp594357yba; Wed, 3 Apr 2019 15:17:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpv8SHXnxgM8sMUv9Yu8Zfob9lzuZkM+kVsxEIrZdrvgKdXK5AdY0EddPj+Qb5wl9SMPQ+ X-Received: by 2002:a63:f212:: with SMTP id v18mr2068672pgh.231.1554329862370; Wed, 03 Apr 2019 15:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554329862; cv=none; d=google.com; s=arc-20160816; b=C84GMQLWT3TS35nm4S7NuqMzH/TzzzWiebLrhTuipjpjOJN3J6OZomre63hFxaPRq/ iSzhq+Es7eQq7XD7DCVId/Z+JSCHgNfG/NJFJUjYfnF5FQlC4RQoCEsjm2oRrMJdwGP4 /bBax6SU5coDW3OyOYQZomdwogz0S82wy5iRm03cujWE05rxF7eL0cdqacnE3SW2s6eK fC51FQPlE6xolmPM4QtncrIrYXY4Ouwviy1TOt/3moafo6HTB3hHKAP4g1961cxYWzSP fEahKDpX+/5ECwlq9fo1dGzQJ3FUskqxAO3AcyhsmUlYQxw8tFsX7UNOtlXwNOe8wgVq vXiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qWogcakmliCnWA6g1zXhbplYsTnHQEuiNfytwIqmhw0=; b=k5Vjx9p5o6MHlxroykcaUtU2NpkiiZuqVUrjcQ4I7IiYnBhCQcmeRjEgmPJ/wsNscQ p9ixg/jYPXIQZkYJjIIvKQ/LBqRTPvFrAf0J/Th/Ykd8mMyqxfjh2EMNY1Jjib2gY45H Axrmz7dSJgUtQarW4Y5cyzBityrrpIjmG6XLbJQ80EkQg/tBXeNQHwSb3CboT51QozEv 79qhvEhMZzi4N5oNOa14C5UhEz6XkkbQjjT/wrIpp6wp3O+M3RDrxHrO+LIQiA0G4FAV nWIZCrnNTLaDt5lXm7Ferm6zv3fcSMLd9sdwfCCLiuC1fDJf7ioT6NxIqx6jZgcPrfA5 z97A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tXazteTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d38si15174868pla.304.2019.04.03.15.17.26; Wed, 03 Apr 2019 15:17:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tXazteTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726427AbfDCWQp (ORCPT + 99 others); Wed, 3 Apr 2019 18:16:45 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:45561 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbfDCWQp (ORCPT ); Wed, 3 Apr 2019 18:16:45 -0400 Received: by mail-pl1-f193.google.com with SMTP id bf11so80370plb.12; Wed, 03 Apr 2019 15:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qWogcakmliCnWA6g1zXhbplYsTnHQEuiNfytwIqmhw0=; b=tXazteTczgZ4b6Zb8BhHzvbVtwlbbNu4aL13+3OucVP0LsI1dLY81yJ9MPY08NovYx hRhV/vtVXvUbfEiEdPKjtrTOqN3iY45Ww13nfPB7otTMm/N1LVEBItYjGXK643sJ34rA T/Py2OauFYUlyeiKIBMkcKU8e0Pnrap6OhWRUWxYu9SHxByUIz+LhDprzgBRsIb/LQ/h xUH7IpiGIIryRIiZ0U092XMojrXJGYWHm7O1AHBkD69HBjE/rj6vuS0YUnVxpVTquI7U Nc7MEjYQ1OQOZLImZTn0eI00OJn35js1e8Gj/W4AHZRa4o5lGqis3yCNxRW+apzC1+tT io+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qWogcakmliCnWA6g1zXhbplYsTnHQEuiNfytwIqmhw0=; b=jbj9QIyYZXwQHFSAN/oHVTDnbl4c5PWZtXyVIqCwtyJrmqIbb4CkyJoSpqSdgi7iKV VUwvOVNBkOCqMJSfEvWlimzk3NH9H9zcsjK4RX/2I0QO+ULWYMRX0Rwo4MAIbioEL/Dd 2G2VFcLEFbzJFeVxGQFGBVPT5d8mlYy8P8HLVi2yPkjjiw3WIAds8zs4oVmgCRnEKwKV E47Lj0qaWYg3OS6lrPezeEv1E2BFSOltyHIrJ6qa73qJ95ogWuz/Rgf53V+mzcnDMbtl HZEyuOJz83JWVmI4OVWVzheeBgPFn4pnUH0v0SajZBRw50LShkiC0TiS9fuaJLt2A5m+ /RJg== X-Gm-Message-State: APjAAAVqgLHhn51d50iQsr6ZGD2zO24zhYAAXonVkKamS/bNfh3yuyk0 Kr2PqQ6YsVVqmuCzBElRTPE= X-Received: by 2002:a17:902:ba88:: with SMTP id k8mr2593113pls.268.1554329804443; Wed, 03 Apr 2019 15:16:44 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id o76sm48644836pfa.156.2019.04.03.15.16.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 Apr 2019 15:16:43 -0700 (PDT) Date: Wed, 3 Apr 2019 15:16:42 -0700 From: "dmitry.torokhov@gmail.com" To: Anson Huang Cc: Fabio Estevam , "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" , dl-linux-imx Subject: Re: [PATCH] input: keyboard: snvs: use dev_pm_set_wake_irq() to simplify code Message-ID: <20190403221642.GF53104@dtor-ws> References: <1553666576-21621-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1553666576-21621-1-git-send-email-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 06:08:05AM +0000, Anson Huang wrote: > With calling dev_pm_set_wake_irq() to set SNVS ON/OFF button > as wakeup source for suspend, generic wake irq mechanism > will automatically enable it as wakeup source when suspend, > then the enable_irq_wake()/disable_irq_wake() can be removed > in suspend/resume callback, it simplifies the code. > > Signed-off-by: Anson Huang Applied, thank you. > --- > drivers/input/keyboard/snvs_pwrkey.c | 30 ++++-------------------------- > 1 file changed, 4 insertions(+), 26 deletions(-) > > diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c > index 4c67cf3..5342d8d 100644 > --- a/drivers/input/keyboard/snvs_pwrkey.c > +++ b/drivers/input/keyboard/snvs_pwrkey.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -167,28 +168,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) > } > > device_init_wakeup(&pdev->dev, pdata->wakeup); > - > - return 0; > -} > - > -static int __maybe_unused imx_snvs_pwrkey_suspend(struct device *dev) > -{ > - struct platform_device *pdev = to_platform_device(dev); > - struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev); > - > - if (device_may_wakeup(&pdev->dev)) > - enable_irq_wake(pdata->irq); > - > - return 0; > -} > - > -static int __maybe_unused imx_snvs_pwrkey_resume(struct device *dev) > -{ > - struct platform_device *pdev = to_platform_device(dev); > - struct pwrkey_drv_data *pdata = platform_get_drvdata(pdev); > - > - if (device_may_wakeup(&pdev->dev)) > - disable_irq_wake(pdata->irq); > + error = dev_pm_set_wake_irq(&pdev->dev, pdata->irq); > + if (error) > + dev_err(&pdev->dev, "irq wake enable failed.\n"); > > return 0; > } > @@ -199,13 +181,9 @@ static const struct of_device_id imx_snvs_pwrkey_ids[] = { > }; > MODULE_DEVICE_TABLE(of, imx_snvs_pwrkey_ids); > > -static SIMPLE_DEV_PM_OPS(imx_snvs_pwrkey_pm_ops, imx_snvs_pwrkey_suspend, > - imx_snvs_pwrkey_resume); > - > static struct platform_driver imx_snvs_pwrkey_driver = { > .driver = { > .name = "snvs_pwrkey", > - .pm = &imx_snvs_pwrkey_pm_ops, > .of_match_table = imx_snvs_pwrkey_ids, > }, > .probe = imx_snvs_pwrkey_probe, > -- > 2.7.4 > -- Dmitry