From patchwork Mon Nov 30 13:53:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 57457 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1486591lbb; Mon, 30 Nov 2015 05:54:34 -0800 (PST) X-Received: by 10.66.139.131 with SMTP id qy3mr82297553pab.71.1448891646025; Mon, 30 Nov 2015 05:54:06 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id si4si4228020pac.204.2015.11.30.05.54.05; Mon, 30 Nov 2015 05:54:05 -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 B954B6E5C9; Mon, 30 Nov 2015 05:54:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE9EE6E5BC for ; Mon, 30 Nov 2015 05:53:57 -0800 (PST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NYM008SYRXWQEB0@mailout2.w1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 30 Nov 2015 13:53:56 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-07-565c54f4ab04 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id B9.78.21385.4F45C565; Mon, 30 Nov 2015 13:53:56 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NYM007NRRXFE700@eusync2.samsung.com>; Mon, 30 Nov 2015 13:53:56 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 21/22] drm/exynos: ipp: make framework context global Date: Mon, 30 Nov 2015 14:53:36 +0100 Message-id: <1448891617-18830-22-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1448891617-18830-1-git-send-email-m.szyprowski@samsung.com> References: <1448891617-18830-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJLMWRmVeSWpSXmKPExsVy+t/xK7pfQmLCDK7s57C4te4cq8XGGetZ La58fc9msfPBLnaLSfcnsFi8ebuGyeLFvYssFq9fGFrMOL+PyWLtkbvsFjMmv2SzaFv9gdVi 1a4/jA68Hjtn3WX3uN99nMnj3zF2jy39QN7OSXuZPPq2rGL0+LxJLoA9issmJTUnsyy1SN8u gSvj98TLbAXTbCv+31jE1sA407iLkZNDQsBEYsqsGcwQtpjEhXvr2boYuTiEBJYyShz6cogZ wmlikvi8/D4LSBWbgKFE19suNhBbRMBNounwTFYQm1ngMLPE4al1XYwcHMICHhKvj4OVsAio SmzcMI0JxOYV8JR4OeEOE8QyOYn/L1eA2ZxA8SdnT7OD2EJArRtmHGOawMi7gJFhFaNoamly QXFSeq6RXnFibnFpXrpecn7uJkZIgH7dwbj0mNUhRgEORiUeXgmz6DAh1sSy4srcQ4wSHMxK IryBpjFhQrwpiZVVqUX58UWlOanFhxilOViUxHln7nofIiSQnliSmp2aWpBaBJNl4uCUamB0 Krd6+Pu+wg7WhtZ16my25rO3akWEmB0uTL7Tbq3/w2Lz+h/Tbb4WZ19YWvV8xaXzC3lt82su 5DEtFCs7vtLCgLVs9ukJjtPPLtPs0WL4b/AwZOVKhcYPi/gXH8nb91n7i6CxZc7LmgbNzVuO Lpa6qT1Da09+jojHw1D97OyXqyfmRorUXYlWYinOSDTUYi4qTgQA5iTEJUwCAAA= 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; }