Skip to contentSkip to conversation

gpio: gpio-max710x: Support device tree probing

PATCH In review Roland Stigge 3 participants 4 messages Nov 15, 2012 – Nov 17, 2012 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: gpio-max710x: Support device tree probing

For probing via device tree, we need to support the case without platform_data. In this case, chip.base is set to -1 for automatic numbering.

---
 drivers/gpio/gpio-max730x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpio/gpio-max730x.c +6 -6
@@ -167,10 +167,6 @@ int __devinit __max730x_probe(struct max
 	int i, ret;
 
 	pdata = dev->platform_data;
-	if (!pdata || !pdata->base) {
-		dev_err(dev, "incorrect or missing platform data\n");
-		return -EINVAL;
-	}
 
 	mutex_init(&ts->lock);
 	dev_set_drvdata(dev, ts);
@@ -178,7 +174,12 @@ int __devinit __max730x_probe(struct max
 	/* Power up the chip and disable IRQ output */
 	ts->write(dev, 0x04, 0x01);
 
-	ts->input_pullup_active = pdata->input_pullup_active;
+	if (pdata) {
+		ts->input_pullup_active = pdata->input_pullup_active;
+		ts->chip.base = pdata->base;
+	} else {
+		ts->chip.base = -1;
+	}
 	ts->chip.label = dev->driver->name;
 
 	ts->chip.direction_input = max7301_direction_input;
@@ -186,7 +187,6 @@ int __devinit __max730x_probe(struct max
 	ts->chip.direction_output = max7301_direction_output;
 	ts->chip.set = max7301_set;
 
-	ts->chip.base = pdata->base;
 	ts->chip.ngpio = PIN_NUMBER;
 	ts->chip.can_sleep = 1;
 	ts->chip.dev = dev;
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Roland Stigge

For probing via device tree, we need to support the case without platform_data. In this case, chip.base is set to -1 for automatic numbering.

Aren't there bindings for pullup configuration, top? Besides that:

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw
Quoted 10 lines · Wolfram Sang
Quoted 5 lines · Roland Stigge

For probing via device tree, we need to support the case without platform_data. In this case, chip.base is set to -1 for automatic numbering.

Aren't there bindings for pullup configuration, top? Besides that:

Right. This is not supported yet by this binding. Should be added in a subsequent patch.

Thanks,

Roland