lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1444650634-12025-3-git-send-email-paul.cercueil@analog.com>
Date:	Mon, 12 Oct 2015 13:50:34 +0200
From:	Paul Cercueil <paul.cercueil@...log.com>
To:	Jonathan Cameron <jic23@...nel.org>
CC:	Michael Hennerich <Michael.Hennerich@...log.com>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Hartmut Knaack <knaack.h@....de>,
	Peter Meerwald <pmeerw@...erw.net>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-iio@...r.kernel.org>,
	Paul Cercueil <paul.cercueil@...log.com>
Subject: [PATCHv2 3/3] iio: ad5064: Always use external vref if there is no internal vref

If the device does not have an internal reference, there is no
other choice but to use the external reference. In that case,
it does not make much sense to have to specify it.

This patch ensures that the external reference is used if the
device does not feature an internal reference.

Signed-off-by: Paul Cercueil <paul.cercueil@...log.com>
---
 drivers/iio/dac/ad5064.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

 v2: No change in this patch

diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index e77631d..18674e5 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -464,14 +464,16 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
 	for (i = 0; i < ad5064_num_vref(st); ++i)
 		st->vref_reg[i].supply = ad5064_vref_name(st, i);
 
-	if (dev->of_node) {
-		for (i = 0; ext_vref && i < ad5064_num_vref(st); ++i)
-			ext_vref = of_property_read_bool(dev->of_node,
-					ad5064_vref_name(st, i));
-	} else {
-		struct ad5064_platform_data *pdata = dev->platform_data;
-
-		ext_vref = pdata && pdata->use_external_ref;
+	if (st->chip_info->internal_vref) {
+		if (dev->of_node) {
+			for (i = 0; ext_vref && i < ad5064_num_vref(st); ++i)
+				ext_vref = of_property_read_bool(dev->of_node,
+						ad5064_vref_name(st, i));
+		} else {
+			struct ad5064_platform_data *pdata = dev->platform_data;
+
+			ext_vref = pdata && pdata->use_external_ref;
+		}
 	}
 
 	if (ext_vref) {
@@ -483,11 +485,6 @@ static int ad5064_probe(struct device *dev, enum ad5064_type type,
 		if (ret)
 			return ret;
 	} else {
-		if (!st->chip_info->internal_vref) {
-			dev_err(dev, "No vref available\n");
-			return -ENXIO;
-		}
-
 		st->use_internal_vref = true;
 		ret = ad5064_write(st, AD5064_CMD_CONFIG, 0,
 			AD5064_CONFIG_INT_VREF_ENABLE, 0);
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ