iio: adc: mcp3422: Use devm_iio_device_register
devm_iio_device_register simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
a7e57dce02
commit
2842d4cc72
@ -362,7 +362,7 @@ static int mcp3422_probe(struct i2c_client *client,
|
|||||||
| MCP3422_SAMPLE_RATE_VALUE(MCP3422_SRATE_240));
|
| MCP3422_SAMPLE_RATE_VALUE(MCP3422_SRATE_240));
|
||||||
mcp3422_update_config(adc, config);
|
mcp3422_update_config(adc, config);
|
||||||
|
|
||||||
err = iio_device_register(indio_dev);
|
err = devm_iio_device_register(&client->dev, indio_dev);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@ -371,12 +371,6 @@ static int mcp3422_probe(struct i2c_client *client,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mcp3422_remove(struct i2c_client *client)
|
|
||||||
{
|
|
||||||
iio_device_unregister(i2c_get_clientdata(client));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct i2c_device_id mcp3422_id[] = {
|
static const struct i2c_device_id mcp3422_id[] = {
|
||||||
{ "mcp3422", 2 },
|
{ "mcp3422", 2 },
|
||||||
{ "mcp3423", 3 },
|
{ "mcp3423", 3 },
|
||||||
@ -400,7 +394,6 @@ static struct i2c_driver mcp3422_driver = {
|
|||||||
.of_match_table = of_match_ptr(mcp3422_of_match),
|
.of_match_table = of_match_ptr(mcp3422_of_match),
|
||||||
},
|
},
|
||||||
.probe = mcp3422_probe,
|
.probe = mcp3422_probe,
|
||||||
.remove = mcp3422_remove,
|
|
||||||
.id_table = mcp3422_id,
|
.id_table = mcp3422_id,
|
||||||
};
|
};
|
||||||
module_i2c_driver(mcp3422_driver);
|
module_i2c_driver(mcp3422_driver);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user