MPC Adapter: read class attribute from device tree
Subsystems (2)
PATCH v2 1/1 MPC Adapter: read class attribute from device tree
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
--- drivers/i2c/busses/i2c-mpc.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-mpc.c +0 -0
@@ -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;
Signature · 1 line
Michael Lawnick
A message that is not in the archive (sent off-list or not yet received): [email protected]
Dear Michael,
Quoted 23 lines · Michael Lawnick
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 <[email protected]>Cc Jean Delvare <[email protected]>Cc Sang, Wolfram <[email protected]>Cc Wolfgang Grandegger <[email protected]>--- drivers/i2c/busses/i2c-mpc.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
drivers/i2c/busses/i2c-mpc.c static int __devinit fsl_i2c_probe(struct of_device · line 323
Quoted 7 lines
drivers/i2c/busses/i2c-mpc.c +2
-1@@ -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...
drivers/i2c/busses/i2c-mpc.c static int __devinit fsl_i2c_probe(struct of_device · line 360
Quoted 10 lines
drivers/i2c/busses/i2c-mpc.c +0
-0i2c =kzalloc (sizeof (*i2c),GFP_KERNEL );if (!i2c)drivers/i2c/busses/i2c-mpc.c +2
-0return -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.
Quoted 7 lines
drivers/i2c/busses/i2c-mpc.c +2
-0+ i2c->adap.class = *of_val; +i2c_set_adapdata (&i2c->adap, i2c); i2c->adap.dev.parent = &op->dev;
Signature · 1 line
Jean Delvare
Quoted 9 lines · Michael Lawnick
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) */
Quoted 6 lines
Based on kernel 2.6.29
Signed-off-by Michael Lawnick <[email protected]>Cc Jean Delvare <[email protected]>Cc Sang, Wolfram <[email protected]>Cc Wolfgang Grandegger <[email protected]>
Please document the new device tree binding in "Documentation/powerpc/dts-bindings/fsl/i2c.txt", send a CC to "[email protected]", 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.
Quoted 8 lines · Michael Lawnick
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.
Quoted 46 lines
Based on kernel 2.6.29
Signed-off-by Michael Lawnick <[email protected]>Cc Jean Delvare <[email protected]>Cc Sang, Wolfram <[email protected]>Cc Wolfgang Grandegger <[email protected]>---
drivers/i2c/busses/i2c-mpc.c | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)drivers/i2c/busses/i2c-mpc.c +2
-1@@ -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;drivers/i2c/busses/i2c-mpc.c +4
-1@@ -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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Jon Smirl [email protected]
A message that is not in the archive (sent off-list or not yet received): 9e4733910904220723u68392662vb854188c1dec02fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 7 lines · Jon Smirl
Quoted 6 lines · Michael Lawnick
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)
Quoted 6 lines
Quoted 2 lines
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.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Wolfgang Grandegger
Quoted 7 lines · Jon Smirl
Quoted 6 lines · Michael Lawnick
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)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
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.
Signature · 2 lines
Jon Smirl [email protected]
Jon Smirl said the following:
Quoted 7 lines · Michael Lawnick
Quoted 6 lines
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)
Quoted 6 lines
Quoted 2 lines
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