From patchwork Fri Sep 8 07:01:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 112010 Delivered-To: patch@linaro.org Received: by 10.140.94.239 with SMTP id g102csp1115972qge; Fri, 8 Sep 2017 00:03:15 -0700 (PDT) X-Received: by 10.98.63.18 with SMTP id m18mr2146380pfa.128.1504854195707; Fri, 08 Sep 2017 00:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504854195; cv=none; d=google.com; s=arc-20160816; b=aXsbM9eckfWBjGS6i8SlBVrfaby2vjP2bJYmVuOglyemXAbnqTuf5TwLws6RvnToBW Vc3vZAxMGXKp4+McEvxgxysahj3PN0OnGxlqUycgTnMEku6Fdq4RfRG2bjl6vGUQU9mE SRs2TRoSs0F3YVj06L46guPE68b/E9lW1MfWC/MlSKEge3xO/WTQYzd7hCEKWEYnMYNY MM/KmU+EgJPmaGmvKXjIpMr8EL3U0Z2igBQ2yJDdExuAGTQhogVdsrpZV9KYpQznpXvN NGS6aMfJHqCfCCQPDYxqyN0kkb6kj7B8S/V1jNleJ7vBd357trhZaJ1a7RPVfIhbUrS3 Efcw== 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=3GUhBwkUiq7RaL2ApQTmg4eoKdY7OdlBmMylJzjZ4R8=; b=jLoE4C1NNHBZDeuv88RsQ9oINXWlmPRgGg/qx1GJpx1AifqAtXW3pMhinDXsekIr6p Kh/VGTpGpoSG+/yUJMoP1iyFvjDhYG3cOPE6Aiy59bOMP9ZGnTCevjWc47lp6WHuUVKf 25xJ5vnAyxD2e/8GL28btbaqDlvxwjwyyDMdrqQ29uUHAHGiSXhmxaVTrHR2GQ8icfnJ roD4ddyJAt57zqe6iUN5J5dwQCRToIVHKefZa56P273A2FayA7xyR/UCmgaVZe7mfaRR PBFxvkPUT9scxbQ8hnMXl6HJduTq/0u/1OldJ3tmL/utM/VlcwrX1x1EpVliRI/PWBnc QEsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TqYdDBg3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 65si1146231pld.545.2017.09.08.00.03.15; Fri, 08 Sep 2017 00:03:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=TqYdDBg3; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1754725AbdIHHDO (ORCPT + 12 others); Fri, 8 Sep 2017 03:03:14 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:43566 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754549AbdIHHDN (ORCPT ); Fri, 8 Sep 2017 03:03:13 -0400 Received: by mail-wm0-f52.google.com with SMTP id f145so3777685wme.0 for ; Fri, 08 Sep 2017 00:03:12 -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=3GUhBwkUiq7RaL2ApQTmg4eoKdY7OdlBmMylJzjZ4R8=; b=TqYdDBg3qlzx9tYMrEfDbRX5qwgX/bscMUkpqyHuG8Xnyxyew10H4pxJNFuoMdjVDC UPfZqgGzJ5SCfzt1P1B/4JLZdnW+zJkuJepS9TUL8JmlNawtWalxT4rwPDXJTodBkQkc Jt7ooe+Z6B97q7GxM6Z6NSVEuA4yDv58MHbd0= 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=3GUhBwkUiq7RaL2ApQTmg4eoKdY7OdlBmMylJzjZ4R8=; b=hVRphExtlAh+ElFW1hLXjbDLmApnA7gXndj8+cyC/oCcYvXFJT4/1OxzBN5YiZEJGQ CSpohuUaXFcV9KCZcYTyydBosJZbXd8tXk6A2JAyYjIriq1oKdEjgG9w91/6jVl7V37K zo+aPgVVXXWedWPTJlrnFcNJ+VW5lSpHgq1T12xM+zGcp1JrllETvmuWaIkVxeVi4KBQ o8Purm3dbo5ITUVDv52KUAel2mDHAJGV7NiEsxHPOi3hjZheAynGVYI7XnYvUIcgpt3/ 0pvy7txDKjaFhz1Ok5/WovrPIE3dxHKChSMe3C360pVU4aIQF+x4cE6zjfxES6gfPp8J 1QlA== X-Gm-Message-State: AHPjjUhmYPXlhRgKVmVxAaKkFjflENJOqRvpWiQiY1W72HKRMBRzZkE9 HfPQq+c+Os0K4ix0/TtZ+1+d7Q== X-Google-Smtp-Source: AOwi7QBM8AOFlpCul4XVOJU4nc5V45dayFr1wG0gv73SUM1H67+bG/Lf3jc+3rr1jL9mT1lWuPZ8ew== X-Received: by 10.28.185.202 with SMTP id j193mr857681wmf.130.1504854192180; Fri, 08 Sep 2017 00:03:12 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:6426:ff85:17d6:f2f2]) by smtp.gmail.com with ESMTPSA id u19sm503734wmd.37.2017.09.08.00.03.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Sep 2017 00:03:11 -0700 (PDT) From: Daniel Lezcano To: edubezval@gmail.com, ldewangan@nvidia.com Cc: linux-pm@vger.kernel.org, daniel.lezcano@linaro.org, Zhang Rui , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2] thermal/drivers/generic-iio-adc: Switch tz request to devm version Date: Fri, 8 Sep 2017 09:01:56 +0200 Message-Id: <1504854117-18392-1-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <20170908025606.GA2755@localhost.localdomain> References: <20170908025606.GA2755@localhost.localdomain> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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] 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);