Subject: Re: [PATCH][RFC][POWERPC] i2c: adds support for i2c bus on 8xx

From: Milton Miller <[email-masked]>
Date: Fri, 20 Apr 2007 10:15:32 -0500

At Fri Apr 20 14:27:14 EST 2007, Vitaly Bordug wrote:
> +               i2c_dev = 
> platform_device_register_simple("fsl-i2c-cpm", i, &r[0], 3);
> +               if (IS_ERR(i2c_dev)) {
> +                       ret = PTR_ERR(i2c_dev);
> +                       goto err;
> +               }
> +
> +               ret =
> +                   platform_device_add_data(i2c_dev, &i2c_data,
> +                                            sizeof(struct
> +                                                   
> fsl_i2c_platform_data));
>

This exposes a period of time where the device is registerd, but
the platform data is not available.  It might work for the
everything-in-the kernel model where the device is added before
the driver is registered, but is inherently racy.

You need to do alloc / add_resources / add_data / add.

milton