From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.1 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,USER_AGENT_SANE_1 autolearn=unavailable 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 4B6F3C433E1 for ; Mon, 17 Aug 2020 16:54:04 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D0DB20729 for ; Mon, 17 Aug 2020 16:54:04 +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="RPTngQMJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D0DB20729 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E1DFA86DCE; Mon, 17 Aug 2020 16:54:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vHnxBoaSMHaU; Mon, 17 Aug 2020 16:54:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 0919C86DEA; Mon, 17 Aug 2020 16:54:03 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E8985C07FF; Mon, 17 Aug 2020 16:54:02 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id F130AC0051 for ; Mon, 17 Aug 2020 16:54:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id EBFD2879CF for ; Mon, 17 Aug 2020 16:54:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GbNxfe2xP1iN for ; Mon, 17 Aug 2020 16:54:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from m43-7.mailgun.net (m43-7.mailgun.net [69.72.43.7]) by hemlock.osuosl.org (Postfix) with ESMTPS id 7D434879CC for ; Mon, 17 Aug 2020 16:53:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597683241; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=CWGALEqQ4ZA1LCRWwGY3ghzqLDTb2GiGuUvIFbf/Xdo=; b=RPTngQMJpsZBfNjKR2v6eNcapLidAaU6gy4s7mox1tgMV0rIGmxcvIGURVChF3EHC4FXVYfW z3LNoayn7AuRu0vzQVGKjz9SUDyhtXk0ehN0gB1lq5/qV9MXHHICjuDz0SdVr8HJgrf7q7Ts s6Z54A4Pu452evOFls+4t/3RoFg= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3NDkwMCIsICJpb21tdUBsaXN0cy5saW51eC1mb3VuZGF0aW9uLm9yZyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 5f3ab61cd48d4625ca9846c1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 17 Aug 2020 16:53:48 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 52F9CC433CA; Mon, 17 Aug 2020 16:53:47 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse) by smtp.codeaurora.org (Postfix) with ESMTPSA id D110DC433C6; Mon, 17 Aug 2020 16:53:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D110DC433C6 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=jcrouse@codeaurora.org Date: Mon, 17 Aug 2020 10:53:41 -0600 From: Jordan Crouse To: Rob Clark Subject: Re: [Freedreno] [PATCH 06/19] drm/msm/gpu: add dev_to_gpu() helper Message-ID: <20200817165341.GI3221@jcrouse1-lnx.qualcomm.com> Mail-Followup-To: Rob Clark , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-arm-msm@vger.kernel.org, Rob Clark , Sai Prakash Ranjan , open list , Daniel Vetter , Jonathan Marek , David Airlie , Will Deacon , Joerg Roedel , Robin Murphy , Bjorn Andersson , AngeloGioacchino Del Regno , Sean Paul , Sibi Sankar , Vivek Gautam , Shawn Guo , Stephen Boyd , freedreno@lists.freedesktop.org, Sharat Masetty , linux-arm-kernel@lists.infradead.org References: <20200810222657.1841322-1-jcrouse@codeaurora.org> <20200814024114.1177553-7-robdclark@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200814024114.1177553-7-robdclark@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: David Airlie , dri-devel@lists.freedesktop.org, Vivek Gautam , AngeloGioacchino Del Regno , Will Deacon , Rob Clark , Jonathan Marek , Sibi Sankar , linux-arm-msm@vger.kernel.org, Sharat Masetty , Stephen Boyd , Sean Paul , linux-arm-kernel@lists.infradead.org, Robin Murphy , open list , iommu@lists.linux-foundation.org, Daniel Vetter , Shawn Guo , freedreno@lists.freedesktop.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Thu, Aug 13, 2020 at 07:41:01PM -0700, Rob Clark wrote: > From: Rob Clark > > In a later patch, the drvdata will not directly be 'struct msm_gpu *', > so add a helper to reduce the churn. > Reviewed-by: Jordan Crouse > Signed-off-by: Rob Clark > --- > drivers/gpu/drm/msm/adreno/adreno_device.c | 10 ++++------ > drivers/gpu/drm/msm/msm_gpu.c | 6 +++--- > drivers/gpu/drm/msm/msm_gpu.h | 5 +++++ > 3 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c > index 9eeb46bf2a5d..26664e1b30c0 100644 > --- a/drivers/gpu/drm/msm/adreno/adreno_device.c > +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c > @@ -282,7 +282,7 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev) > int ret; > > if (pdev) > - gpu = platform_get_drvdata(pdev); > + gpu = dev_to_gpu(&pdev->dev); > > if (!gpu) { > dev_err_once(dev->dev, "no GPU device was found\n"); > @@ -425,7 +425,7 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) > static void adreno_unbind(struct device *dev, struct device *master, > void *data) > { > - struct msm_gpu *gpu = dev_get_drvdata(dev); > + struct msm_gpu *gpu = dev_to_gpu(dev); > > pm_runtime_force_suspend(dev); > gpu->funcs->destroy(gpu); > @@ -490,16 +490,14 @@ static const struct of_device_id dt_match[] = { > #ifdef CONFIG_PM > static int adreno_resume(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct msm_gpu *gpu = platform_get_drvdata(pdev); > + struct msm_gpu *gpu = dev_to_gpu(dev); > > return gpu->funcs->pm_resume(gpu); > } > > static int adreno_suspend(struct device *dev) > { > - struct platform_device *pdev = to_platform_device(dev); > - struct msm_gpu *gpu = platform_get_drvdata(pdev); > + struct msm_gpu *gpu = dev_to_gpu(dev); > > return gpu->funcs->pm_suspend(gpu); > } > diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c > index d5645472b25d..6aa9e04e52e7 100644 > --- a/drivers/gpu/drm/msm/msm_gpu.c > +++ b/drivers/gpu/drm/msm/msm_gpu.c > @@ -24,7 +24,7 @@ > static int msm_devfreq_target(struct device *dev, unsigned long *freq, > u32 flags) > { > - struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); > + struct msm_gpu *gpu = dev_to_gpu(dev); > struct dev_pm_opp *opp; > > opp = devfreq_recommended_opp(dev, freq, flags); > @@ -45,7 +45,7 @@ static int msm_devfreq_target(struct device *dev, unsigned long *freq, > static int msm_devfreq_get_dev_status(struct device *dev, > struct devfreq_dev_status *status) > { > - struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); > + struct msm_gpu *gpu = dev_to_gpu(dev); > ktime_t time; > > if (gpu->funcs->gpu_get_freq) > @@ -64,7 +64,7 @@ static int msm_devfreq_get_dev_status(struct device *dev, > > static int msm_devfreq_get_cur_freq(struct device *dev, unsigned long *freq) > { > - struct msm_gpu *gpu = platform_get_drvdata(to_platform_device(dev)); > + struct msm_gpu *gpu = dev_to_gpu(dev); > > if (gpu->funcs->gpu_get_freq) > *freq = gpu->funcs->gpu_get_freq(gpu); > diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h > index 0db117a7339b..8bda7beaed4b 100644 > --- a/drivers/gpu/drm/msm/msm_gpu.h > +++ b/drivers/gpu/drm/msm/msm_gpu.h > @@ -141,6 +141,11 @@ struct msm_gpu { > struct msm_gpu_state *crashstate; > }; > > +static inline struct msm_gpu *dev_to_gpu(struct device *dev) > +{ > + return dev_get_drvdata(dev); > +} > + > /* It turns out that all targets use the same ringbuffer size */ > #define MSM_GPU_RINGBUFFER_SZ SZ_32K > #define MSM_GPU_RINGBUFFER_BLKSIZE 32 > -- > 2.26.2 > > _______________________________________________ > Freedreno mailing list > Freedreno@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/freedreno -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu