From patchwork Fri Aug 21 07:48:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 7049601 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E2549C05AC for ; Fri, 21 Aug 2015 07:50:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11B65205F7 for ; Fri, 21 Aug 2015 07:50:15 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id C97FC202E9 for ; Fri, 21 Aug 2015 07:50:13 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id BAB2A2657C6; Fri, 21 Aug 2015 09:50:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id B1AB6265838; Fri, 21 Aug 2015 09:49:41 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1D702265838; Fri, 21 Aug 2015 09:49:40 +0200 (CEST) Received: from smtp-out-030.synserver.de (smtp-out-030.synserver.de [212.40.185.30]) by alsa0.perex.cz (Postfix) with ESMTP id 9B5902604E4 for ; Fri, 21 Aug 2015 09:49:09 +0200 (CEST) Received: (qmail 7458 invoked by uid 0); 21 Aug 2015 07:49:05 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 7351 Received: from p4fde7823.dip0.t-ipconnect.de (HELO lars-laptop.ad.analog.com) [79.222.120.35] by 217.119.54.77 with SMTP; 21 Aug 2015 07:49:04 -0000 From: Lars-Peter Clausen To: Dmitry Torokhov , Takashi Iwai Date: Fri, 21 Aug 2015 09:48:33 +0200 Message-Id: <1440143313-27914-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen , patches@opensource.wolfsonmicro.com, Mark Brown , linux-input@vger.kernel.org, Charles Keepax Subject: [alsa-devel] [PATCH v2] ALSA: ac97: Switch to dev_pm_ops X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Convert the ac97_bus from legacy suspend/resume callbacks to dev_pm_ops. Since there isn't anything special to do at the bus level the bus driver does not have to implement any callbacks. The device driver core will automatically pick up and execute the device's PM ops. As there is only a single AC'97 driver implementing suspend and resume, update both the core and driver at the same time to avoid unnecessary code churn. While we are at it also drop the ifdefs around the suspend/resume functions to increase compile test coverage. Signed-off-by: Lars-Peter Clausen Acked-by: Dmitry Torokhov --- This patch touches code in both ALSA and the input subsystem. Ideally this patch will be merged via the ALSA tree. Given that the wm97xx touchscreen driver is not seeing too many changes these days the risk of conflicts should be low. Changes since v1: * Drop ifdefs around suspend/resum functions --- drivers/input/touchscreen/wm97xx-core.c | 13 ++++--------- sound/ac97_bus.c | 26 -------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index b1ae779..1534e9b 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -732,8 +732,7 @@ static int wm97xx_remove(struct device *dev) return 0; } -#ifdef CONFIG_PM -static int wm97xx_suspend(struct device *dev, pm_message_t state) +static int __maybe_unused wm97xx_suspend(struct device *dev) { struct wm97xx *wm = dev_get_drvdata(dev); u16 reg; @@ -765,7 +764,7 @@ static int wm97xx_suspend(struct device *dev, pm_message_t state) return 0; } -static int wm97xx_resume(struct device *dev) +static int __maybe_unused wm97xx_resume(struct device *dev) { struct wm97xx *wm = dev_get_drvdata(dev); @@ -799,10 +798,7 @@ static int wm97xx_resume(struct device *dev) return 0; } -#else -#define wm97xx_suspend NULL -#define wm97xx_resume NULL -#endif +static SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume); /* * Machine specific operations @@ -836,8 +832,7 @@ static struct device_driver wm97xx_driver = { .owner = THIS_MODULE, .probe = wm97xx_probe, .remove = wm97xx_remove, - .suspend = wm97xx_suspend, - .resume = wm97xx_resume, + .pm = &wm97xx_pm_ops, }; static int __init wm97xx_init(void) diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c index 2b50cbe..57a6dfc 100644 --- a/sound/ac97_bus.c +++ b/sound/ac97_bus.c @@ -27,35 +27,9 @@ static int ac97_bus_match(struct device *dev, struct device_driver *drv) return 1; } -#ifdef CONFIG_PM -static int ac97_bus_suspend(struct device *dev, pm_message_t state) -{ - int ret = 0; - - if (dev->driver && dev->driver->suspend) - ret = dev->driver->suspend(dev, state); - - return ret; -} - -static int ac97_bus_resume(struct device *dev) -{ - int ret = 0; - - if (dev->driver && dev->driver->resume) - ret = dev->driver->resume(dev); - - return ret; -} -#endif /* CONFIG_PM */ - struct bus_type ac97_bus_type = { .name = "ac97", .match = ac97_bus_match, -#ifdef CONFIG_PM - .suspend = ac97_bus_suspend, - .resume = ac97_bus_resume, -#endif /* CONFIG_PM */ }; static int __init ac97_bus_init(void)