Commit 0b27d678 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:max1363 enable use with inkernel interfaces.

Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ecbf20ca
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "../sysfs.h" #include "../sysfs.h"
#include "../events.h" #include "../events.h"
#include "../buffer.h" #include "../buffer.h"
#include "../driver.h"
#include "max1363.h" #include "max1363.h"
...@@ -1290,6 +1291,9 @@ static int __devinit max1363_probe(struct i2c_client *client, ...@@ -1290,6 +1291,9 @@ static int __devinit max1363_probe(struct i2c_client *client,
ret = -ENOMEM; ret = -ENOMEM;
goto error_disable_reg; goto error_disable_reg;
} }
ret = iio_map_array_register(indio_dev, client->dev.platform_data);
if (ret < 0)
goto error_free_device;
st = iio_priv(indio_dev); st = iio_priv(indio_dev);
st->reg = reg; st->reg = reg;
/* this is only used for device removal purposes */ /* this is only used for device removal purposes */
...@@ -1300,7 +1304,7 @@ static int __devinit max1363_probe(struct i2c_client *client, ...@@ -1300,7 +1304,7 @@ static int __devinit max1363_probe(struct i2c_client *client,
ret = max1363_alloc_scan_masks(indio_dev); ret = max1363_alloc_scan_masks(indio_dev);
if (ret) if (ret)
goto error_free_device; goto error_unregister_map;
/* Estabilish that the iio_dev is a child of the i2c device */ /* Estabilish that the iio_dev is a child of the i2c device */
indio_dev->dev.parent = &client->dev; indio_dev->dev.parent = &client->dev;
...@@ -1350,6 +1354,8 @@ static int __devinit max1363_probe(struct i2c_client *client, ...@@ -1350,6 +1354,8 @@ static int __devinit max1363_probe(struct i2c_client *client,
max1363_ring_cleanup(indio_dev); max1363_ring_cleanup(indio_dev);
error_free_available_scan_masks: error_free_available_scan_masks:
kfree(indio_dev->available_scan_masks); kfree(indio_dev->available_scan_masks);
error_unregister_map:
iio_map_array_unregister(indio_dev, client->dev.platform_data);
error_free_device: error_free_device:
iio_free_device(indio_dev); iio_free_device(indio_dev);
error_disable_reg: error_disable_reg:
...@@ -1376,6 +1382,7 @@ static int max1363_remove(struct i2c_client *client) ...@@ -1376,6 +1382,7 @@ static int max1363_remove(struct i2c_client *client)
regulator_disable(reg); regulator_disable(reg);
regulator_put(reg); regulator_put(reg);
} }
iio_map_array_unregister(indio_dev, client->dev.platform_data);
iio_free_device(indio_dev); iio_free_device(indio_dev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment