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: 116423 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp722768qgn; Thu, 19 Oct 2017 10:09:44 -0700 (PDT) X-Received: by 10.84.247.129 with SMTP id o1mr1949497pll.6.1508432984357; Thu, 19 Oct 2017 10:09:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508432984; cv=none; d=google.com; s=arc-20160816; b=e7wb0OoVi7fbVwIyTkjgjriwdqyDtn5qLdrvZCIr9bd+zsqinVZiLLRvvCPq8m0hNI 1JzNgHNeSH4r1RuLqHeAUuEJfJ4uXjSYOT89XAJClZJotgeTwXU9XOvqKcI0fXlVlSHQ LxapO0QalcLSzY5ngS1oS+rH34oVmDvofGqJphWTGIXRfbQBMAhZ6C1KCRh9Af2JU5a/ xjrQsJggzlrNiIdt1DrDhGUyy7IADNSReL+EYkGuTuUen/zFrCFCpgJLLq/cx2hN48X3 JyjnAg8YoggDZiQnUwpUEHysjTCAfR/JbzKxQGX2jm08CtG8yQhZsUhQF8w5kSyDIbej NQoA== 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=b8ZrrepI5XanDYbGD85r0RiaOhnx2Nu0+RDwtOiqDJJ13eJkpOZycouNRib2AMVAco 6sfhB4JCOvajhToZT+PfBSzUrtCIUUcdfwWf1Hie/ulP57FhQEZr4ljCUwOV2zyqP0ie EOzqjQtNIrzyuAaEr4ckXDd7Pm7mnDxtzmYUh5bj6JuEv5wmFY/2yq0G904BMxI48kfR RT1n4KMTXqsl2EhmK1q2JtwW34XiH9bolX8Ei8937G0ZoMb1u3Na6dx31KPDy0zlk0P/ v6BUWjuI+1RXzvcFxb1bKx20xtAQnLA5GJbnFNG9PjKaz89WXYA4Rc9btCdNCnlEYJNo 9oPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DINGSdIx; 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 z100si10012351plh.362.2017.10.19.10.09.44; Thu, 19 Oct 2017 10:09:44 -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=DINGSdIx; 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 S1755182AbdJSRJ2 (ORCPT + 27 others); Thu, 19 Oct 2017 13:09:28 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:47576 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755134AbdJSRIz (ORCPT ); Thu, 19 Oct 2017 13:08:55 -0400 Received: by mail-wr0-f196.google.com with SMTP id y39so9050015wrd.4 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=n2lGN30TSSoHHaeFZ8IE8hc0wmIiJtdafYg1ZKcb2o1G0kA/E2OVeZ81IuyAgDATpc v/nSvRJAJRJs7PM+1GGtiHfEPd9GpFMcu43SMSpbut90HnwOodn9dnNClZippwKRtiKK FW6bYHUntnDjT7ZpBIhvPEQgiT2TJpe1BbTOLB+V9GwG2fh/EylOO9BaKf+itiWQ+XuV R3XHWYv85d4wcxySyaP1ClI61xLMzW7cN3kSOR7ZTVRPfLGkq3SB4j5WfX19hIVfClDS +RzTQa9G4CKFalsPVCi2gghuL61jOckN5KL7nYgmYeYwa9irFJ/HJx44+3rtuPYwUh6N HG4Q== X-Gm-Message-State: AMCzsaXLnxuoZsRDvorWBHzECDaoiAZ93z1lDxmibICGKnKJuI8ch7PJ c759EBE39R25AkQMIo8A49ME4g== 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-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);