From patchwork Wed Nov 9 14:23:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 81494 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp223060qge; Wed, 9 Nov 2016 06:24:25 -0800 (PST) X-Received: by 10.98.36.91 with SMTP id r88mr33837403pfj.10.1478701465295; Wed, 09 Nov 2016 06:24:25 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b62si42417202pfl.65.2016.11.09.06.24.25; Wed, 09 Nov 2016 06:24:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754113AbcKIOYW (ORCPT + 4 others); Wed, 9 Nov 2016 09:24:22 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:14194 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753456AbcKIOYN (ORCPT ); Wed, 9 Nov 2016 09:24:13 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGD00GYNPCAMU40@mailout4.w1.samsung.com>; Wed, 09 Nov 2016 14:24:10 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161109142409eucas1p2cc7458d43b8443d2400ac5dd3be9fa37~FZyJBLxE92633226332eucas1p2M; Wed, 9 Nov 2016 14:24:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id FD.4D.11330.98133285; Wed, 9 Nov 2016 14:24:09 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161109142408eucas1p24bd5bce9a6046e186948a2f4f65c7d7d~FZyIa6MAu2944329443eucas1p2X; Wed, 9 Nov 2016 14:24:08 +0000 (GMT) X-AuditID: cbfec7f2-f79556d000002c42-8e-582331891e9b Received: from eusync2.samsung.com ( [203.254.199.212]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 63.CD.10494.B6133285; Wed, 9 Nov 2016 14:23:39 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGD009LGPC36HB0@eusync2.samsung.com>; Wed, 09 Nov 2016 14:24:08 +0000 (GMT) From: Marek Szyprowski To: linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Krzysztof Kozlowski , Ulf Hansson , Bartlomiej Zolnierkiewicz , Javier Martinez Canillas Subject: [PATCH 04/12] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM Date: Wed, 09 Nov 2016 15:23:53 +0100 Message-id: <1478701441-29107-5-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1478701441-29107-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDIsWRmVeSWpSXmKPExsWy7djP87qdhsoRBhsf8VpsnLGe1eLN2zVM FufPb2C36NmwldVixvl9TBZrj9xltzj8pp3V4vjacAcOj02rOtk87lzbw+axpf8uu0ffllWM Hp83yQWwRnHZpKTmZJalFunbJXBl3L7Qw1zwT7bi945WpgbGXskuRk4OCQETiabVa9ggbDGJ C/fWA9lcHE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jHW0aIbXISJ49NZgWxOQU8JVYduQlmCwHVbF0+i3EC I+8CRoZVjCKppcW56bnFRnrFibnFpXnpesn5uZsYgUG97djPLTsYu94FH2IU4GBU4uHt0FSO EGJNLCuuzD3EKMHBrCTCO9MAKMSbklhZlVqUH19UmpNafIjRFOioicxSosn5wIjLK4k3NDE0 tzQ0MrawMDcyUhLnnfrhSriQQHpiSWp2ampBahFMHxMHp1QDY8Ypj9lJtgHhAZyMIozP/dry Jyivqvjn9+nnc2Yek79im7dbX+e4dzJ4dc20d9b9M07J/W7nZYoSVVhgXbJ6XrNfiHjBa+G/ esXzJnWsqFq2SzMn58jkf6ybl8bKLso+ncjypM/MeEbpjJmFpToP4/d0lnNpTEh46mMjvEfQ x2xvM9dvoU0HlFiKMxINtZiLihMBLTeVloACAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161109142408eucas1p24bd5bce9a6046e186948a2f4f65c7d7d X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRs=?= =?UTF-8?B?7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?TWFyZWsgU3p5cHJvd3NraRtTUlBPTC1LZXJuZWwgKFRQKRtT?= =?UTF-8?B?YW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161109142408eucas1p24bd5bce9a6046e186948a2f4f65c7d7d X-RootMTR: 20161109142408eucas1p24bd5bce9a6046e186948a2f4f65c7d7d References: <1478701441-29107-1-git-send-email-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Ulf Hansson There are no need to set up the runtime PM callbacks unless they are being used. It also causes compiler warnings about unused functions. Silence the warnings by making them available for CONFIG_PM. Signed-off-by: Ulf Hansson [mszyprow: rebased onto v4.9-rc4] Signed-off-by: Marek Szyprowski --- drivers/media/platform/exynos-gsc/gsc-core.c | 79 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 39 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index b5a99af..7e99fda 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -988,43 +988,6 @@ static void *gsc_get_drv_data(struct platform_device *pdev) return driver_data; } -static int gsc_m2m_suspend(struct gsc_dev *gsc) -{ - unsigned long flags; - int timeout; - - spin_lock_irqsave(&gsc->slock, flags); - if (!gsc_m2m_pending(gsc)) { - spin_unlock_irqrestore(&gsc->slock, flags); - return 0; - } - clear_bit(ST_M2M_SUSPENDED, &gsc->state); - set_bit(ST_M2M_SUSPENDING, &gsc->state); - spin_unlock_irqrestore(&gsc->slock, flags); - - timeout = wait_event_timeout(gsc->irq_queue, - test_bit(ST_M2M_SUSPENDED, &gsc->state), - GSC_SHUTDOWN_TIMEOUT); - - clear_bit(ST_M2M_SUSPENDING, &gsc->state); - return timeout == 0 ? -EAGAIN : 0; -} - -static void gsc_m2m_resume(struct gsc_dev *gsc) -{ - struct gsc_ctx *ctx; - unsigned long flags; - - spin_lock_irqsave(&gsc->slock, flags); - /* Clear for full H/W setup in first run after resume */ - ctx = gsc->m2m.ctx; - gsc->m2m.ctx = NULL; - spin_unlock_irqrestore(&gsc->slock, flags); - - if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state)) - gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR); -} - static int gsc_probe(struct platform_device *pdev) { struct gsc_dev *gsc; @@ -1130,6 +1093,44 @@ static int gsc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static int gsc_m2m_suspend(struct gsc_dev *gsc) +{ + unsigned long flags; + int timeout; + + spin_lock_irqsave(&gsc->slock, flags); + if (!gsc_m2m_pending(gsc)) { + spin_unlock_irqrestore(&gsc->slock, flags); + return 0; + } + clear_bit(ST_M2M_SUSPENDED, &gsc->state); + set_bit(ST_M2M_SUSPENDING, &gsc->state); + spin_unlock_irqrestore(&gsc->slock, flags); + + timeout = wait_event_timeout(gsc->irq_queue, + test_bit(ST_M2M_SUSPENDED, &gsc->state), + GSC_SHUTDOWN_TIMEOUT); + + clear_bit(ST_M2M_SUSPENDING, &gsc->state); + return timeout == 0 ? -EAGAIN : 0; +} + +static void gsc_m2m_resume(struct gsc_dev *gsc) +{ + struct gsc_ctx *ctx; + unsigned long flags; + + spin_lock_irqsave(&gsc->slock, flags); + /* Clear for full H/W setup in first run after resume */ + ctx = gsc->m2m.ctx; + gsc->m2m.ctx = NULL; + spin_unlock_irqrestore(&gsc->slock, flags); + + if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state)) + gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR); +} + static int gsc_runtime_resume(struct device *dev) { struct gsc_dev *gsc = dev_get_drvdata(dev); @@ -1160,6 +1161,7 @@ static int gsc_runtime_suspend(struct device *dev) pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); return ret; } +#endif static int gsc_resume(struct device *dev) { @@ -1201,8 +1203,7 @@ static int gsc_suspend(struct device *dev) static const struct dev_pm_ops gsc_pm_ops = { .suspend = gsc_suspend, .resume = gsc_resume, - .runtime_suspend = gsc_runtime_suspend, - .runtime_resume = gsc_runtime_resume, + SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) }; static struct platform_driver gsc_driver = {