From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752113AbbIAXa4 (ORCPT ); Tue, 1 Sep 2015 19:30:56 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:51972 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751931AbbIAXay (ORCPT ); Tue, 1 Sep 2015 19:30:54 -0400 From: "Rafael J. Wysocki" To: Daniel Lezcano Cc: zhaoyang.huang@linaro.org, sudeep.holla@arm.com, Len Brown , Pavel Machek , Greg Kroah-Hartman , "open list:SUSPEND TO RAM" , open list Subject: Re: [PATCH] drivers/power/wakeirq: Call device_init_wakeup from dev_pm_set_wake_irq Date: Wed, 02 Sep 2015 01:58:34 +0200 Message-ID: <2671167.vEAaCPQzyJ@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.1.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1441119218-31490-1-git-send-email-daniel.lezcano@linaro.org> References: <1441119218-31490-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, September 01, 2015 04:53:37 PM Daniel Lezcano wrote: > The function dev_pm_set_wake_irq is typically called after device_init_wakeup. > > Instead of summing a couple of call, let's call device_init_wakeup directly > from dev_pm_set_wake_irq / dev_pm_clear_wake_irq. > > Signed-off-by: Daniel Lezcano If there are any existing callers of dev_pm_attach_wake_irq(), you need to update them too I think. Also, what if someone wants to use device_set_wakeup_capable() rather than device_init_wakeup()? > --- > drivers/base/power/wakeirq.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c > index eb6e674..287a021 100644 > --- a/drivers/base/power/wakeirq.c > +++ b/drivers/base/power/wakeirq.c > @@ -60,8 +60,7 @@ static int dev_pm_attach_wake_irq(struct device *dev, int irq, > * > * Attach a device IO interrupt as a wake IRQ. The wake IRQ gets > * automatically configured for wake-up from suspend based > - * on the device specific sysfs wakeup entry. Typically called > - * during driver probe after calling device_init_wakeup(). > + * on the device specific sysfs wakeup entry. > */ > int dev_pm_set_wake_irq(struct device *dev, int irq) > { > @@ -75,9 +74,13 @@ int dev_pm_set_wake_irq(struct device *dev, int irq) > wirq->dev = dev; > wirq->irq = irq; > > + device_init_wakeup(dev, true); > + > err = dev_pm_attach_wake_irq(dev, irq, wirq); > - if (err) > + if (!err) { > kfree(wirq); > + device_init_wakeup(dev, false); > + } > > return err; > } > @@ -102,6 +105,7 @@ void dev_pm_clear_wake_irq(struct device *dev) > if (!wirq) > return; > > + device_init_wakeup(dev, false); > spin_lock_irqsave(&dev->power.lock, flags); > device_wakeup_detach_irq(dev); > dev->power.wakeirq = NULL; > -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.