From patchwork Thu Aug 13 17:21:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhinav Kumar X-Patchwork-Id: 250686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3EFAC433DF for ; Thu, 13 Aug 2020 17:22:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8B1620838 for ; Thu, 13 Aug 2020 17:22:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="ms0GuD4I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726499AbgHMRWP (ORCPT ); Thu, 13 Aug 2020 13:22:15 -0400 Received: from mail29.static.mailgun.info ([104.130.122.29]:13814 "EHLO mail29.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbgHMRWN (ORCPT ); Thu, 13 Aug 2020 13:22:13 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597339333; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=786HhmTvA7y0BFqKNs6mun0KPR0yYPjWkzHkOLmJ94I=; b=ms0GuD4IwByq7PmyfIlGrb9XY+b+a5v5SfIQjpFnZNzEpOgqab4PGMsnNqvv6bFxzRNtd65p x/KvBSLBdP4fV+GdKEJoYXIU1bMPGMRQkW44YOBoyKLWIFAUg08rMYLL4KLiTPp9E+PoXNvx 53mKMLhHSBXJu2Fo9dAJDwBwe9w= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyI1MzIzYiIsICJsaW51eC1hcm0tbXNtQHZnZXIua2VybmVsLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5f3576bcd48d4625cabd063b (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 13 Aug 2020 17:22:04 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 99629C43391; Thu, 13 Aug 2020 17:22:03 +0000 (UTC) Received: from abhinavk-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: abhinavk) by smtp.codeaurora.org (Postfix) with ESMTPSA id 61F8FC433C9; Thu, 13 Aug 2020 17:22:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 61F8FC433C9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=abhinavk@codeaurora.org From: Abhinav Kumar To: dri-devel@lists.freedesktop.org Cc: Abhinav Kumar , linux-arm-msm@vger.kernel.org, robdclark@gmail.com, seanpaul@chromium.org, swboyd@chromium.org, nganji@codeaurora.org, aravindh@codeaurora.org, tanmay@codeaurora.org, cychiang@chromium.org, khsieh@codeaurora.org, vsujithk@codeaurora.org, rohitkr@codeaurora.org Subject: [PATCH v2 1/4] drm/msm/dp: store dp_display in the driver data Date: Thu, 13 Aug 2020 10:21:51 -0700 Message-Id: <20200813172154.24565-2-abhinavk@codeaurora.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20200813172154.24565-1-abhinavk@codeaurora.org> References: <20200813172154.24565-1-abhinavk@codeaurora.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Store the dp_display in the platform driver data instead of the dp_display_private. This is required to allow other sub-modules to reuse the platform driver data. Changes in V2: none Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/msm/dp/dp_display.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 4cce7e5017a5..d32ce6753883 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -170,11 +170,11 @@ static int dp_display_bind(struct device *dev, struct device *master, struct dp_display_private *dp; struct drm_device *drm; struct msm_drm_private *priv; - struct platform_device *pdev = to_platform_device(dev); drm = dev_get_drvdata(master); - dp = platform_get_drvdata(pdev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); if (!dp) { DRM_ERROR("DP driver bind failed. Invalid driver data\n"); return -EINVAL; @@ -209,11 +209,11 @@ static void dp_display_unbind(struct device *dev, struct device *master, void *data) { struct dp_display_private *dp; - struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm = dev_get_drvdata(master); struct msm_drm_private *priv = drm->dev_private; - dp = platform_get_drvdata(pdev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); if (!dp) { DRM_ERROR("Invalid DP driver data\n"); return; @@ -348,7 +348,8 @@ static int dp_display_usbpd_configure_cb(struct device *dev) goto end; } - dp = dev_get_drvdata(dev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); if (!dp) { DRM_ERROR("no driver data found\n"); rc = -ENODEV; @@ -372,7 +373,8 @@ static int dp_display_usbpd_disconnect_cb(struct device *dev) int rc = 0; struct dp_display_private *dp; - dp = dev_get_drvdata(dev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); @@ -424,7 +426,8 @@ static int dp_display_usbpd_attention_cb(struct device *dev) return -EINVAL; } - dp = dev_get_drvdata(dev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); if (!dp) { DRM_ERROR("no driver data found\n"); return -ENODEV; @@ -995,11 +998,12 @@ static int dp_display_probe(struct platform_device *pdev) return -EPROBE_DEFER; } - platform_set_drvdata(pdev, dp); - mutex_init(&dp->event_mutex); + g_dp_display = &dp->dp_display; + platform_set_drvdata(pdev, g_dp_display); + rc = component_add(&pdev->dev, &dp_display_comp_ops); if (rc) { DRM_ERROR("component add failed, rc=%d\n", rc); @@ -1013,7 +1017,8 @@ static int dp_display_remove(struct platform_device *pdev) { struct dp_display_private *dp; - dp = platform_get_drvdata(pdev); + dp = container_of(g_dp_display, + struct dp_display_private, dp_display); dp_display_deinit_sub_modules(dp);