diff options
author | Roland Stigge <stigge@antcom.de> | 2012-11-15 13:59:40 (GMT) |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-11-17 20:21:08 (GMT) |
commit | 8754fccbae661a0020923cffd63e21de36d51e2e (patch) | |
tree | 13ce37d4afc0173e30d01d0c6ec9e1d29a40a4c6 /drivers/gpio | |
parent | 9859eb99e9212339e2009b98c396b08260276edf (diff) | |
download | linux-8754fccbae661a0020923cffd63e21de36d51e2e.tar.xz |
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: Roland Stigge <stigge@antcom.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-max730x.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c index 05e2dac..c4bf86a 100644 --- a/drivers/gpio/gpio-max730x.c +++ b/drivers/gpio/gpio-max730x.c @@ -167,10 +167,6 @@ int __devinit __max730x_probe(struct max7301 *ts) 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 max7301 *ts) /* 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 max7301 *ts) 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; |