hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/iio/light/gp2ap020a00f.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013 Samsung Electronics Co., Ltd.
34 * Author: Jacek Anaszewski <j.anaszewski@samsung.com>
....@@ -28,10 +29,6 @@
2829 * with any triggers or illuminance events. Enabling/disabling
2930 * one of the proximity events automatically enables/disables
3031 * the other one.
31
- *
32
- * This program is free software; you can redistribute it and/or modify
33
- * it under the terms of the GNU General Public License version 2, as
34
- * published by the Free Software Foundation.
3532 */
3633
3734 #include <linux/debugfs.h>
....@@ -41,8 +38,8 @@
4138 #include <linux/irq.h>
4239 #include <linux/irq_work.h>
4340 #include <linux/module.h>
41
+#include <linux/mod_devicetable.h>
4442 #include <linux/mutex.h>
45
-#include <linux/of.h>
4643 #include <linux/regmap.h>
4744 #include <linux/regulator/consumer.h>
4845 #include <linux/slab.h>
....@@ -1423,12 +1420,8 @@
14231420 goto error_unlock;
14241421
14251422 data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
1426
- if (!data->buffer) {
1423
+ if (!data->buffer)
14271424 err = -ENOMEM;
1428
- goto error_unlock;
1429
- }
1430
-
1431
- err = iio_triggered_buffer_postenable(indio_dev);
14321425
14331426 error_unlock:
14341427 mutex_unlock(&data->lock);
....@@ -1439,13 +1432,9 @@
14391432 static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev)
14401433 {
14411434 struct gp2ap020a00f_data *data = iio_priv(indio_dev);
1442
- int i, err;
1435
+ int i, err = 0;
14431436
14441437 mutex_lock(&data->lock);
1445
-
1446
- err = iio_triggered_buffer_predisable(indio_dev);
1447
- if (err < 0)
1448
- goto error_unlock;
14491438
14501439 for_each_set_bit(i, indio_dev->active_scan_mask,
14511440 indio_dev->masklength) {
....@@ -1468,7 +1457,6 @@
14681457 if (err == 0)
14691458 kfree(data->buffer);
14701459
1471
-error_unlock:
14721460 mutex_unlock(&data->lock);
14731461
14741462 return err;
....@@ -1529,7 +1517,6 @@
15291517 init_waitqueue_head(&data->data_ready_queue);
15301518
15311519 mutex_init(&data->lock);
1532
- indio_dev->dev.parent = &client->dev;
15331520 indio_dev->channels = gp2ap020a00f_channels;
15341521 indio_dev->num_channels = ARRAY_SIZE(gp2ap020a00f_channels);
15351522 indio_dev->info = &gp2ap020a00f_info;
....@@ -1619,18 +1606,16 @@
16191606
16201607 MODULE_DEVICE_TABLE(i2c, gp2ap020a00f_id);
16211608
1622
-#ifdef CONFIG_OF
16231609 static const struct of_device_id gp2ap020a00f_of_match[] = {
16241610 { .compatible = "sharp,gp2ap020a00f" },
16251611 { }
16261612 };
16271613 MODULE_DEVICE_TABLE(of, gp2ap020a00f_of_match);
1628
-#endif
16291614
16301615 static struct i2c_driver gp2ap020a00f_driver = {
16311616 .driver = {
16321617 .name = GP2A_I2C_NAME,
1633
- .of_match_table = of_match_ptr(gp2ap020a00f_of_match),
1618
+ .of_match_table = gp2ap020a00f_of_match,
16341619 },
16351620 .probe = gp2ap020a00f_probe,
16361621 .remove = gp2ap020a00f_remove,