Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739859

[PATCH 2/2] iio: adc: sun4i-gpadc-iio: do not fail probing when no thermal DT node

Path csiph.com!goblin2!goblin.stu.neva.ru!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Quentin Schulz <quentin.schulz@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] iio: adc: sun4i-gpadc-iio: do not fail probing when no thermal DT node
Date Tue, 26 Sep 2017 15:00:02 +0200
Message-ID <utXCW-4V5-9@gated-at.bofh.it> (permalink)
References <utXCW-4V5-11@gated-at.bofh.it>
X-Original-To jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, maxime.ripard@free-electrons.com, wens@csie.org
X-Mailer git-send-email 2.11.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 32
Organization linux.* mail to news gateway
X-Original-Cc linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, thomas.petazzoni@free-electrons.com, icenowy@aosc.io, Quentin Schulz <quentin.schulz@free-electrons.com>
X-Original-Date Tue, 26 Sep 2017 14:52:19 +0200
X-Original-Message-ID <160cf183a167ef841c96c5626f42e23b7195effa.1506430136.git-series.quentin.schulz@free-electrons.com>
X-Original-References <f7b1b9c493c563a2f5b5f5f44596d45d3d719d26.1506430136.git-series.quentin.schulz@free-electrons.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1739859

Show key headers only | View raw


Before this patch, forgetting to put a thermal-zones DT node would
result in the driver failing to probe.

It should be perfectly acceptable to have the driver probe even if no
thermal-zones DT is found. However, it shouldn't want to fail if the
thermal registering fail for any other reason (waiting for other drivers
for example) so check on ENODEV only.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 392d47f..46fe0b5 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -652,7 +652,11 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 		info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
 							    0, info,
 							    &sun4i_ts_tz_ops);
-		if (IS_ERR(info->tzd)) {
+		/*
+		 * Do not fail driver probing when failing to register in
+		 * thermal because no thermal DT node is found.
+		 */
+		if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) {
 			dev_err(&pdev->dev,
 				"could not register thermal sensor: %ld\n",
 				PTR_ERR(info->tzd));
-- 
git-series 0.9.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] iio: adc: sun4i-gpadc-iio: do not fail probing when no thermal DT node Quentin Schulz <quentin.schulz@free-electrons.com> - 2017-09-26 15:00 +0200
  Re: [PATCH 2/2] iio: adc: sun4i-gpadc-iio: do not fail probing when  no thermal DT node Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-09-26 15:30 +0200

csiph-web