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: 56310 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp768775lbb; Tue, 10 Nov 2015 05:25:36 -0800 (PST) X-Received: by 10.66.185.6 with SMTP id ey6mr5712596pac.70.1447161909191; Tue, 10 Nov 2015 05:25:09 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id w13si5094003pbs.227.2015.11.10.05.25.08; Tue, 10 Nov 2015 05:25:09 -0800 (PST) Received-SPF: pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C59C07212D; Tue, 10 Nov 2015 05:25:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2DEE772095 for ; Tue, 10 Nov 2015 05:25:01 -0800 (PST) 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 dri-devel@lists.freedesktop.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 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== Cc: Javier Martinez Canillas , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Andrzej Hajda , Tobias Jakobi , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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; }