Commit 8754fccb authored by Roland Stigge's avatar Roland Stigge Committed by Linus Walleij

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.
Signed-off-by: default avatarRoland Stigge <stigge@antcom.de>
Acked-by: default avatarWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 9859eb99
...@@ -167,10 +167,6 @@ int __devinit __max730x_probe(struct max7301 *ts) ...@@ -167,10 +167,6 @@ int __devinit __max730x_probe(struct max7301 *ts)
int i, ret; int i, ret;
pdata = dev->platform_data; pdata = dev->platform_data;
if (!pdata || !pdata->base) {
dev_err(dev, "incorrect or missing platform data\n");
return -EINVAL;
}
mutex_init(&ts->lock); mutex_init(&ts->lock);
dev_set_drvdata(dev, ts); dev_set_drvdata(dev, ts);
...@@ -178,7 +174,12 @@ int __devinit __max730x_probe(struct max7301 *ts) ...@@ -178,7 +174,12 @@ int __devinit __max730x_probe(struct max7301 *ts)
/* Power up the chip and disable IRQ output */ /* Power up the chip and disable IRQ output */
ts->write(dev, 0x04, 0x01); ts->write(dev, 0x04, 0x01);
if (pdata) {
ts->input_pullup_active = pdata->input_pullup_active; 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.label = dev->driver->name;
ts->chip.direction_input = max7301_direction_input; ts->chip.direction_input = max7301_direction_input;
...@@ -186,7 +187,6 @@ int __devinit __max730x_probe(struct max7301 *ts) ...@@ -186,7 +187,6 @@ int __devinit __max730x_probe(struct max7301 *ts)
ts->chip.direction_output = max7301_direction_output; ts->chip.direction_output = max7301_direction_output;
ts->chip.set = max7301_set; ts->chip.set = max7301_set;
ts->chip.base = pdata->base;
ts->chip.ngpio = PIN_NUMBER; ts->chip.ngpio = PIN_NUMBER;
ts->chip.can_sleep = 1; ts->chip.can_sleep = 1;
ts->chip.dev = dev; ts->chip.dev = dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment