From patchwork Thu Apr 19 14:06:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 10350951 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94BE6602B7 for ; Thu, 19 Apr 2018 14:48:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 856DD27C2D for ; Thu, 19 Apr 2018 14:48:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A1C928A3B; Thu, 19 Apr 2018 14:48:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D54FF27C2D for ; Thu, 19 Apr 2018 14:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1F3+Zr/QaWlyLoAYxpv6atS2gg9oZer60D+UKy4oO/U=; b=cOOtpPKL5HLZjqycAH4f5FJf9O pphMYvelIDzKxegjRjLYG1tTjB7pyUuKF9tHqSZsAeNJBysrpGixui8p3J1SXcFSTkw0mr/reF4yy V6jhydEHiO9oLAa969eqbrfzNpomMXy775/mCbQ7wqX3qbkw/7F8jGbYDaIm+kkq5xVcbB0mkyKwZ zEq7MBWpo3RZEP9y1WS7YkQV3X4OS966NP1Xg9lk3rz7D2DNbWoSa8dtcBePThdOp/jxdTlfp2J/D EvuyesIAjAaCzgBhEHCVxTpHTiBSDuUBtGzlocBnEg3TXL4aD1V7FnGZjFhO9rq4Xx//DUlaSuk0w rj85yrqw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9ArW-0000Gj-7M; Thu, 19 Apr 2018 14:48:38 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9AcV-0006Lp-Cq; Thu, 19 Apr 2018 14:33:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IfD+uF1nws33Wnj3y6NtpquDTtZr2dp0bPfNw7XR7Vs=; b=O8qKmUjTQeDWRKQMRgW/IMEBl poD8bueC1gkjswbI71JKv3aBg8JPf33rA5ak5eSRTv6sj4lFfheIiDPEK0OP86W7FPG/AUXYkg5mc cFOTXtkYrQT26FFlBX+IyZJQwFLB2MokxmTAjiKwcvsMpPfTJvzyWDkg6ZVZVH/l+kRaJjWqUUpwz Ob6h/YuowGfP5ac9BryUk7wvPRd2He4qQZaNYpFnKnzV2YFRA1rXqFbwcwpN2CotZGVRtPisC22xd GcvvMtBped5ngXsQVdQXQUjaGmbD+qhAspRbTqdUYVvMLnivz09Keu4VX178ntlLFmArtbt9dAPJy ZRGzbA7IQ==; Received: from sauhun.de ([88.99.104.3] helo=pokefinder.org) by casper.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9ADc-0004eq-Mz; Thu, 19 Apr 2018 14:07:32 +0000 Received: from localhost (unknown [145.253.130.2]) by pokefinder.org (Postfix) with ESMTPSA id EEABC3139D8; Thu, 19 Apr 2018 16:07:10 +0200 (CEST) From: Wolfram Sang To: linux-kernel@vger.kernel.org Subject: [PATCH 50/61] thermal: simplify getting .drvdata Date: Thu, 19 Apr 2018 16:06:20 +0200 Message-Id: <20180419140641.27926-51-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180419140641.27926-1-wsa+renesas@sang-engineering.com> References: <20180419140641.27926-1-wsa+renesas@sang-engineering.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180419_150724_794202_B88B88FB X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Valentin , Heiko Stuebner , linux-pm@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Wolfram Sang , linux-rockchip@lists.infradead.org, Zhang Rui , Baoyou Xie , Shawn Guo , Jun Nie , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Acked-by: Shawn Guo Reviewed-by: Heiko Stuebner --- Build tested only. buildbot is happy. Please apply individually. drivers/thermal/rockchip_thermal.c | 8 +++----- drivers/thermal/spear_thermal.c | 8 +++----- drivers/thermal/zx2967_thermal.c | 6 ++---- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index f36375d5a16c..9c7643d62ed7 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev) static int __maybe_unused rockchip_thermal_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); + struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); int i; for (i = 0; i < thermal->chip->chn_num; i++) @@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev) static int __maybe_unused rockchip_thermal_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev); + struct rockchip_thermal_data *thermal = dev_get_drvdata(dev); int i; int error; @@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev) id, thermal->regs, thermal->tshut_temp); if (error) - dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n", + dev_err(dev, "%s: invalid tshut=%d, error=%d\n", __func__, thermal->tshut_temp, error); } diff --git a/drivers/thermal/spear_thermal.c b/drivers/thermal/spear_thermal.c index 81b35aace9de..8b9d567134d0 100644 --- a/drivers/thermal/spear_thermal.c +++ b/drivers/thermal/spear_thermal.c @@ -56,8 +56,7 @@ static struct thermal_zone_device_ops ops = { static int __maybe_unused spear_thermal_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); + struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); struct spear_thermal_dev *stdev = spear_thermal->devdata; unsigned int actual_mask = 0; @@ -73,15 +72,14 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev) static int __maybe_unused spear_thermal_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev); + struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev); struct spear_thermal_dev *stdev = spear_thermal->devdata; unsigned int actual_mask = 0; int ret = 0; ret = clk_enable(stdev->clk); if (ret) { - dev_err(&pdev->dev, "Can't enable clock\n"); + dev_err(dev, "Can't enable clock\n"); return ret; } diff --git a/drivers/thermal/zx2967_thermal.c b/drivers/thermal/zx2967_thermal.c index 6acce0bce7c0..145ebf371598 100644 --- a/drivers/thermal/zx2967_thermal.c +++ b/drivers/thermal/zx2967_thermal.c @@ -207,8 +207,7 @@ MODULE_DEVICE_TABLE(of, zx2967_thermal_id_table); #ifdef CONFIG_PM_SLEEP static int zx2967_thermal_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev); + struct zx2967_thermal_priv *priv = dev_get_drvdata(dev); if (priv && priv->clk_topcrm) clk_disable_unprepare(priv->clk_topcrm); @@ -221,8 +220,7 @@ static int zx2967_thermal_suspend(struct device *dev) static int zx2967_thermal_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct zx2967_thermal_priv *priv = platform_get_drvdata(pdev); + struct zx2967_thermal_priv *priv = dev_get_drvdata(dev); int error; error = clk_prepare_enable(priv->clk_topcrm);