From patchwork Tue Sep 1 14:53:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 52932 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 63BC92127E for ; Tue, 1 Sep 2015 14:54:11 +0000 (UTC) Received: by lamp12 with SMTP id p12sf1022582lam.2 for ; Tue, 01 Sep 2015 07:54:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=sNZf4ouXL+2ItPom38hyPZQryHBItSHMzPllmFOqlSE=; b=Y8ThAeu5Jrs5B6S0GtJN5znnVuobn63IAyjW+0LCzajcgvfLn2SMYMJ/H8SSqMT0d0 VItsd+AJdQ57Y4vBdPKWqzDLoAMy6CVzrU394rDBkpHz+m9AOe2qKQZzBpTLW5R6K4YJ 3/W9vBRgzn/E07FFVMJbezR8MZoVPf5+FT+RVjKwvIDOdkTRhETHnKBOJnPJUeHt2DX6 wwqCN/+Dt/ceYlgJLMv/xZ2DdcFE3HMQFMfqA3mjbah5BFHNjEp/u35QdTO08iwHwv1d SvyOCszvMGkOGRb+BPj1Cy5IJnZ8aB6k0wTurJrsxj1fpy34v9XYN0M/fWpRvGLozZo4 P6ew== X-Gm-Message-State: ALoCoQm85tmyNs5h/MCl29z4e4VLTGdQc589hSbxgDnrPpuQimCMLpg6XavzB1+xGDIv3pM3rsp4 X-Received: by 10.180.96.226 with SMTP id dv2mr952743wib.2.1441119250232; Tue, 01 Sep 2015 07:54:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.219.4 with SMTP id pk4ls615314lac.90.gmail; Tue, 01 Sep 2015 07:54:10 -0700 (PDT) X-Received: by 10.152.27.100 with SMTP id s4mr13564858lag.122.1441119250085; Tue, 01 Sep 2015 07:54:10 -0700 (PDT) Received: from mail-la0-f48.google.com (mail-la0-f48.google.com. [209.85.215.48]) by mx.google.com with ESMTPS id tn10si16624479lbb.38.2015.09.01.07.54.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 07:54:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) client-ip=209.85.215.48; Received: by lamp12 with SMTP id p12so1549814lam.0 for ; Tue, 01 Sep 2015 07:54:09 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr14110660laf.32.1441119249736; Tue, 01 Sep 2015 07:54:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp591834lbb; Tue, 1 Sep 2015 07:54:08 -0700 (PDT) X-Received: by 10.66.145.195 with SMTP id sw3mr47807544pab.72.1441119248546; Tue, 01 Sep 2015 07:54:08 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oc7si28805589pdb.231.2015.09.01.07.54.07; Tue, 01 Sep 2015 07:54:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753599AbbIAOyG (ORCPT + 13 others); Tue, 1 Sep 2015 10:54:06 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:34642 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753164AbbIAOyE (ORCPT ); Tue, 1 Sep 2015 10:54:04 -0400 Received: by wicjd9 with SMTP id jd9so36157040wic.1 for ; Tue, 01 Sep 2015 07:54:03 -0700 (PDT) X-Received: by 10.180.219.106 with SMTP id pn10mr3528444wic.56.1441119243457; Tue, 01 Sep 2015 07:54:03 -0700 (PDT) Received: from localhost.localdomain (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.gmail.com with ESMTPSA id vl1sm27621806wjc.0.2015.09.01.07.54.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Sep 2015 07:54:02 -0700 (PDT) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: zhaoyang.huang@linaro.org, sudeep.holla@arm.com, Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org (open list:SUSPEND TO RAM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] drivers/power/wakeirq: Call device_init_wakeup from dev_pm_set_wake_irq Date: Tue, 1 Sep 2015 16:53:37 +0200 Message-Id: <1441119218-31490-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.48 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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;