All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]staging:iio:ad799x make use of platform_data optional
@ 2013-12-29 11:49 Hartmut Knaack
  2014-01-01 12:55 ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Hartmut Knaack @ 2013-12-29 11:49 UTC (permalink / raw)
  To: linux-iio

Setting Vref with platform_data is a neat feature, though it is not essential
for operating these devices. So make the use of platform_data optional and set
default value of 1000 mV if nothing else is defined.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
---
diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
index 9428be8..e32a555 100644
--- a/drivers/staging/iio/adc/ad799x_core.c
+++ b/drivers/staging/iio/adc/ad799x_core.c
@@ -545,10 +545,12 @@ static int ad799x_probe(struct i2c_client *client,
 
 	/* TODO: Add pdata options for filtering and bit delay */
 
-	if (!pdata)
-		return -EINVAL;
-
-	st->int_vref_mv = pdata->vref_mv;
+	if ((!pdata) || (!pdata->vref_mv)) {
+		dev_warn(&client->dev,
+			 "No platform data found, setting Vref to 1000 mV\n");
+		st->int_vref_mv = 1000;
+	} else
+		st->int_vref_mv = pdata->vref_mv;
 
 	st->reg = devm_regulator_get(&client->dev, "vcc");
 	if (!IS_ERR(st->reg)) {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-01-01 23:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29 11:49 [PATCH]staging:iio:ad799x make use of platform_data optional Hartmut Knaack
2014-01-01 12:55 ` Jonathan Cameron
2014-01-01 13:17   ` Hartmut Knaack
2014-01-01 14:14     ` Jonathan Cameron
2014-01-01 15:37       ` Lars-Peter Clausen
2014-01-01 23:19         ` Hartmut Knaack

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.