All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch v2] MPC Adapter: read class attribute from device tree
@ 2009-04-22  7:19 Michael Lawnick
       [not found] ` <49EEC50A.4050707-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Lawnick @ 2009-04-22  7:19 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: Delvare, Jean , Wolfram Sang, Wolfgang Grandegger

For MPC adapter there is no class assigned as it is done in other
adapters. This way no new-style client will ever be instantiated, if not
noted in device tree or forced. With this patch class assignment is read
from device tree.
If class assignment is not set in device tree .class stays default (0)

Necessary device tree entry:
linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */

Based on kernel 2.6.29

Signed-off-by: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Sang, Wolfram <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
---
 drivers/i2c/busses/i2c-mpc.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -318,7 +318,8 @@ static int __devinit fsl_i2c_probe(struct of_device
*op, const struct of_device_
 {
 	int result = 0;
 	struct mpc_i2c *i2c;
-
+	int *of_val;
+	
 	i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
 	if (!i2c)
 		return -ENOMEM;
@@ -354,6 +355,10 @@ static int __devinit fsl_i2c_probe(struct of_device
*op, const struct of_device_
 	dev_set_drvdata(&op->dev, i2c);

 	i2c->adap = mpc_ops;
+	of_val = of_get_property(op->node, "linux,i2c-class", NULL);
+	if(of_val)
+		i2c->adap.class = *of_val;
+
 	i2c_set_adapdata(&i2c->adap, i2c);
 	i2c->adap.dev.parent = &op->dev;



-- 
Michael Lawnick

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found] ` <49EEC50A.4050707-Mmb7MZpHnFY@public.gmane.org>
@ 2009-04-22  7:34   ` Jean Delvare
  2009-04-22  7:45   ` Wolfgang Grandegger
  2009-04-22 14:23   ` Jon Smirl
  2 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2009-04-22  7:34 UTC (permalink / raw)
  To: Michael Lawnick
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang, Wolfgang Grandegger

Dear Michael,

On Wed, 22 Apr 2009 09:19:38 +0200, Michael Lawnick wrote:
> For MPC adapter there is no class assigned as it is done in other
> adapters. This way no new-style client will ever be instantiated, if not
> noted in device tree or forced. With this patch class assignment is read
> from device tree.
> If class assignment is not set in device tree .class stays default (0)
> 
> Necessary device tree entry:
> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */
> 
> Based on kernel 2.6.29
> 
> Signed-off-by: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Sang, Wolfram <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-mpc.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -318,7 +318,8 @@ static int __devinit fsl_i2c_probe(struct of_device
> *op, const struct of_device_
>  {
>  	int result = 0;
>  	struct mpc_i2c *i2c;
> -
> +	int *of_val;
> +	

Adding leading whitespace...

>  	i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
>  	if (!i2c)
>  		return -ENOMEM;
> @@ -354,6 +355,10 @@ static int __devinit fsl_i2c_probe(struct of_device
> *op, const struct of_device_
>  	dev_set_drvdata(&op->dev, i2c);
> 
>  	i2c->adap = mpc_ops;
> +	of_val = of_get_property(op->node, "linux,i2c-class", NULL);
> +	if(of_val)

And infringing coding style (which I already told you no later than
yesterday.) It's a 10 lines patch and you can't get it right? Come on,
please, use scripts/checkpatch.pl to validate your patches before you
send them, otherwise every kernel maintainer will just ignore you.

> +		i2c->adap.class = *of_val;
> +
>  	i2c_set_adapdata(&i2c->adap, i2c);
>  	i2c->adap.dev.parent = &op->dev;
> 
> 
> 


-- 
Jean Delvare

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found] ` <49EEC50A.4050707-Mmb7MZpHnFY@public.gmane.org>
  2009-04-22  7:34   ` Jean Delvare
@ 2009-04-22  7:45   ` Wolfgang Grandegger
  2009-04-22 14:23   ` Jon Smirl
  2 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Grandegger @ 2009-04-22  7:45 UTC (permalink / raw)
  To: Michael Lawnick
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Delvare, Jean , Wolfram Sang

Michael Lawnick wrote:
> For MPC adapter there is no class assigned as it is done in other
> adapters. This way no new-style client will ever be instantiated, if not
> noted in device tree or forced. With this patch class assignment is read
> from device tree.
> If class assignment is not set in device tree .class stays default (0)
> 
> Necessary device tree entry:
> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */
> 
> Based on kernel 2.6.29
> 
> Signed-off-by: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Sang, Wolfram <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Please document the new device tree binding in
"Documentation/powerpc/dts-bindings/fsl/i2c.txt", send a CC to
"devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org", use an up-to-date version of the
linux-2.6 tree (there are some patches for i2c-mpc.c pending) and fix
the coding style issues.

Wolfgang.

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found] ` <49EEC50A.4050707-Mmb7MZpHnFY@public.gmane.org>
  2009-04-22  7:34   ` Jean Delvare
  2009-04-22  7:45   ` Wolfgang Grandegger
@ 2009-04-22 14:23   ` Jon Smirl
       [not found]     ` <9e4733910904220723u68392662vb854188c1dec02fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2 siblings, 1 reply; 7+ messages in thread
From: Jon Smirl @ 2009-04-22 14:23 UTC (permalink / raw)
  To: Michael Lawnick
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Delvare, Jean, Wolfram Sang,
	Wolfgang Grandegger

On Wed, Apr 22, 2009 at 3:19 AM, Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org> wrote:
> For MPC adapter there is no class assigned as it is done in other
> adapters. This way no new-style client will ever be instantiated, if not
> noted in device tree or forced. With this patch class assignment is read
> from device tree.
> If class assignment is not set in device tree .class stays default (0)
>
> Necessary device tree entry:
> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */

When this patch makes it over to the device tree police they are going
to reject it. They will never allow OS specific entries into the cross
platform device tree standard.

>
> Based on kernel 2.6.29
>
> Signed-off-by: Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Sang, Wolfram <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
> ---
>  drivers/i2c/busses/i2c-mpc.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -318,7 +318,8 @@ static int __devinit fsl_i2c_probe(struct of_device
> *op, const struct of_device_
>  {
>        int result = 0;
>        struct mpc_i2c *i2c;
> -
> +       int *of_val;
> +
>        i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
>        if (!i2c)
>                return -ENOMEM;
> @@ -354,6 +355,10 @@ static int __devinit fsl_i2c_probe(struct of_device
> *op, const struct of_device_
>        dev_set_drvdata(&op->dev, i2c);
>
>        i2c->adap = mpc_ops;
> +       of_val = of_get_property(op->node, "linux,i2c-class", NULL);
> +       if(of_val)
> +               i2c->adap.class = *of_val;
> +
>        i2c_set_adapdata(&i2c->adap, i2c);
>        i2c->adap.dev.parent = &op->dev;
>
>
>
> --
> Michael Lawnick
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found]     ` <9e4733910904220723u68392662vb854188c1dec02fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-04-22 18:32       ` Wolfgang Grandegger
       [not found]         ` <49EF62AF.5070004-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
  2009-04-23  6:48       ` Michael Lawnick
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Grandegger @ 2009-04-22 18:32 UTC (permalink / raw)
  To: Jon Smirl
  Cc: Michael Lawnick, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Delvare, Jean,
	Wolfram Sang

Jon Smirl wrote:
> On Wed, Apr 22, 2009 at 3:19 AM, Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org> wrote:
>> For MPC adapter there is no class assigned as it is done in other
>> adapters. This way no new-style client will ever be instantiated, if not
>> noted in device tree or forced. With this patch class assignment is read
>> from device tree.
>> If class assignment is not set in device tree .class stays default (0)
>>
>> Necessary device tree entry:
>> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */
> 
> When this patch makes it over to the device tree police they are going
> to reject it. They will never allow OS specific entries into the cross
> platform device tree standard.

But sometimes the device tree police turns a blind eye :-).

Wolfgang.

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found]         ` <49EF62AF.5070004-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
@ 2009-04-22 19:52           ` Jon Smirl
  0 siblings, 0 replies; 7+ messages in thread
From: Jon Smirl @ 2009-04-22 19:52 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Michael Lawnick, linux-i2c-u79uwXL29TY76Z2rM5mHXA, Delvare, Jean,
	Wolfram Sang

On Wed, Apr 22, 2009 at 2:32 PM, Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> wrote:
> Jon Smirl wrote:
>> On Wed, Apr 22, 2009 at 3:19 AM, Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org> wrote:
>>> For MPC adapter there is no class assigned as it is done in other
>>> adapters. This way no new-style client will ever be instantiated, if not
>>> noted in device tree or forced. With this patch class assignment is read
>>> from device tree.
>>> If class assignment is not set in device tree .class stays default (0)
>>>
>>> Necessary device tree entry:
>>> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */
>>
>> When this patch makes it over to the device tree police they are going
>> to reject it. They will never allow OS specific entries into the cross
>> platform device tree standard.
>
> But sometimes the device tree police turns a blind eye :-).

I doubt it, in the last six months they removed all of the platform
specific stuff from the dts files in the kernel.
There should be some way to accomplish this without needing the i2c-class entry.

-- 
Jon Smirl
jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

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

* Re: [Patch v2] MPC Adapter: read class attribute from device tree
       [not found]     ` <9e4733910904220723u68392662vb854188c1dec02fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2009-04-22 18:32       ` Wolfgang Grandegger
@ 2009-04-23  6:48       ` Michael Lawnick
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Lawnick @ 2009-04-23  6:48 UTC (permalink / raw)
  To: Jon Smirl
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Delvare, Jean, Wolfram Sang,
	Wolfgang Grandegger

Jon Smirl said the following:
> On Wed, Apr 22, 2009 at 3:19 AM, Michael Lawnick <ml.lawnick-Mmb7MZpHnFY@public.gmane.org> wrote:
>> For MPC adapter there is no class assigned as it is done in other
>> adapters. This way no new-style client will ever be instantiated, if not
>> noted in device tree or forced. With this patch class assignment is read
>> from device tree.
>> If class assignment is not set in device tree .class stays default (0)
>>
>> Necessary device tree entry:
>> linux,i2c-class = <1>; /* I2C_CLASS_HWMON (iic.h) */
> 
> When this patch makes it over to the device tree police they are going
> to reject it. They will never allow OS specific entries into the cross
> platform device tree standard.

I feared that, so I will drop it.

Mi-stumped-chael

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

end of thread, other threads:[~2009-04-23  6:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22  7:19 [Patch v2] MPC Adapter: read class attribute from device tree Michael Lawnick
     [not found] ` <49EEC50A.4050707-Mmb7MZpHnFY@public.gmane.org>
2009-04-22  7:34   ` Jean Delvare
2009-04-22  7:45   ` Wolfgang Grandegger
2009-04-22 14:23   ` Jon Smirl
     [not found]     ` <9e4733910904220723u68392662vb854188c1dec02fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-04-22 18:32       ` Wolfgang Grandegger
     [not found]         ` <49EF62AF.5070004-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2009-04-22 19:52           ` Jon Smirl
2009-04-23  6:48       ` Michael Lawnick

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.