staging: iio: ak8975: Remove i2c client data corruption
Preetham Chandru [Wed, 18 Apr 2012 14:41:36 +0000 (19:41 +0530)]
i2c client data set is of type struct indio_dev pointer and hence the
pointer returned from i2c_get_clientdata() should be assigned to
an object of type struct indio_dev and not to an object of type
struct ak8975_data.

Also in ak8975_probe() client data should be set first
before calling ak8975_setup() as it references the client data.

Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
CC: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Conflicts:

drivers/staging/iio/magnetometer/ak8975.c

Change-Id: Ia38ef9daf887d17ea290a9220b3ccd0218fcc533

drivers/staging/iio/magnetometer/ak8975.c

index af46ec0..127fe91 100644 (file)
@@ -511,8 +511,8 @@ static int ak8975_probe(struct i2c_client *client,
                goto exit_gpio;
        }
        data = iio_priv(indio_dev);
-
        i2c_set_clientdata(client, indio_dev);
+
        data->client = client;
        mutex_init(&data->lock);
        data->eoc_irq = client->irq;