Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1601895ybi; Wed, 3 Jul 2019 19:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxizPk9ow8/MijAL2x1QNXMixJiJjI41KP1atoO12u2tumWFAQhIvzHndDD3mitiDYYRN7i X-Received: by 2002:a63:4c52:: with SMTP id m18mr8451972pgl.302.1562207823206; Wed, 03 Jul 2019 19:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562207823; cv=none; d=google.com; s=arc-20160816; b=mwWmEyRroez7x+MCgFlXsG2NMIokD9MDYfSvbJcM9Ud3ERKLkz8Ludrn3qkIaSTsQr 9rmmlrjoxZPvj8DHWmBVRh0MKVi0G2N1uBGVy19oSp8QI3HID4pGBVOwnqDFL5Xzk+dE LQY8H+jpwsbsGPUog0egzkSlAXaA9eA0RTTXA/UIzNxGRiVU9VCbidrS8UYnWGmKitP1 nZnjN0jzKHRyX8ZeRi7XdHIefqHxaefpem3XDXXYZB8YYq6JKkNzlReEPOkY1kXXDqjE EQDXboAhYCb/vSuN6yxMU2wjgagOi5XBMlwrcUsBFUAV6qzDjFd/+g930yprUAkhW25K tZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=M8gkH2EuGEhpnR2pTwKfU95prWM3XzY3XXen65sRHVg=; b=nNISHP7feXJHpbWwgUjA5kwOcwKX8gUm5U4RabcgowmdZnvZwW6LIdig8Vj1zvPYSo H2CmvmzLBQtHFl0ABdQ7Klt0UsC0XXzfpfuLwT0OSMrd4A559YbG7bfmjeZSW+qQx2oJ UpRj1yFmgiy8se5QomQMsgUbLZP+79/TKS7WBUmbsKxSpFtPsMUTLDcEz/GsuTi7KmGZ g0CoPkOH27OTYI5bM5yCq4+3nU5htnkpFP5ZXSEBPi5z1Zg+eikkR16sw9843yBnfxrV LBFJ7xbz8c/fWEjZyUe1QS9C7yuKRxx614rIn5uU3LWSMSaJkAF6GRf80PbhjO2bsZWA BZ+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ATQ3ihl0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si1623314pfb.206.2019.07.03.19.36.48; Wed, 03 Jul 2019 19:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ATQ3ihl0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727300AbfGDCgN (ORCPT + 99 others); Wed, 3 Jul 2019 22:36:13 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:44986 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbfGDCgN (ORCPT ); Wed, 3 Jul 2019 22:36:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id t16so2171852pfe.11 for ; Wed, 03 Jul 2019 19:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=M8gkH2EuGEhpnR2pTwKfU95prWM3XzY3XXen65sRHVg=; b=ATQ3ihl05TYcxtg43qA/s8JbGDT/wgAy7Vl3nMui1WpNeUypKZ5Q4vATOEVms+yAz6 dhkYBbOUGQ/9h/3iHkDXixRnBqKcQV/deA30JWCK9yTPjFHatnwvq+TFFgHAiApSS5fA SqD9VQKfMP2HxhpI7gk9OOt2B9Tiv5QC8NPsZ1q1yv/UWfVYffGdT6HldhOV8kMnYJHm rLUR/uhzuOTi5X7Mt2Bj+p0xn6NxJj1RQ+UYv1a7LGge1G/J6NsWitN1mXoPeHlAQkN1 GUeTPYRaOs590b1UG3RyQHvuaiIJq4ZLJdmUtqZIUJshx2xvotmQqsYqa8zr3o96YtZc yMuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=M8gkH2EuGEhpnR2pTwKfU95prWM3XzY3XXen65sRHVg=; b=dbpbh9meld2TTYxmZQh2B5N4FhTwxfRlJt5IeCZuFisgjbqMxDP2lR5sxmCCmAdbrg F1smQA7wtfguAbXsq7quFf73iJFdVR5BDtPRhOsrJmza/8qfDJkRKJuyi3RmIYQJL+81 opihPzHvnr0uc1ckNnroxi7Ta/00qefUnQS6enFlpsXIb9nM2otEykMyjRSO7SZGUr5/ qy07id+CS2gQRktIHXGFXZNVfuSJO9H/aiqz7oNfOB8WerBQQuLOL3hOj5j1vuLGrlNn fjK47co4ftejSIobniXQ8DeGrtk2ZSD2oRzERkCLlvJ9A7xPDiJv3qAQHWsUNpndhOy5 9PAA== X-Gm-Message-State: APjAAAWYY1nKHQcoeDZruWRCXJuFUWGlm2WqixDsdD6d22FVIJbGu0sk 7Xz0rns2DhwElUFNXJgSn9193uhSFaU= X-Received: by 2002:a17:90a:bf08:: with SMTP id c8mr16472122pjs.75.1562207772377; Wed, 03 Jul 2019 19:36:12 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id k70sm7858346pje.14.2019.07.03.19.36.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Jul 2019 19:36:12 -0700 (PDT) From: Fuqian Huang Cc: Rob Herring , Tomeu Vizoso , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [Patch v2 04/10] drm/panfrost: using dev_get_drvdata directly Date: Thu, 4 Jul 2019 10:36:05 +0800 Message-Id: <20190704023605.4597-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Several drivers cast a struct device pointer to a struct platform_device pointer only to then call platform_get_drvdata(). To improve readability, these constructs can be simplified by using dev_get_drvdata() directly. Signed-off-by: Fuqian Huang --- Changes in v2: - Make the commit message more clearly. drivers/gpu/drm/panfrost/panfrost_devfreq.c | 6 +++--- drivers/gpu/drm/panfrost/panfrost_device.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index db798532b0b6..bef5df4d99ac 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -18,7 +18,7 @@ static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev, i static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, u32 flags) { - struct panfrost_device *pfdev = platform_get_drvdata(to_platform_device(dev)); + struct panfrost_device *pfdev = dev_get_drvdata(dev); struct dev_pm_opp *opp; unsigned long old_clk_rate = pfdev->devfreq.cur_freq; unsigned long target_volt, target_rate; @@ -86,7 +86,7 @@ static void panfrost_devfreq_reset(struct panfrost_device *pfdev) static int panfrost_devfreq_get_dev_status(struct device *dev, struct devfreq_dev_status *status) { - struct panfrost_device *pfdev = platform_get_drvdata(to_platform_device(dev)); + struct panfrost_device *pfdev = dev_get_drvdata(dev); int i; for (i = 0; i < NUM_JOB_SLOTS; i++) { @@ -117,7 +117,7 @@ static int panfrost_devfreq_get_dev_status(struct device *dev, static int panfrost_devfreq_get_cur_freq(struct device *dev, unsigned long *freq) { - struct panfrost_device *pfdev = platform_get_drvdata(to_platform_device(dev)); + struct panfrost_device *pfdev = dev_get_drvdata(dev); *freq = pfdev->devfreq.cur_freq; diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c index 3b2bced1b015..ed187648e6d8 100644 --- a/drivers/gpu/drm/panfrost/panfrost_device.c +++ b/drivers/gpu/drm/panfrost/panfrost_device.c @@ -227,8 +227,7 @@ const char *panfrost_exception_name(struct panfrost_device *pfdev, u32 exception #ifdef CONFIG_PM int panfrost_device_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct panfrost_device *pfdev = platform_get_drvdata(pdev); + struct panfrost_device *pfdev = dev_get_drvdata(dev); panfrost_gpu_soft_reset(pfdev); @@ -243,8 +242,7 @@ int panfrost_device_resume(struct device *dev) int panfrost_device_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct panfrost_device *pfdev = platform_get_drvdata(pdev); + struct panfrost_device *pfdev = dev_get_drvdata(dev); if (!panfrost_job_is_idle(pfdev)) return -EBUSY; -- 2.11.0