On 06/17/2014 11:21 PM, Beomho Seo wrote:
This patch changes APIs from request_threaded_irq()
and iio_device_register() to devm_* APIS.
Using them make code simpler.
Signed-off-by: Beomho Seo <beomho.seo@xxxxxxxxxxx>
---
drivers/iio/light/cm36651.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c
index 39fc67e..2fd9579 100644
--- a/drivers/iio/light/cm36651.c
+++ b/drivers/iio/light/cm36651.c
@@ -679,7 +679,8 @@ static int cm36651_probe(struct i2c_client *client,
goto error_i2c_unregister_ara;
}
- ret = request_threaded_irq(client->irq, NULL, cm36651_irq_handler,
+ ret = devm_request_threaded_irq(&client->dev, client->irq,
+ NULL, cm36651_irq_handler,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"cm36651", indio_dev);
if (ret) {
@@ -687,16 +688,14 @@ static int cm36651_probe(struct i2c_client *client,
goto error_i2c_unregister_ara;
}
- ret = iio_device_register(indio_dev);
+ ret = devm_iio_device_register(&client->dev, indio_dev);
May not be correct. As this driver needs to disable some regulator in
remove path, it is suggested not to use devm_xx here,
Thanks,
Srinivas
if (ret) {
dev_err(&client->dev, "%s: regist device failed\n", __func__);
- goto error_free_irq;
+ goto error_i2c_unregister_ara;
}
return 0;
-error_free_irq:
- free_irq(client->irq, indio_dev);
error_i2c_unregister_ara:
i2c_unregister_device(cm36651->ara_client);
error_i2c_unregister_ps:
@@ -711,9 +710,7 @@ static int cm36651_remove(struct i2c_client *client)
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct cm36651_data *cm36651 = iio_priv(indio_dev);
- iio_device_unregister(indio_dev);
regulator_disable(cm36651->vled_reg);
- free_irq(client->irq, indio_dev);
i2c_unregister_device(cm36651->ps_client);
i2c_unregister_device(cm36651->ara_client);
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html