public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
@ 2013-02-22  9:26 Christophe Leroy
  2013-03-01  0:43 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2013-02-22  9:26 UTC (permalink / raw)
  To: Grant Likely, Linus Walleij; +Cc: linux-kernel, Patrick Vasseur

This patch allows the use of the MAX730x Driver on systems using
the Open Firmware platform format

Signed-off-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

diff -ur linux-3.7.9/drivers/gpio/gpio-max7301.c linux/drivers/gpio/gpio-max7301.c
--- linux-3.7.9/drivers/gpio/gpio-max7301.c	2013-02-17 19:53:32.000000000 +0100
+++ linux/drivers/gpio/gpio-max7301.c	2013-02-17 12:57:40.000000000 +0100
@@ -56,7 +56,8 @@
 	int ret;
 
 	/* bits_per_word cannot be configured in platform data */
-	spi->bits_per_word = 16;
+	if (spi->dev.platform_data)
+		spi->bits_per_word = 16;
 	ret = spi_setup(spi);
 	if (ret < 0)
 		return ret;
diff -ur linux-3.7.9/drivers/gpio/gpio-max730x.c linux/drivers/gpio/gpio-max730x.c
--- linux-3.7.9/drivers/gpio/gpio-max730x.c	2013-02-17 19:53:32.000000000 +0100
+++ linux/drivers/gpio/gpio-max730x.c	2013-02-22 10:15:46.000000000 +0100
@@ -163,12 +163,13 @@
 int __devinit __max730x_probe(struct max7301 *ts)
 {
 	struct device *dev = ts->dev;
+	struct device_node *np = dev->of_node;
 	struct max7301_platform_data *pdata;
 	int i, ret;
 
 	pdata = dev->platform_data;
-	if (!pdata || !pdata->base) {
-		dev_err(dev, "incorrect or missing platform data\n");
+	if ((!pdata || !pdata->base) && !np) {
+		dev_err(dev, "No platform data nor Device Tree found\n");
 		return -EINVAL;
 	}
 
@@ -178,7 +179,6 @@
 	/* Power up the chip and disable IRQ output */
 	ts->write(dev, 0x04, 0x01);
 
-	ts->input_pullup_active = pdata->input_pullup_active;
 	ts->chip.label = dev->driver->name;
 
 	ts->chip.direction_input = max7301_direction_input;
@@ -186,7 +186,12 @@
 	ts->chip.direction_output = max7301_direction_output;
 	ts->chip.set = max7301_set;
 
-	ts->chip.base = pdata->base;
+	if (pdata) {
+		ts->input_pullup_active = pdata->input_pullup_active;
+		ts->chip.base = pdata->base;
+	} else {
+		ts->chip.base = -1;
+	}
 	ts->chip.ngpio = PIN_NUMBER;
 	ts->chip.can_sleep = 1;
 	ts->chip.dev = dev;

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

* Re: [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
  2013-02-22  9:26 [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver Christophe Leroy
@ 2013-03-01  0:43 ` Linus Walleij
  2013-03-01  6:29   ` leroy christophe
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2013-03-01  0:43 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: Grant Likely, linux-kernel, Patrick Vasseur

On Fri, Feb 22, 2013 at 10:26 AM, Christophe Leroy
<christophe.leroy@c-s.fr> wrote:

> This patch allows the use of the MAX730x Driver on systems using
> the Open Firmware platform format
>
> Signed-off-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>

(...)
>         /* bits_per_word cannot be configured in platform data */
> -       spi->bits_per_word = 16;
> +       if (spi->dev.platform_data)
> +               spi->bits_per_word = 16;

What about just fixing so you *can* specify that instead?
The comment looks more like a FIXME to me.

Yours,
Linus Walleij

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

* Re: [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
  2013-03-01  0:43 ` Linus Walleij
@ 2013-03-01  6:29   ` leroy christophe
  2013-03-01  9:23     ` Linus Walleij
  2013-03-02 21:16     ` Grant Likely
  0 siblings, 2 replies; 6+ messages in thread
From: leroy christophe @ 2013-03-01  6:29 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Grant Likely, linux-kernel, Patrick Vasseur


Le 01/03/2013 01:43, Linus Walleij a écrit :
> On Fri, Feb 22, 2013 at 10:26 AM, Christophe Leroy
> <christophe.leroy@c-s.fr> wrote:
>
>> This patch allows the use of the MAX730x Driver on systems using
>> the Open Firmware platform format
>>
>> Signed-off-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> (...)
>>          /* bits_per_word cannot be configured in platform data */
>> -       spi->bits_per_word = 16;
>> +       if (spi->dev.platform_data)
>> +               spi->bits_per_word = 16;
> What about just fixing so you *can* specify that instead?
> The comment looks more like a FIXME to me.
Euh, ok, why not. But here the purpose of my patch is to allow using 
this driver with of_platform in addition to platform.
This FIXME is not mine, it was already existing in that driver.
As of_platform can configure bits per word, the only thing I did is to 
add a test in order to not apply this FIXME on the of_platform case.

Do you think my patch is not acceptable like this ?

Regards
Christophe


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

* Re: [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
  2013-03-01  6:29   ` leroy christophe
@ 2013-03-01  9:23     ` Linus Walleij
  2013-03-02 21:16     ` Grant Likely
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2013-03-01  9:23 UTC (permalink / raw)
  To: leroy christophe; +Cc: Grant Likely, linux-kernel, Patrick Vasseur

On Fri, Mar 1, 2013 at 7:29 AM, leroy christophe
<christophe.leroy@c-s.fr> wrote:
> Le 01/03/2013 01:43, Linus Walleij a écrit :
>
>> On Fri, Feb 22, 2013 at 10:26 AM, Christophe Leroy
>> <christophe.leroy@c-s.fr> wrote:
>>
>>> This patch allows the use of the MAX730x Driver on systems using
>>> the Open Firmware platform format
>>>
>>> Signed-off-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>>
>> (...)
>>>
>>>          /* bits_per_word cannot be configured in platform data */
>>> -       spi->bits_per_word = 16;
>>> +       if (spi->dev.platform_data)
>>> +               spi->bits_per_word = 16;
>>
>> What about just fixing so you *can* specify that instead?
>> The comment looks more like a FIXME to me.
>
> Euh, ok, why not. But here the purpose of my patch is to allow using this
> driver with of_platform in addition to platform.
> This FIXME is not mine, it was already existing in that driver.
> As of_platform can configure bits per word, the only thing I did is to add a
> test in order to not apply this FIXME on the of_platform case.
>
> Do you think my patch is not acceptable like this ?

No big deal.

I was just taking this opportunity to try to push out some driver
maintenance, that's what subsystem maintainers do you know...

Yours,
Linus Walleij

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

* Re: [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
  2013-03-01  6:29   ` leroy christophe
  2013-03-01  9:23     ` Linus Walleij
@ 2013-03-02 21:16     ` Grant Likely
  2013-03-05 15:00       ` leroy christophe
  1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2013-03-02 21:16 UTC (permalink / raw)
  To: leroy christophe, Linus Walleij; +Cc: linux-kernel, Patrick Vasseur

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1393 bytes --]

On Fri, 01 Mar 2013 07:29:17 +0100, leroy christophe <christophe.leroy@c-s.fr> wrote:
> 
> Le 01/03/2013 01:43, Linus Walleij a écrit :
> > On Fri, Feb 22, 2013 at 10:26 AM, Christophe Leroy
> > <christophe.leroy@c-s.fr> wrote:
> >
> >> This patch allows the use of the MAX730x Driver on systems using
> >> the Open Firmware platform format
> >>
> >> Signed-off-by: Patrick Vasseur <patrick.vasseur@c-s.fr>
> >> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> > (...)
> >>          /* bits_per_word cannot be configured in platform data */
> >> -       spi->bits_per_word = 16;
> >> +       if (spi->dev.platform_data)
> >> +               spi->bits_per_word = 16;
> > What about just fixing so you *can* specify that instead?
> > The comment looks more like a FIXME to me.
> Euh, ok, why not. But here the purpose of my patch is to allow using 
> this driver with of_platform in addition to platform.
> This FIXME is not mine, it was already existing in that driver.
> As of_platform can configure bits per word, the only thing I did is to 
> add a test in order to not apply this FIXME on the of_platform case.
> 
> Do you think my patch is not acceptable like this ?

I would like to know /why/ this specific hunk is necessary. I cannot
tell from the context. That's the sort of thing that is very helpful to
have in the commit description. Otherwise the patch looks fine.

g.

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

* Re: [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver
  2013-03-02 21:16     ` Grant Likely
@ 2013-03-05 15:00       ` leroy christophe
  0 siblings, 0 replies; 6+ messages in thread
From: leroy christophe @ 2013-03-05 15:00 UTC (permalink / raw)
  To: Grant Likely; +Cc: Linus Walleij, linux-kernel, Patrick Vasseur


Le 02/03/2013 22:16, Grant Likely a écrit :
> I would like to know /why/ this specific hunk is necessary. I cannot
> tell from the context. That's the sort of thing that is very helpful to
> have in the commit description. Otherwise the patch looks fine.
>
> g.
>

Ok, I will resubmit with a note to it in the commit description.

Christophe

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

end of thread, other threads:[~2013-03-05 15:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22  9:26 [PATCH] Adds support for Open Firmware in MAX730x GPIO Driver Christophe Leroy
2013-03-01  0:43 ` Linus Walleij
2013-03-01  6:29   ` leroy christophe
2013-03-01  9:23     ` Linus Walleij
2013-03-02 21:16     ` Grant Likely
2013-03-05 15:00       ` leroy christophe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox