Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: light: max44000: use device-managed functions in probe

This is a simple conversion. Both iio_device_register() and
iio_triggered_buffer_setup() functions have device-managed variants.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210913120002.306280-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Alexandru Ardelean and committed by
Jonathan Cameron
2b025c92 da6fd259

+3 -14
+3 -14
drivers/iio/light/max44000.c
··· 540 540 return PTR_ERR(data->regmap); 541 541 } 542 542 543 - i2c_set_clientdata(client, indio_dev); 544 543 mutex_init(&data->lock); 545 544 indio_dev->info = &max44000_info; 546 545 indio_dev->name = MAX44000_DRV_NAME; ··· 588 589 return ret; 589 590 } 590 591 591 - ret = iio_triggered_buffer_setup(indio_dev, NULL, max44000_trigger_handler, NULL); 592 + ret = devm_iio_triggered_buffer_setup(&client->dev, indio_dev, NULL, 593 + max44000_trigger_handler, NULL); 592 594 if (ret < 0) { 593 595 dev_err(&client->dev, "iio triggered buffer setup failed\n"); 594 596 return ret; 595 597 } 596 598 597 - return iio_device_register(indio_dev); 598 - } 599 - 600 - static int max44000_remove(struct i2c_client *client) 601 - { 602 - struct iio_dev *indio_dev = i2c_get_clientdata(client); 603 - 604 - iio_device_unregister(indio_dev); 605 - iio_triggered_buffer_cleanup(indio_dev); 606 - 607 - return 0; 599 + return devm_iio_device_register(&client->dev, indio_dev); 608 600 } 609 601 610 602 static const struct i2c_device_id max44000_id[] = { ··· 618 628 .acpi_match_table = ACPI_PTR(max44000_acpi_match), 619 629 }, 620 630 .probe = max44000_probe, 621 - .remove = max44000_remove, 622 631 .id_table = max44000_id, 623 632 }; 624 633