Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751869AbbKJCMO (ORCPT ); Mon, 9 Nov 2015 21:12:14 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:61002 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751252AbbKJCML (ORCPT ); Mon, 9 Nov 2015 21:12:11 -0500 X-IronPort-AV: E=Sophos;i="5.20,268,1444662000"; d="scan'";a="199423183" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <87egfylia4.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/2] thermal: rcar_thermal: remove redundant operation User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Zhang Rui , Eduardo Valentin CC: Linux-SH , Linux-Kernel , , , In-Reply-To: <87fv0elibh.wl%kuninori.morimoto.gx@renesas.com> References: <87h9kulkfg.wl%kuninori.morimoto.gx@renesas.com> <87fv0elibh.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Tue, 10 Nov 2015 02:12:06 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TY1PR0201CA0041.apcprd02.prod.outlook.com (25.164.90.179) To SG2PR06MB1019.apcprd06.prod.outlook.com (25.161.9.27) X-Microsoft-Exchange-Diagnostics: 1;SG2PR06MB1019;2:5Q3OPQ1iYRJOP9ctotaw9Rdmwk/vx1b4/xyZMp3ddSnYLnmS8qLlu5oPdamQx80AGYgPEdEHdETxVzibuH5rnE6bmwV0sM0rM9hOie1JDZc/UdMbc8gB9/vKEtU9I3hmf5ct+egSJyIj4vkdW/yDENkZdxJuz4Odvpl+5VYC1d0=;3:hDZFhAUXWfkvgw9p+7YLbhIg1VEOuJwY/QDBVn3N/1EUsqlFMN83w5oJ28JR/SDYGRJGw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aDn3Opx2ib0+scNgDRv193elICpq/eGNc662QWiN0ADUqKJPZDUV/Kqol1PjxBwObm37xry5VTdaEtaXl3eG/EgLsygm9QA74npYfEO1mXHZKLsEI3TzolIrUkc9GsrTwnXSWBV27EeuMAV0wtqpxrv4p9ZG3EvQUAJpSj8NK8+YyY/0W7swVONLjVCYmRaBeDhtUZN5w6Vvg0S84TwKM7JlHT/22/yEYQPERgD4tIa0Wkv0OUwioxdW3BVnzyH/O469kaFnJmcbjNZzVXXRngfJokbf X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85106069007906); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046);SRVR:SG2PR06MB1019;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1019; X-Forefront-PRVS: 07562C22DA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(199003)(189002)(53416004)(36756003)(50986999)(47776003)(76176999)(66066001)(42186005)(69596002)(54356999)(19580395003)(46406003)(19580405001)(86362001)(101416001)(23726002)(5004730100002)(40100003)(33646002)(5007970100001)(92566002)(83506001)(122386002)(5001960100002)(5008740100001)(50466002)(189998001)(229853001)(2950100001)(105586002)(106356001)(97736004)(4001350100001)(77096005)(81156007)(5001920100001)(5001770100001)(87976001);DIR:OUT;SFP:1102;SCL:1;SRVR:SG2PR06MB1019;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SG2PR06MB1019;23:yjq0xSQFd97nY+Vu+COZZjzjpN5rsx2AD9f4nUShD?= =?us-ascii?Q?4uauGwepNuO0ieP0hKbY6eSnNLS6kziBWFesiCzQx2K6UEzycj0BbJ7psGil?= =?us-ascii?Q?D8hBo/r85s2NkRq1kTpGyK8gZwWZkTUMiQsM6Z5YULTqXVncoce7dxUaktHK?= =?us-ascii?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3GLhdyRKuQ/BERa6d1owQwzFnS?= =?us-ascii?Q?YRxjJvTEjTAxLCpPfIjQ8EdpG0E79JybL8npcdMPfWTNPTeFvMO5PoxeEoQx?= =?us-ascii?Q?dDU9CJJ2gI=3D?= X-Microsoft-Exchange-Diagnostics: 1;SG2PR06MB1019;5:RCieadjyG1I4QbSVSLqNisjI8YtgCVjE6kOd3ezCPRbpEWDKMNhGKNJxgVmb7nxSUrH1toU1fejhr0s/+Sk7Q3rHkEmV8d81Y/KfohPW8MB54wDSDD/O+lULK8vY+1RTvztGGbL7ZmUgzCniz4yTNw==;24:NWm7fpCAPUcTcUVc7N6yVynbm+Dbb7C9XKjX/jDFtBAYPHqoVAjTZ3zeyIP5SzjhlFUPuX0xLhwbxRnjDWcjeEvSXBFWmBVmdxi0iJyKepM=;20:zTrFLNbyCAFjFen9NvRuwhIlrhJRF42OxZIwzuudbbr/5aYWCsaG/PEII+d8/CvSuio7tjCx2eSMQ1UycVYzwpszhSMbC1h1KsTdqoy2I5k9fQ8Z7KKcsSDSm0l+GKVgj/lsA44rz5aoS+4icGOQM9Q9zgEyeZOhagekYgdr8IY= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2015 02:12:06.0308 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1019 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2756 Lines: 101 From: Kuninori Morimoto Probe error operation and remove operation are same. Let's use same function. Signed-off-by: Kuninori Morimoto --- drivers/thermal/rcar_thermal.c | 49 ++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index 5d4ae7d..13d01ed 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c @@ -361,6 +361,24 @@ static irqreturn_t rcar_thermal_irq(int irq, void *data) /* * platform functions */ +static int rcar_thermal_remove(struct platform_device *pdev) +{ + struct rcar_thermal_common *common = platform_get_drvdata(pdev); + struct device *dev = &pdev->dev; + struct rcar_thermal_priv *priv; + + rcar_thermal_for_each_priv(priv, common) { + if (rcar_has_irq_support(priv)) + rcar_thermal_irq_disable(priv); + thermal_zone_device_unregister(priv->zone); + } + + pm_runtime_put(dev); + pm_runtime_disable(dev); + + return 0; +} + static int rcar_thermal_probe(struct platform_device *pdev) { struct rcar_thermal_common *common; @@ -377,6 +395,8 @@ static int rcar_thermal_probe(struct platform_device *pdev) if (!common) return -ENOMEM; + platform_set_drvdata(pdev, common); + INIT_LIST_HEAD(&common->head); spin_lock_init(&common->lock); common->dev = dev; @@ -454,43 +474,16 @@ static int rcar_thermal_probe(struct platform_device *pdev) rcar_thermal_common_write(common, ENR, enr_bits); } - platform_set_drvdata(pdev, common); - dev_info(dev, "%d sensor probed\n", i); return 0; error_unregister: - rcar_thermal_for_each_priv(priv, common) { - if (rcar_has_irq_support(priv)) - rcar_thermal_irq_disable(priv); - thermal_zone_device_unregister(priv->zone); - } - - pm_runtime_put(dev); - pm_runtime_disable(dev); + rcar_thermal_remove(pdev); return ret; } -static int rcar_thermal_remove(struct platform_device *pdev) -{ - struct rcar_thermal_common *common = platform_get_drvdata(pdev); - struct device *dev = &pdev->dev; - struct rcar_thermal_priv *priv; - - rcar_thermal_for_each_priv(priv, common) { - if (rcar_has_irq_support(priv)) - rcar_thermal_irq_disable(priv); - thermal_zone_device_unregister(priv->zone); - } - - pm_runtime_put(dev); - pm_runtime_disable(dev); - - return 0; -} - static const struct of_device_id rcar_thermal_dt_ids[] = { { .compatible = "renesas,rcar-thermal", }, {}, -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/