From patchwork Mon Jan 19 13:22:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 43312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB4C124116 for ; Mon, 19 Jan 2015 13:30:13 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id k14sf16846602wgh.2 for ; Mon, 19 Jan 2015 05:30:12 -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=sKSF/A+9d/BtUeDNXUbNRfHO6zeQePyDsy6LaSTPf9g=; b=lMAeTry/a69KXkNXjv84+wasY0YiDwdNVOIr0NBWLLB0F1KFaYXMI23zwL+TX5PZOv VpY/gL5S/SxBxaQybUg2QEfA/xq/YHZvpgaeXpgBzgAaqzOvetcLCTqU5zka0dLs+Pgp p2dL65tycqZ0TwYGuXsghQIjllM/3uR7qGshT3SQMuvWPD746ReG2XbQQ7gfawoTIjug OLtVbfQJd2yT+Rvle4JZooR/OqBoV1AH2Gtd/oINgoeJiwqPK+8BQfp0a6uHj4fJgKln fC7XHXsTjHkO/phAnH82hMzQHkyq7/w+WQt7wPXr8SvTe5iiaHFJt77DGB16P91hg+z7 zxzA== X-Gm-Message-State: ALoCoQm1jnIj1T+BHw0j6YcB06ydqeGh+mRByjvnrSeX6S0sqdvZ3rSBl82JXpQ03F/um+yrX0hT X-Received: by 10.180.108.197 with SMTP id hm5mr41772wib.4.1421674212889; Mon, 19 Jan 2015 05:30:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.100 with SMTP id i4ls460015laa.106.gmail; Mon, 19 Jan 2015 05:30:12 -0800 (PST) X-Received: by 10.112.84.225 with SMTP id c1mr30761471lbz.22.1421674212740; Mon, 19 Jan 2015 05:30:12 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id n7si12923091laf.123.2015.01.19.05.30.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 05:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id 10so28102867lbg.5 for ; Mon, 19 Jan 2015 05:30:11 -0800 (PST) X-Received: by 10.112.14.6 with SMTP id l6mr31236103lbc.91.1421673792320; Mon, 19 Jan 2015 05:23:12 -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.112.9.200 with SMTP id c8csp1089764lbb; Mon, 19 Jan 2015 05:23:11 -0800 (PST) X-Received: by 10.152.6.67 with SMTP id y3mr30901367lay.90.1421673785180; Mon, 19 Jan 2015 05:23:05 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id lt6si12955294lac.47.2015.01.19.05.23.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 19 Jan 2015 05:23:03 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id s18so7852181lam.5 for ; Mon, 19 Jan 2015 05:23:03 -0800 (PST) X-Received: by 10.112.147.10 with SMTP id tg10mr31197660lbb.92.1421673782317; Mon, 19 Jan 2015 05:23:02 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id v4sm3080344lbz.12.2015.01.19.05.23.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jan 2015 05:23:01 -0800 (PST) From: Ulf Hansson To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Kukjin Kim , Sylwester Nawrocki , Kyungmin Park , Ulf Hansson Subject: [PATCH V2 4/8] [media] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM Date: Mon, 19 Jan 2015 14:22:36 +0100 Message-Id: <1421673760-2600-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421673760-2600-1-git-send-email-ulf.hansson@linaro.org> References: <1421673760-2600-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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) 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: , 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 --- drivers/media/platform/exynos-gsc/gsc-core.c | 79 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 532daa8..e84bc35 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1003,43 +1003,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; @@ -1152,6 +1115,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); @@ -1182,6 +1183,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) { @@ -1223,8 +1225,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 = {