From patchwork Tue Oct 10 18:02:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 115437 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4042127qgn; Tue, 10 Oct 2017 11:08:06 -0700 (PDT) X-Received: by 10.98.32.212 with SMTP id m81mr14563895pfj.227.1507658886008; Tue, 10 Oct 2017 11:08:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507658886; cv=none; d=google.com; s=arc-20160816; b=Exgdfq9KsQ1KWZhuztAeVGaU9CDbE5emupjjrArN5DUD7/w0ugbNkhpQFWtQVyxbCd GJSwfKBa2YCFo3M8SvB21T07L2WvYmXpo+3bsaldSL0F4Qw9qvnEiCwPAtmZcK6Of873 +0x6f476LWSCHgFzmn8f6wUGZZAXUIz086JCl5b6tnlliZqgUS7CTu/Z/VLtTniBy+5d qXpJcSqtG9ehvYxlSgfBjN3BQHCAM5V9lrlGhnLXb3VOOEa7Sh388PVDgJ1Makpc3gsI gMYU7j4D8kV2IWEcLfRc11HCPfvESpQXQyZ2285EwJJHm2mHrrv3Uu5BIJ3dNlzzviCZ ovtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=YBGegqm2fHrZCHEZt7W/w8X5F/h/bUD75IbXg0MUAC8=; b=CcTrTk+r8mv4ncPydB67GcdWZ1YYf9oqqIHhmLZiWcnRbs1kEtGuIMA+tPY0g71Nm0 Aun+NYEXMdogdU1Cy6jqHsX0i4Y1/wdI6APD3OThFVylUiwiU3icpV042oV9Hx48ArCq xdzZFBamkYJ7pSJY1i/U2Myf0XcjNZDqd+W3PhM5bmBDmXRdo5sEnLkIZ6qEooHgyJ/s +DeT7NMA+Roqx7sIc1OyZxfva1vTYihu7uhxW22xv6C7Snyct5g+O3IE6jNvoI/n7U2g puVZpC7UUL1OeK1Ejx0N/Gy9hrpygxbTXmPOyKCoSLstVLVyn6d6JQvz+C/H4wk4oB3Y 0Zfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kB8jkiPT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si5844989pll.96.2017.10.10.11.08.05; Tue, 10 Oct 2017 11:08:05 -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=pass header.i=@linaro.org header.s=google header.b=kB8jkiPT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932629AbdJJSFN (ORCPT + 26 others); Tue, 10 Oct 2017 14:05:13 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:43640 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbdJJSFK (ORCPT ); Tue, 10 Oct 2017 14:05:10 -0400 Received: by mail-wm0-f51.google.com with SMTP id m72so16995416wmc.0 for ; Tue, 10 Oct 2017 11:05:10 -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=kB8jkiPT/ZXgqxAnjtfETS/3RLCj00DdCcA2S6k910p69EQGQSQw0D92ykCqc+p3tl lCXChPW6WAKFB5wTxsvFBOPwt36hobCxNVFZprIagcWUqw6p7tG3cKFuCk7zM+ve6968 WoE8pv88aVJMnKFDsYZmT0RQs2nGrcAS86cWs= 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=UXs89Rw0atMvPjnmJ2gn88bMNzIytr57IwMQdBhADw3hflX8+gg55cUbAGi8RIGFP9 4EAKHqHyB9fqFxKnmYwXks9mmwaHIlplT9ea4Pz09y+t4TTSqYiByKB3vnujPIK9jWzT TmgHhzVB83ttz58Kk5gyxjZDkFxoO6BIJlh2+HEbZ7/8+PlasZAhFU8AmTvM4pRaxNQ+ O/iP9jJJtP0v4efzrrGh7Z4o/iYp9p/1zRnZdnb85wWfZu6sLGm7uysRWpymHHcVkCwh +jKaGX6W6Chwsos7xUrTWQfHWgItJZ2nLmoN+l8S9usrsmUkDHAlo7mxeAiGSN1ef8so fqKw== X-Gm-Message-State: AMCzsaUv1g0sVo1VO81PEduD+siDFfirtULSve1h5V+UyX9jJN5wyo32 xFhvZkMQOoiATc5u/GKVYI/ZXQ== X-Google-Smtp-Source: AOwi7QAuJdwEqRw0YAt/BYitU3Gu5GB0pLIpQb6oDLdAKRGmt7WfQmozXTBRum5W+EZR5EcHpxUPFw== X-Received: by 10.223.143.66 with SMTP id p60mr7321447wrb.142.1507658709379; Tue, 10 Oct 2017 11:05:09 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:4f9:3ae1:43d2:31ae]) by smtp.gmail.com with ESMTPSA id l73sm12513428wmd.47.2017.10.10.11.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Oct 2017 11:05:08 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, rui.zhang@intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, kevin.wangtao@linaro.org, Laxman Dewangan Subject: [PATCH 14/25] thermal/drivers/generic-iio-adc: Switch tz request to devm version Date: Tue, 10 Oct 2017 20:02:39 +0200 Message-Id: <1507658570-32675-14-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> References: <79a5f10c-0fb7-3e4f-caac-c1625904b137@linaro.org> <1507658570-32675-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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);