From patchwork Thu Oct 19 17:05:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 10017845 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 7D50F602C8 for ; Thu, 19 Oct 2017 17:10:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 675AC28CF0 for ; Thu, 19 Oct 2017 17:10:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AB4928D55; Thu, 19 Oct 2017 17:10:23 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA8428CF0 for ; Thu, 19 Oct 2017 17:10:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755167AbdJSRJ1 (ORCPT ); Thu, 19 Oct 2017 13:09:27 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:50663 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755133AbdJSRIz (ORCPT ); Thu, 19 Oct 2017 13:08:55 -0400 Received: by mail-wr0-f194.google.com with SMTP id q42so9042252wrb.7 for ; Thu, 19 Oct 2017 10:08:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YBGegqm2fHrZCHEZt7W/w8X5F/h/bUD75IbXg0MUAC8=; b=DINGSdIxFJKyvaYda0xywaVbgykideaBsUOsxVZMsHjhAEw/5iMiRD5XBKFXWpOAZk QGYbBtHSBxohjt7eTsBoU/aX+Hxs7V4MWblfHYYNI9sFP230uPBXtRL19vskJk++WqDu EPrtXi3TXq4eYTh5oDPUHYbB5ZJCBZuRNrcbo= 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:in-reply-to :references; bh=YBGegqm2fHrZCHEZt7W/w8X5F/h/bUD75IbXg0MUAC8=; b=kPLTwb6RjT776/IJOa4w+CEUcoE/LI9sg38n8ybGcure2dcI3eD98ToHDnvAE0Y8lH GMy2bA4NE643avuBRwq5xxI2pc7yV0g12uIziV0ZcKjHf8ZUoPAFyw7U4H/TIzV0fJY2 Qt4hg4bv6x7Yk7gHkqRU0RpjCXBs46pQw4bqsIKRYXaZXjlxft/D3sPkrxDXqzW6ISNO aHD3+36zVJr3Lq15Z+ATETIcBqvisLqCUWOwaMWZ2O9QmL1aLM9L7iWasGJTk4T6JPgc l7s0EkQ4vonWAm4fqtTZqwd8eplJK22co51NeQ/m6s8j52GhShQT4ZdW29ahzNTY0S5C 4f6w== X-Gm-Message-State: AMCzsaWFLgaTHPZm8NBp/kLNw4B1P4eOKOoJ5gHGCSmU0u1SluCBt/S5 Oiuq5AEt2obhizYLx3/1DZ4fLg== X-Google-Smtp-Source: ABhQp+RZgv3Ds0J2OaMIM18TJHXRgkC3hftWqSQ1O1l8dgwr06As88QHEap3zolI7E/YMcQWMrWfIw== X-Received: by 10.223.150.76 with SMTP id c12mr2336095wra.10.1508432933831; Thu, 19 Oct 2017 10:08:53 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:51c7:d9b7:e14b:6840]) by smtp.gmail.com with ESMTPSA id g16sm14277394wrd.72.2017.10.19.10.08.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Oct 2017 10:08:53 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, leo.yan@linaro.org, linux-kernel@vger.kernel.org, Laxman Dewangan Subject: [PATCH 17/18] thermal/drivers/generic-iio-adc: Switch tz request to devm version Date: Thu, 19 Oct 2017 19:05:59 +0200 Message-Id: <1508432760-17847-17-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508432760-17847-1-git-send-email-daniel.lezcano@linaro.org> References: <6ac48f08-7fe6-92e9-0801-6ed3bcd05ff1@linaro.org> <1508432760-17847-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Everything mentionned here: https://lkml.org/lkml/2016/4/20/850 This driver was added before the devm_iio_channel_get() function version was merged. The sensor should be released before the iio channel, thus we had to use the non-devm version of thermal_zone_of_sensor_register(). Now the devm_iio_channel_get() is available, do the corresponding change in this driver and remove gadc_thermal_remove(). [Compiled tested only] Acked-by: Laxman Dewangan Signed-off-by: Daniel Lezcano --- drivers/thermal/thermal-generic-adc.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c index 73f55d6..46d3005 100644 --- a/drivers/thermal/thermal-generic-adc.c +++ b/drivers/thermal/thermal-generic-adc.c @@ -126,38 +126,23 @@ static int gadc_thermal_probe(struct platform_device *pdev) gti->dev = &pdev->dev; platform_set_drvdata(pdev, gti); - gti->channel = iio_channel_get(&pdev->dev, "sensor-channel"); + gti->channel = devm_iio_channel_get(&pdev->dev, "sensor-channel"); if (IS_ERR(gti->channel)) { ret = PTR_ERR(gti->channel); dev_err(&pdev->dev, "IIO channel not found: %d\n", ret); return ret; } - gti->tz_dev = thermal_zone_of_sensor_register(&pdev->dev, 0, - gti, &gadc_thermal_ops); + gti->tz_dev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, gti, + &gadc_thermal_ops); if (IS_ERR(gti->tz_dev)) { ret = PTR_ERR(gti->tz_dev); dev_err(&pdev->dev, "Thermal zone sensor register failed: %d\n", ret); - goto sensor_fail; + return ret; } return 0; - -sensor_fail: - iio_channel_release(gti->channel); - - return ret; -} - -static int gadc_thermal_remove(struct platform_device *pdev) -{ - struct gadc_thermal_info *gti = platform_get_drvdata(pdev); - - thermal_zone_of_sensor_unregister(&pdev->dev, gti->tz_dev); - iio_channel_release(gti->channel); - - return 0; } static const struct of_device_id of_adc_thermal_match[] = { @@ -172,7 +157,6 @@ static struct platform_driver gadc_thermal_driver = { .of_match_table = of_adc_thermal_match, }, .probe = gadc_thermal_probe, - .remove = gadc_thermal_remove, }; module_platform_driver(gadc_thermal_driver);