From patchwork Tue Nov 10 02:12:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 7587611 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1E6BE9F2F7 for ; Tue, 10 Nov 2015 02:12:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F81620646 for ; Tue, 10 Nov 2015 02:12:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 096D420617 for ; Tue, 10 Nov 2015 02:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbbKJCMN (ORCPT ); Mon, 9 Nov 2015 21:12:13 -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 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 10 Nov 2015 11:12:09 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 62A0F415E8; Tue, 10 Nov 2015 11:12:09 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 608F88002E; Tue, 10 Nov 2015 11:12:09 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 5A7C88002D; Tue, 10 Nov 2015 11:12:09 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id MAD18843; Tue, 10 Nov 2015 11:12:09 +0900 X-IronPort-AV: E=Sophos;i="5.20,268,1444662000"; d="scan'";a="199423183" Received: from mail-sg2apc01lp0248.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.248]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 10 Nov 2015 11:12:08 +0900 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by SG2PR06MB1019.apcprd06.prod.outlook.com (10.161.9.27) with Microsoft SMTP Server (TLS) id 15.1.318.15; Tue, 10 Nov 2015 02:12:06 +0000 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") 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/yDENk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v5L4Viou0e2D+QTKtGp9p0TPTqsT6qpTZEaKAc/nWF6f/bBFB0dQ/zKUCFmeTdXpF1aZ70c8LokskaMIy9/9CBFDd+R700xZFY6GaDn3Opx2ib0+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?4uauGwepNuO0ieP0hKbY6eSnNLS6kziBWFesiCzQ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Ixj9Rdwi8x/UVUccizKJ6URmjdg5MErWmGEIlyV936PDHsIAim6KpJmWr?= =?us-ascii?Q?+OamXsQb6rEIESpFkGfI2WVgGhTo9L7wmS3GLhdyRKuQ/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-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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", }, {},