From patchwork Mon Nov 14 10:27:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 82049 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp938218qge; Mon, 14 Nov 2016 02:27:50 -0800 (PST) X-Received: by 10.107.157.201 with SMTP id g192mr28201095ioe.70.1479119270585; Mon, 14 Nov 2016 02:27:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dh16si12763285pac.207.2016.11.14.02.27.50; Mon, 14 Nov 2016 02:27:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-media-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-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933404AbcKNK1s (ORCPT + 4 others); Mon, 14 Nov 2016 05:27:48 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:37118 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932751AbcKNK1n (ORCPT ); Mon, 14 Nov 2016 05:27:43 -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 <0OGM005GSNQ4KB10@mailout4.w1.samsung.com>; Mon, 14 Nov 2016 10:27:40 +0000 (GMT) Received: from eusmges5.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20161114102739eucas1p281d94056e1ffdd07f566a787abb5cbf2~G4yFBBcG93149631496eucas1p2B; Mon, 14 Nov 2016 10:27:39 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges5.samsung.com (EUCPMTA) with SMTP id A8.71.19540.B9199285; Mon, 14 Nov 2016 10:27:39 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20161114102738eucas1p121baecdb3ff034812f098894d28f43ad~G4yEOCH192069620696eucas1p1U; Mon, 14 Nov 2016 10:27:38 +0000 (GMT) X-AuditID: cbfec7f5-f79ce6d000004c54-f5-5829919bb5c2 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0E.95.10494.F7199285; Mon, 14 Nov 2016 10:27:11 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGM001Q7NPYE370@eusync1.samsung.com>; Mon, 14 Nov 2016 10:27:38 +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 v2] exynos-gsc: Make PM callbacks available conditionally Date: Mon, 14 Nov 2016 11:27:32 +0100 Message-id: <1479119252-3225-1-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1478701441-29107-5-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLIsWRmVeSWpSXmKPExsWy7djP87qzJ2pGGEzdIWyxccZ6Vos3b9cw WZw/v4HdomfDVlaLGef3MVmsPXKX3eLwm3ZWi+Nrwx04PDat6mTzuHNtD5vHlv677B59W1Yx enzeJBfAGsVlk5Kak1mWWqRvl8CVcbT5AUvBBYWKjpt/2BoYV0h3MXJySAiYSMxa+JYdwhaT uHBvPVsXIxeHkMBSRokNzxtZQRJ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VapucxMljk1lBbE4BT4kNkw6yQmz2kGg89IllAiPv AkaGVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmbGIFBve3Yzy07GLveBR9iFOBgVOLh7cjXiBBi TSwrrsw9xCjBwawkwrtygmaEEG9KYmVValF+fFFpTmrxIUZToKMmMkuJJucDIy6vJN7QxNDc 0tDI2MLC3MhISZx36ocr4UIC6YklqdmpqQWpRTB9TBycUg2MVq07tiaZPjw0R0HzmhGbUSjf 9tgvqunLE3zsw1e4sjRc+3rI6lX1xrwvT18rMHlbMb7L2XJEY8bKC/tlGjdq346urE14/OXe MdZ+09dMS99ulP9w7lDf1KP1R8IzX01Yt7DHSI11quqxyOkV/r9v++VVH37yRvaTxqNO4Xc9 Wh/n5b6QLu24qsRSnJFoqMVcVJwIAE+Inw+AAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161114102738eucas1p121baecdb3ff034812f098894d28f43ad 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: 20161114102738eucas1p121baecdb3ff034812f098894d28f43ad X-RootMTR: 20161114102738eucas1p121baecdb3ff034812f098894d28f43ad References: <1478701441-29107-5-git-send-email-m.szyprowski@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Ulf Hansson There are no need to set up the PM callbacks (runtime and system) unless they are being used. It also causes compiler warnings about unused functions. Silence the warnings by making them available for CONFIG_PM (runtime callbacks) and CONFIG_PM_SLEEP (system sleep callbacks). Signed-off-by: Ulf Hansson [mszyprow: squashed two patches into one to avoid potential build break, changed patch subject and updated commit message] Signed-off-by: Marek Szyprowski --- drivers/media/platform/exynos-gsc/gsc-core.c | 84 ++++++++++++++-------------- 1 file changed, 43 insertions(+), 41 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" 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 b5a99af6d049..e75474f3f7f2 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,7 +1161,9 @@ static int gsc_runtime_suspend(struct device *dev) pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); return ret; } +#endif +#ifdef CONFIG_PM_SLEEP static int gsc_resume(struct device *dev) { struct gsc_dev *gsc = dev_get_drvdata(dev); @@ -1197,12 +1200,11 @@ static int gsc_suspend(struct device *dev) return 0; } +#endif 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_SYSTEM_SLEEP_PM_OPS(gsc_suspend, gsc_resume) + SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL) }; static struct platform_driver gsc_driver = {