From patchwork Tue Dec 3 10:04:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21949 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C256C202AE for ; Tue, 3 Dec 2013 10:04:49 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id o15sf13485045qap.2 for ; Tue, 03 Dec 2013 02:04:49 -0800 (PST) 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:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=etnu6W17rYkmKaSC+Yfk1z8PxC5Kl8OzpQsDua/Tdlo=; b=d+g3QECQ8iIKLHIgEPa6X2MEyW5hi3yuDrDwGXfdkuqtBP3aLoIlM9tLx6pCKjl8Bq zitKKMucCtQ8HrnYbyH9ARabpDQHq7yqNtaHCBW47iuUXaW061vPCxcF6DdSR/rmQEOW CMod5GWx0TwXOOv5OyNLPrYzXp2GVcfw6Rqf4spve7PePRv86SX9iJVrJ3C1KIB/8TSh KQnEXEodW472scuhe9sSp1jFF2iyRx/NhX5hmHhdldxNsFqt/wYNMa4ZkZ4+5Sd+TkwQ xf07ZYD1FH1tvWxOLZLi6c2ic33l5cav8/AEay/r3E92pS16e0G5qs06HCvGZExcQeQ2 zdsQ== X-Gm-Message-State: ALoCoQnTuBH7h7lBt20nMPvrbx0lxryYuxFfq0jO3HX7Q3gbLEsRvbgZoe+gyM94KSOBtq/y/pIz X-Received: by 10.58.23.166 with SMTP id n6mr23670983vef.13.1386065089612; Tue, 03 Dec 2013 02:04:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.38.36 with SMTP id d4ls3357751qek.7.gmail; Tue, 03 Dec 2013 02:04:49 -0800 (PST) X-Received: by 10.220.17.131 with SMTP id s3mr5387090vca.20.1386065089516; Tue, 03 Dec 2013 02:04:49 -0800 (PST) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id fe2si31086178vcb.91.2013.12.03.02.04.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:04:49 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu19so9746833vcb.0 for ; Tue, 03 Dec 2013 02:04:49 -0800 (PST) X-Received: by 10.220.199.5 with SMTP id eq5mr55744333vcb.16.1386065089331; Tue, 03 Dec 2013 02:04:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp194633vcz; Tue, 3 Dec 2013 02:04:48 -0800 (PST) X-Received: by 10.152.9.193 with SMTP id c1mr447612lab.53.1386065088116; Tue, 03 Dec 2013 02:04:48 -0800 (PST) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id d9si16052224lad.30.2013.12.03.02.04.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:04:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.215.51 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ec20so9020792lab.10 for ; Tue, 03 Dec 2013 02:04:47 -0800 (PST) X-Received: by 10.152.9.9 with SMTP id v9mr1645497laa.41.1386065087506; Tue, 03 Dec 2013 02:04:47 -0800 (PST) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id i8sm35583394lbh.2.2013.12.03.02.04.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 02:04:46 -0800 (PST) From: Ulf Hansson To: Russell King , linux-arm-kernel@lists.infradead.org Cc: Ulf Hansson Subject: [PATCH 4/6] amba: Drop legacy PM support and use the pm_generic functions Date: Tue, 3 Dec 2013 11:04:29 +0100 Message-Id: <1386065071-9529-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386065071-9529-1-git-send-email-ulf.hansson@linaro.org> References: <1386065071-9529-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , All AMBA drivers have converted to use the modern PM ops thus we can safely drop the legacy PM support from the bus. While using the modern PM ops it also makes sense to convert to use the pm_generic callback functions. Signed-off-by: Ulf Hansson --- drivers/amba/bus.c | 180 ++-------------------------------------------------- 1 file changed, 7 insertions(+), 173 deletions(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index c4876ac..b90dc1e 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -83,162 +83,6 @@ static struct device_attribute amba_dev_attrs[] = { __ATTR_NULL, }; -#ifdef CONFIG_PM_SLEEP - -static int amba_legacy_suspend(struct device *dev, pm_message_t mesg) -{ - struct amba_driver *adrv = to_amba_driver(dev->driver); - struct amba_device *adev = to_amba_device(dev); - int ret = 0; - - if (dev->driver && adrv->suspend) - ret = adrv->suspend(adev, mesg); - - return ret; -} - -static int amba_legacy_resume(struct device *dev) -{ - struct amba_driver *adrv = to_amba_driver(dev->driver); - struct amba_device *adev = to_amba_device(dev); - int ret = 0; - - if (dev->driver && adrv->resume) - ret = adrv->resume(adev); - - return ret; -} - -#endif /* CONFIG_PM_SLEEP */ - -#ifdef CONFIG_SUSPEND - -static int amba_pm_suspend(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->suspend) - ret = drv->pm->suspend(dev); - } else { - ret = amba_legacy_suspend(dev, PMSG_SUSPEND); - } - - return ret; -} - -static int amba_pm_resume(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->resume) - ret = drv->pm->resume(dev); - } else { - ret = amba_legacy_resume(dev); - } - - return ret; -} - -#else /* !CONFIG_SUSPEND */ - -#define amba_pm_suspend NULL -#define amba_pm_resume NULL - -#endif /* !CONFIG_SUSPEND */ - -#ifdef CONFIG_HIBERNATE_CALLBACKS - -static int amba_pm_freeze(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->freeze) - ret = drv->pm->freeze(dev); - } else { - ret = amba_legacy_suspend(dev, PMSG_FREEZE); - } - - return ret; -} - -static int amba_pm_thaw(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->thaw) - ret = drv->pm->thaw(dev); - } else { - ret = amba_legacy_resume(dev); - } - - return ret; -} - -static int amba_pm_poweroff(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->poweroff) - ret = drv->pm->poweroff(dev); - } else { - ret = amba_legacy_suspend(dev, PMSG_HIBERNATE); - } - - return ret; -} - -static int amba_pm_restore(struct device *dev) -{ - struct device_driver *drv = dev->driver; - int ret = 0; - - if (!drv) - return 0; - - if (drv->pm) { - if (drv->pm->restore) - ret = drv->pm->restore(dev); - } else { - ret = amba_legacy_resume(dev); - } - - return ret; -} - -#else /* !CONFIG_HIBERNATE_CALLBACKS */ - -#define amba_pm_freeze NULL -#define amba_pm_thaw NULL -#define amba_pm_poweroff NULL -#define amba_pm_restore NULL - -#endif /* !CONFIG_HIBERNATE_CALLBACKS */ - #ifdef CONFIG_PM_RUNTIME /* * Hooks to provide runtime PM of the pclk (bus clock). It is safe to @@ -272,15 +116,13 @@ static int amba_pm_runtime_resume(struct device *dev) } #endif -#ifdef CONFIG_PM - static const struct dev_pm_ops amba_pm = { - .suspend = amba_pm_suspend, - .resume = amba_pm_resume, - .freeze = amba_pm_freeze, - .thaw = amba_pm_thaw, - .poweroff = amba_pm_poweroff, - .restore = amba_pm_restore, + .suspend = pm_generic_suspend, + .resume = pm_generic_resume, + .freeze = pm_generic_freeze, + .thaw = pm_generic_thaw, + .poweroff = pm_generic_poweroff, + .restore = pm_generic_restore, SET_RUNTIME_PM_OPS( amba_pm_runtime_suspend, amba_pm_runtime_resume, @@ -288,14 +130,6 @@ static const struct dev_pm_ops amba_pm = { ) }; -#define AMBA_PM (&amba_pm) - -#else /* !CONFIG_PM */ - -#define AMBA_PM NULL - -#endif /* !CONFIG_PM */ - /* * Primecells are part of the Advanced Microcontroller Bus Architecture, * so we call the bus "amba". @@ -305,7 +139,7 @@ struct bus_type amba_bustype = { .dev_attrs = amba_dev_attrs, .match = amba_match, .uevent = amba_uevent, - .pm = AMBA_PM, + .pm = &amba_pm, }; static int __init amba_init(void)