From patchwork Wed Feb 23 21:58:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 585901 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1NLx9Ac019355 for ; Wed, 23 Feb 2011 21:59:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755747Ab1BWV65 (ORCPT ); Wed, 23 Feb 2011 16:58:57 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:53157 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752964Ab1BWV65 (ORCPT ); Wed, 23 Feb 2011 16:58:57 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id B05121A65A3; Wed, 23 Feb 2011 22:52:06 +0100 (CET) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 11161-10; Wed, 23 Feb 2011 22:51:44 +0100 (CET) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 735F71A482C; Wed, 23 Feb 2011 22:51:44 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM mailing list Subject: [PATCH] PM: Make ACPI wakeup from S5 work again if CONFIG_PM_SLEEP is unset Date: Wed, 23 Feb 2011 22:58:44 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.38-rc6+; KDE/4.4.4; x86_64; ; ) Cc: LKML , Alan Stern , ACPI Devel Mailing List , Justin Maggard MIME-Version: 1.0 Message-Id: <201102232258.44784.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Feb 2011 21:59:13 +0000 (UTC) Index: linux-2.6/include/linux/pm.h =================================================================== --- linux-2.6.orig/include/linux/pm.h +++ linux-2.6/include/linux/pm.h @@ -431,6 +431,8 @@ struct dev_pm_info { struct list_head entry; struct completion completion; struct wakeup_source *wakeup; +#else + unsigned int should_wakeup:1; #endif #ifdef CONFIG_PM_RUNTIME struct timer_list suspend_timer; Index: linux-2.6/include/linux/pm_wakeup.h =================================================================== --- linux-2.6.orig/include/linux/pm_wakeup.h +++ linux-2.6/include/linux/pm_wakeup.h @@ -103,11 +103,6 @@ static inline bool device_can_wakeup(str return dev->power.can_wakeup; } -static inline bool device_may_wakeup(struct device *dev) -{ - return false; -} - static inline struct wakeup_source *wakeup_source_create(const char *name) { return NULL; @@ -128,24 +123,32 @@ static inline void wakeup_source_unregis static inline int device_wakeup_enable(struct device *dev) { - return -EINVAL; + dev->power.should_wakeup = true; + return 0; } static inline int device_wakeup_disable(struct device *dev) { + dev->power.should_wakeup = false; + return 0; +} + +static inline int device_set_wakeup_enable(struct device *dev, bool enable) +{ + dev->power.should_wakeup = enable; return 0; } static inline int device_init_wakeup(struct device *dev, bool val) { device_set_wakeup_capable(dev, val); - return val ? -EINVAL : 0; + device_set_wakeup_enable(dev, val); + return 0; } - -static inline int device_set_wakeup_enable(struct device *dev, bool enable) +static inline bool device_may_wakeup(struct device *dev) { - return -EINVAL; + return dev->power.can_wakeup && dev->power.should_wakeup; } static inline void __pm_stay_awake(struct wakeup_source *ws) {}