[PATCH] i2c: devtree-aware iic support for PPC4xx

Stephen Rothwell sfr at canb.auug.org.au
Sat Sep 15 21:36:17 EST 2007


[Just some trivial things]

On Sat, 15 Sep 2007 11:08:01 +0200 Stefan Roese <sr at denx.de> wrote:
>
> +++ b/drivers/i2c/busses/i2c-ibm_iic.h
> @@ -22,7 +22,8 @@
>  #ifndef __I2C_IBM_IIC_H_
>  #define __I2C_IBM_IIC_H_
>  
> -#include <linux/i2c.h> 
> +#include <linux/i2c.h>
> +#include <asm/prom.h>

Please include linux/of.h, of_device.h or of_platform.h (as appropriate)
instead of asm/prom.h.  In this case, since you want struct device_node,
include linux/of.h.

> +static irqreturn_t iic_handler(int irq, void *dev_id)
> +{
> +	struct ibm_iic_private* dev = (struct ibm_iic_private*)dev_id;

You shouldn't cast from (void *).

> +static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> +{
> +    	struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap))i

Again the return value of i2c_get_adapdata() is (void *) so shouldn't be
cast.

> +	prop = of_get_property(np, "iic-mode", &len);
> +	/* use 400kHz only if stated in dts, 100kHz otherwise */
> +	if (prop != NULL) {
> +		if (*prop == 400)
> +			dev->fast_mode = 1;
> +	} else
> +		dev->fast_mode = 0;

	dev->fast_mode = (prop && (*prop == 400));

> +static int __devexit iic_remove(struct of_device *ofdev)
> +{
> +	struct ibm_iic_private *dev =
> +		(struct ibm_iic_private *)dev_get_drvdata(&ofdev->dev);

dev_get_drvdata() also returns (void *).

> +static struct of_platform_driver ibm_iic_driver = {
> +	.name = "ibm-iic",
> +	.match_table = ibm_iic_match,
> +	.probe = iic_probe,
> +	.remove = iic_remove,
> +#if defined(CONFIG_PM)
> +	.suspend = NULL,
> +	.resume = NULL,
> +#endif

These last two will be NULL anyway, so just leave them out.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20070915/19880503/attachment.pgp>


More information about the Linuxppc-dev mailing list