linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: gpio-max710x: Support device tree probing
@ 2012-11-15 13:59 Roland Stigge
  2012-11-15 14:10 ` Wolfram Sang
  2012-11-17 20:21 ` Linus Walleij
  0 siblings, 2 replies; 4+ messages in thread
From: Roland Stigge @ 2012-11-15 13:59 UTC (permalink / raw)
  To: grant.likely, linus.walleij, linux-kernel, w.sang, jbe; +Cc: 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.

Signed-off-by: Roland Stigge <stigge@antcom.de>
---
 drivers/gpio/gpio-max730x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- linux-2.6.orig/drivers/gpio/gpio-max730x.c
+++ linux-2.6/drivers/gpio/gpio-max730x.c
@@ -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;

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

* Re: [PATCH] gpio: gpio-max710x: Support device tree probing
  2012-11-15 13:59 [PATCH] gpio: gpio-max710x: Support device tree probing Roland Stigge
@ 2012-11-15 14:10 ` Wolfram Sang
  2012-11-15 14:36   ` Roland Stigge
  2012-11-17 20:21 ` Linus Walleij
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2012-11-15 14:10 UTC (permalink / raw)
  To: Roland Stigge; +Cc: grant.likely, linus.walleij, linux-kernel, jbe

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

On Thu, Nov 15, 2012 at 02:59:40PM +0100, Roland Stigge wrote:
> 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>

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

Acked-by: Wolfram Sang <w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: [PATCH] gpio: gpio-max710x: Support device tree probing
  2012-11-15 14:10 ` Wolfram Sang
@ 2012-11-15 14:36   ` Roland Stigge
  0 siblings, 0 replies; 4+ messages in thread
From: Roland Stigge @ 2012-11-15 14:36 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: grant.likely, linus.walleij, linux-kernel, jbe

On 15/11/12 15:10, Wolfram Sang wrote:
> On Thu, Nov 15, 2012 at 02:59:40PM +0100, Roland Stigge wrote:
>> 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>
> 
> Aren't there bindings for pullup configuration, top? Besides that:
> 
> Acked-by: Wolfram Sang <w.sang@pengutronix.de>

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

Thanks,

Roland

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

* Re: [PATCH] gpio: gpio-max710x: Support device tree probing
  2012-11-15 13:59 [PATCH] gpio: gpio-max710x: Support device tree probing Roland Stigge
  2012-11-15 14:10 ` Wolfram Sang
@ 2012-11-17 20:21 ` Linus Walleij
  1 sibling, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-11-17 20:21 UTC (permalink / raw)
  To: Roland Stigge; +Cc: grant.likely, linux-kernel, w.sang, jbe

On Thu, Nov 15, 2012 at 2:59 PM, Roland Stigge <stigge@antcom.de> wrote:

> 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>

Patch applied with Wolfram's ACK.
Thanks!

Yours,
Linus Walleij

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

end of thread, other threads:[~2012-11-17 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-15 13:59 [PATCH] gpio: gpio-max710x: Support device tree probing Roland Stigge
2012-11-15 14:10 ` Wolfram Sang
2012-11-15 14:36   ` Roland Stigge
2012-11-17 20:21 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).