From patchwork Thu Jan 7 08:57:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yakir Yang X-Patchwork-Id: 7974661 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C19B9F38D for ; Thu, 7 Jan 2016 09:00:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E62D201B9 for ; Thu, 7 Jan 2016 09:00:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 58C762017D for ; Thu, 7 Jan 2016 09:00:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 955A66E33B; Thu, 7 Jan 2016 01:00:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lucky1.263xmail.com (lucky1.263xmail.com [211.157.147.131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D5E46E33B for ; Thu, 7 Jan 2016 01:00:00 -0800 (PST) Received: from ykk?rock-chips.com (unknown [192.168.167.105]) by lucky1.263xmail.com (Postfix) with SMTP id 506E58886C; Thu, 7 Jan 2016 16:59:55 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id C568F20056; Thu, 7 Jan 2016 16:59:50 +0800 (CST) X-RL-SENDER: ykk@rock-chips.com X-FST-TO: rmk+kernel@arm.linux.org.uk X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: ykk@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: ykk@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 11184842TMV; Thu, 07 Jan 2016 16:59:52 +0800 (CST) From: Yakir Yang To: Russell King , Philipp Zabel , Andy Yan , Mark Yao , Heiko Stuebner Subject: [RFC PATCH v2 1/4] drm: dw-hdmi: make it easy to recovery the platform data for platform driver Date: Thu, 7 Jan 2016 16:57:53 +0800 Message-Id: <1452157073-18576-1-git-send-email-ykk@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452156811-18150-1-git-send-email-ykk@rock-chips.com> References: <1452156811-18150-1-git-send-email-ykk@rock-chips.com> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Rob Herring , Kumar Gala , linux-arm-kernel@lists.infradead.org, Zheng Yang 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" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Signed-off-by: Yakir Yang --- Changes in v2: None drivers/gpu/drm/imx/dw_hdmi-imx.c | 7 ++++--- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c b/drivers/gpu/drm/imx/dw_hdmi-imx.c index 063825f..0968610 100644 --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c @@ -26,6 +26,7 @@ struct imx_hdmi { struct device *dev; struct drm_encoder encoder; struct regmap *regmap; + struct dw_hdmi_plat_data plat_data; }; static const struct dw_hdmi_mpll_config imx_mpll_cfg[] = { @@ -204,7 +205,6 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); - const struct dw_hdmi_plat_data *plat_data; const struct of_device_id *match; struct drm_device *drm = data; struct drm_encoder *encoder; @@ -221,7 +221,7 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, return -ENOMEM; match = of_match_node(dw_hdmi_imx_dt_ids, pdev->dev.of_node); - plat_data = match->data; + hdmi->plat_data = *(const struct dw_hdmi_plat_data *)match->data; hdmi->dev = &pdev->dev; encoder = &hdmi->encoder; @@ -253,7 +253,8 @@ static int dw_hdmi_imx_bind(struct device *dev, struct device *master, drm_encoder_init(drm, encoder, &dw_hdmi_imx_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); - return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data); + return dw_hdmi_bind(dev, master, data, encoder, iores, irq, + &hdmi->plat_data); } static void dw_hdmi_imx_unbind(struct device *dev, struct device *master, diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index c65ce8c..d5816b3 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -28,6 +28,7 @@ struct rockchip_hdmi { struct device *dev; struct regmap *regmap; struct drm_encoder encoder; + struct dw_hdmi_plat_data plat_data; }; #define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x) @@ -242,7 +243,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); - const struct dw_hdmi_plat_data *plat_data; const struct of_device_id *match; struct drm_device *drm = data; struct drm_encoder *encoder; @@ -259,7 +259,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, return -ENOMEM; match = of_match_node(dw_hdmi_rockchip_dt_ids, pdev->dev.of_node); - plat_data = match->data; + hdmi->plat_data = *(const struct dw_hdmi_plat_data *)match->data; hdmi->dev = &pdev->dev; encoder = &hdmi->encoder; @@ -293,7 +293,8 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); - return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data); + return dw_hdmi_bind(dev, master, data, encoder, iores, irq, + &hdmi->plat_data); } static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,