return tsl2772_write_control_reg(chip, 0x00);
}
+static void tsl2772_chip_off_action(void *data)
+{
+ struct iio_dev *indio_dev = data;
+
+ tsl2772_chip_off(indio_dev);
+}
+
/**
* tsl2772_invoke_change - power cycle the device to implement the user
* parameters
if (ret < 0)
return ret;
+ ret = devm_add_action_or_reset(&clientp->dev,
+ tsl2772_chip_off_action,
+ indio_dev);
+ if (ret < 0)
+ return ret;
+
ret = iio_device_register(indio_dev);
if (ret) {
- tsl2772_chip_off(indio_dev);
dev_err(&clientp->dev,
"%s: iio registration failed\n", __func__);
return ret;
{
struct iio_dev *indio_dev = i2c_get_clientdata(client);
- tsl2772_chip_off(indio_dev);
-
iio_device_unregister(indio_dev);
return 0;