From patchwork Sat Mar 26 23:58:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 666251 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2R00hjn016320 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 27 Mar 2011 00:01:05 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2QNwrca017523; Sat, 26 Mar 2011 16:58:54 -0700 Received: from ogre.sisk.pl (ogre.sisk.pl [217.79.144.158]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2QNwna0017514 for ; Sat, 26 Mar 2011 16:58:50 -0700 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 092491A9120; Sun, 27 Mar 2011 00:41:38 +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 05525-07; Sun, 27 Mar 2011 00:41:15 +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 A8C78195AD4; Sun, 27 Mar 2011 00:41:15 +0100 (CET) From: "Rafael J. Wysocki" To: Linux PM mailing list Date: Sun, 27 Mar 2011 00:58:41 +0100 User-Agent: KMail/1.13.6 (Linux/2.6.38+; KDE/4.6.0; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201103270058.41632.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-5.442 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: LKML , linux-sh@vger.kernel.org Subject: [linux-pm] [RFC][PATCH] PM / Platform: Remove __weak definitions of runtime PM callbacks X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 27 Mar 2011 00:01:05 +0000 (UTC) Index: linux-2.6/drivers/base/platform.c =================================================================== --- linux-2.6.orig/drivers/base/platform.c +++ linux-2.6/drivers/base/platform.c @@ -922,32 +922,7 @@ static int platform_pm_restore_noirq(str #endif /* !CONFIG_HIBERNATION */ -#ifdef CONFIG_PM_RUNTIME - -int __weak platform_pm_runtime_suspend(struct device *dev) -{ - return pm_generic_runtime_suspend(dev); -}; - -int __weak platform_pm_runtime_resume(struct device *dev) -{ - return pm_generic_runtime_resume(dev); -}; - -int __weak platform_pm_runtime_idle(struct device *dev) -{ - return pm_generic_runtime_idle(dev); -}; - -#else /* !CONFIG_PM_RUNTIME */ - -#define platform_pm_runtime_suspend NULL -#define platform_pm_runtime_resume NULL -#define platform_pm_runtime_idle NULL - -#endif /* !CONFIG_PM_RUNTIME */ - -static const struct dev_pm_ops platform_dev_pm_ops = { +static struct dev_pm_ops platform_dev_pm_ops = { .prepare = platform_pm_prepare, .complete = platform_pm_complete, .suspend = platform_pm_suspend, @@ -962,9 +937,9 @@ static const struct dev_pm_ops platform_ .thaw_noirq = platform_pm_thaw_noirq, .poweroff_noirq = platform_pm_poweroff_noirq, .restore_noirq = platform_pm_restore_noirq, - .runtime_suspend = platform_pm_runtime_suspend, - .runtime_resume = platform_pm_runtime_resume, - .runtime_idle = platform_pm_runtime_idle, + SET_RUNTIME_PM_OPS(pm_generic_runtime_suspend, + pm_generic_runtime_resume, + pm_generic_runtime_idle) }; struct bus_type platform_bus_type = { @@ -976,6 +951,16 @@ struct bus_type platform_bus_type = { }; EXPORT_SYMBOL_GPL(platform_bus_type); +void platform_set_runtime_pm_ops(int (*suspend)(struct device *dev), + int (*resume)(struct device *dev), + int (*idle)(struct device *dev)) +{ + platform_dev_pm_ops.runtime_suspend = suspend; + platform_dev_pm_ops.runtime_resume = resume; + platform_dev_pm_ops.runtime_idle = idle; +} +EXPORT_SYMBOL_GPL(platform_set_runtime_pm_ops); + /** * platform_bus_get_pm_ops() - return pointer to busses dev_pm_ops * Index: linux-2.6/include/linux/platform_device.h =================================================================== --- linux-2.6.orig/include/linux/platform_device.h +++ linux-2.6/include/linux/platform_device.h @@ -200,4 +200,8 @@ static inline char *early_platform_drive } #endif /* MODULE */ +extern void platform_set_runtime_pm_ops(int (*suspend)(struct device *dev), + int (*resume)(struct device *dev), + int (*idle)(struct device *dev)); + #endif /* _PLATFORM_DEVICE_H_ */ Index: linux-2.6/arch/arm/mach-shmobile/pm_runtime.c =================================================================== --- linux-2.6.orig/arch/arm/mach-shmobile/pm_runtime.c +++ linux-2.6/arch/arm/mach-shmobile/pm_runtime.c @@ -163,6 +163,9 @@ static struct notifier_block platform_bu static int __init sh_pm_runtime_init(void) { + platform_set_runtime_pm_ops(platform_pm_runtime_suspend, + platform_pm_runtime_resume, + platform_pm_runtime_idle); bus_register_notifier(&platform_bus_type, &platform_bus_notifier); return 0; } Index: linux-2.6/arch/sh/kernel/cpu/shmobile/pm_runtime.c =================================================================== --- linux-2.6.orig/arch/sh/kernel/cpu/shmobile/pm_runtime.c +++ linux-2.6/arch/sh/kernel/cpu/shmobile/pm_runtime.c @@ -302,6 +302,9 @@ static int __init sh_pm_runtime_init(voi { INIT_WORK(&hwblk_work, platform_pm_runtime_work); + platform_set_runtime_pm_ops(platform_pm_runtime_suspend, + platform_pm_runtime_resume, + platform_pm_runtime_idle); bus_register_notifier(&platform_bus_type, &platform_bus_notifier); return 0; }