From patchwork Tue Nov 10 13:23:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 7591001 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 6E86EC05C6 for ; Tue, 10 Nov 2015 13:25:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A57A120637 for ; Tue, 10 Nov 2015 13:25:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E7342070D for ; Tue, 10 Nov 2015 13:25:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107AbbKJNZG (ORCPT ); Tue, 10 Nov 2015 08:25:06 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:64227 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753129AbbKJNZB (ORCPT ); Tue, 10 Nov 2015 08:25:01 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NXL009NXP9NAQA0@mailout1.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 10 Nov 2015 13:24:59 +0000 (GMT) X-AuditID: cbfec7f4-f79c56d0000012ee-84-5641f02b9883 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id E2.33.04846.B20F1465; Tue, 10 Nov 2015 13:24:59 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NXL00L9RP94NP10@eusync1.samsung.com>; Tue, 10 Nov 2015 13:24:59 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Andrzej Hajda , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tobias Jakobi , Gustavo Padovan , Javier Martinez Canillas Subject: [PATCH 23/25] drm/exynos: ipp: make framework context global Date: Tue, 10 Nov 2015 14:23:39 +0100 Message-id: <1447161821-1877-24-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1447161821-1877-1-git-send-email-m.szyprowski@samsung.com> References: <1447161821-1877-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOLMWRmVeSWpSXmKPExsVy+t/xy7raHxzDDN6fUrW4te4cq8XGGetZ La58fc9msfPBLnaLSfcnsFi8ebuGyeLFvYssFq9fGFrMOL+PyWLtkbvsFjMmv2SzaFv9gdVi 1a4/jA68Hjtn3WX3uN99nMnj3zF2jy39QN7OSXuZPPq2rGL0+LxJLoA9issmJTUnsyy1SN8u gSvj98TLbAXTbCv+31jE1sA407iLkZNDQsBE4vDqLcwQtpjEhXvr2boYuTiEBJYyStx7eYQd wmlikngw5zsTSBWbgKFE19suNhBbRMBNounwTFYQm1ngMLPE4al1XYwcHMICrhJvXiqAmCwC qhKvX+eAmLwCHhKt/fwQq+Qk/r9cATaQEyi89eNnsBOEBNwlbjZdZJnAyLuAkWEVo2hqaXJB cVJ6rqFecWJucWleul5yfu4mRkhwftnBuPiY1SFGAQ5GJR7eCd8cwoRYE8uKK3MPMUpwMCuJ 8DK+dgwT4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjt31/sQIYH0xJLU7NTUgtQimCwTB6dUA2Nl heFrDpkt1VKcYYoC764dkOneu7v9faC2Y0r36VcM4a6MO1ru+Ec2f10xtUpBrte9tV3J9szk h5OfmqyW/dE6KW2p2YGJn7vS9re9Xt9c7fR259yIR6nn3jc0pogWaAgufFtwTdhw+mYD23Pr pb5vPj+ZyUDtdk721u5TTvmdEvfCHtd0eiuxFGckGmoxFxUnAgAh0Ph9SgIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP IPP framework stored global context in driver data of its platform device. This patch moves it to global variable to simplify access. There exists only one such framework, so there is no drawback of this change. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_ipp.c | 50 ++++++++++----------------------- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 0404e18d84cc..44a6689e0f4c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -42,7 +42,6 @@ * 7. need to power_on implement power and sysmmu ctrl. */ -#define get_ipp_context(dev) platform_get_drvdata(to_platform_device(dev)) #define ipp_is_m2m_cmd(c) (c == IPP_CMD_M2M) /* @@ -95,6 +94,7 @@ struct ipp_context { struct workqueue_struct *cmd_workq; }; +static struct ipp_context *ctx; static LIST_HEAD(exynos_drm_ippdrv_list); static DEFINE_MUTEX(exynos_drm_ippdrv_lock); static BLOCKING_NOTIFIER_HEAD(exynos_drm_ippnb_list); @@ -226,9 +226,6 @@ static struct exynos_drm_ippdrv *ipp_find_drv_by_handle(u32 prop_id) int exynos_drm_ipp_get_property(struct drm_device *drm_dev, void *data, struct drm_file *file) { - struct drm_exynos_file_private *file_priv = file->driver_priv; - struct device *dev = file_priv->ipp_dev; - struct ipp_context *ctx = get_ipp_context(dev); struct drm_exynos_ipp_prop_list *prop_list = data; struct exynos_drm_ippdrv *ippdrv; int count = 0; @@ -320,9 +317,6 @@ static struct drm_exynos_ipp_event_work *ipp_create_event_work(void) int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, struct drm_file *file) { - struct drm_exynos_file_private *file_priv = file->driver_priv; - struct device *dev = file_priv->ipp_dev; - struct ipp_context *ctx = get_ipp_context(dev); struct drm_exynos_ipp_property *property = data; struct exynos_drm_ippdrv *ippdrv; struct drm_exynos_ipp_cmd_node *c_node; @@ -803,22 +797,18 @@ static int ipp_set_mem_node(struct exynos_drm_ippdrv *ippdrv, return ret; } -static void ipp_handle_cmd_work(struct device *dev, - struct exynos_drm_ippdrv *ippdrv, - struct drm_exynos_ipp_cmd_work *cmd_work, - struct drm_exynos_ipp_cmd_node *c_node) +static void ipp_handle_cmd_work(struct exynos_drm_ippdrv *ippdrv, + struct drm_exynos_ipp_cmd_work *cmd_work, + struct drm_exynos_ipp_cmd_node *c_node) { - struct ipp_context *ctx = get_ipp_context(dev); - cmd_work->ippdrv = ippdrv; cmd_work->c_node = c_node; queue_work(ctx->cmd_workq, &cmd_work->work); } -static int ipp_queue_buf_with_run(struct device *dev, - struct drm_exynos_ipp_cmd_node *c_node, - struct drm_exynos_ipp_mem_node *m_node, - struct drm_exynos_ipp_queue_buf *qbuf) +static int ipp_queue_buf_with_run(struct drm_exynos_ipp_cmd_node *c_node, + struct drm_exynos_ipp_mem_node *m_node, + struct drm_exynos_ipp_queue_buf *qbuf) { struct exynos_drm_ippdrv *ippdrv; struct drm_exynos_ipp_property *property; @@ -859,7 +849,7 @@ static int ipp_queue_buf_with_run(struct device *dev, struct drm_exynos_ipp_cmd_work *cmd_work = c_node->start_work; cmd_work->ctrl = IPP_CTRL_PLAY; - ipp_handle_cmd_work(dev, ippdrv, cmd_work, c_node); + ipp_handle_cmd_work(ippdrv, cmd_work, c_node); } else { ret = ipp_set_mem_node(ippdrv, c_node, m_node); if (ret) { @@ -893,9 +883,6 @@ static void ipp_clean_queue_buf(struct drm_device *drm_dev, int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, struct drm_file *file) { - struct drm_exynos_file_private *file_priv = file->driver_priv; - struct device *dev = file_priv->ipp_dev; - struct ipp_context *ctx = get_ipp_context(dev); struct drm_exynos_ipp_queue_buf *qbuf = data; struct drm_exynos_ipp_cmd_node *c_node; struct drm_exynos_ipp_mem_node *m_node; @@ -950,7 +937,7 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, * M2M case run play control for streaming feature. * other case set address and waiting. */ - ret = ipp_queue_buf_with_run(dev, c_node, m_node, qbuf); + ret = ipp_queue_buf_with_run(c_node, m_node, qbuf); if (ret) { DRM_ERROR("failed to run command.\n"); goto err_clean_node; @@ -1024,10 +1011,7 @@ err_status: int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, struct drm_file *file) { - struct drm_exynos_file_private *file_priv = file->driver_priv; struct exynos_drm_ippdrv *ippdrv = NULL; - struct device *dev = file_priv->ipp_dev; - struct ipp_context *ctx = get_ipp_context(dev); struct drm_exynos_ipp_cmd_ctrl *cmd_ctrl = data; struct drm_exynos_ipp_cmd_work *cmd_work; struct drm_exynos_ipp_cmd_node *c_node; @@ -1073,12 +1057,12 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, cmd_work = c_node->start_work; cmd_work->ctrl = cmd_ctrl->ctrl; - ipp_handle_cmd_work(dev, ippdrv, cmd_work, c_node); + ipp_handle_cmd_work(ippdrv, cmd_work, c_node); break; case IPP_CTRL_STOP: cmd_work = c_node->stop_work; cmd_work->ctrl = cmd_ctrl->ctrl; - ipp_handle_cmd_work(dev, ippdrv, cmd_work, c_node); + ipp_handle_cmd_work(ippdrv, cmd_work, c_node); if (!wait_for_completion_timeout(&c_node->stop_complete, msecs_to_jiffies(300))) { @@ -1098,7 +1082,7 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, case IPP_CTRL_PAUSE: cmd_work = c_node->stop_work; cmd_work->ctrl = cmd_ctrl->ctrl; - ipp_handle_cmd_work(dev, ippdrv, cmd_work, c_node); + ipp_handle_cmd_work(ippdrv, cmd_work, c_node); if (!wait_for_completion_timeout(&c_node->stop_complete, msecs_to_jiffies(200))) { @@ -1112,7 +1096,7 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, c_node->state = IPP_STATE_START; cmd_work = c_node->start_work; cmd_work->ctrl = cmd_ctrl->ctrl; - ipp_handle_cmd_work(dev, ippdrv, cmd_work, c_node); + ipp_handle_cmd_work(ippdrv, cmd_work, c_node); break; default: DRM_ERROR("could not support this state currently.\n"); @@ -1597,7 +1581,6 @@ err_completion: static int ipp_subdrv_probe(struct drm_device *drm_dev, struct device *dev) { - struct ipp_context *ctx = get_ipp_context(dev); struct exynos_drm_ippdrv *ippdrv; int ret, count = 0; @@ -1649,7 +1632,6 @@ err: static void ipp_subdrv_remove(struct drm_device *drm_dev, struct device *dev) { struct exynos_drm_ippdrv *ippdrv, *t; - struct ipp_context *ctx = get_ipp_context(dev); /* get ipp driver entry */ list_for_each_entry_safe(ippdrv, t, &exynos_drm_ippdrv_list, drv_list) { @@ -1679,7 +1661,6 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev, struct drm_file *file) { struct exynos_drm_ippdrv *ippdrv = NULL; - struct ipp_context *ctx = get_ipp_context(dev); struct drm_exynos_ipp_cmd_node *c_node, *tc_node; int count = 0; @@ -1718,7 +1699,6 @@ static void ipp_subdrv_close(struct drm_device *drm_dev, struct device *dev, static int ipp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct ipp_context *ctx; struct exynos_drm_subdrv *subdrv; int ret; @@ -1787,8 +1767,6 @@ err_event_workq: static int ipp_remove(struct platform_device *pdev) { - struct ipp_context *ctx = platform_get_drvdata(pdev); - /* unregister sub driver */ exynos_drm_subdrv_unregister(&ctx->subdrv); @@ -1803,6 +1781,8 @@ static int ipp_remove(struct platform_device *pdev) destroy_workqueue(ctx->cmd_workq); destroy_workqueue(ctx->event_workq); + ctx = NULL; + return 0; }