.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013 Samsung Electronics Co., Ltd. |
---|
3 | 4 | * Author: Jacek Anaszewski <j.anaszewski@samsung.com> |
---|
.. | .. |
---|
28 | 29 | * with any triggers or illuminance events. Enabling/disabling |
---|
29 | 30 | * one of the proximity events automatically enables/disables |
---|
30 | 31 | * 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. |
---|
35 | 32 | */ |
---|
36 | 33 | |
---|
37 | 34 | #include <linux/debugfs.h> |
---|
.. | .. |
---|
41 | 38 | #include <linux/irq.h> |
---|
42 | 39 | #include <linux/irq_work.h> |
---|
43 | 40 | #include <linux/module.h> |
---|
| 41 | +#include <linux/mod_devicetable.h> |
---|
44 | 42 | #include <linux/mutex.h> |
---|
45 | | -#include <linux/of.h> |
---|
46 | 43 | #include <linux/regmap.h> |
---|
47 | 44 | #include <linux/regulator/consumer.h> |
---|
48 | 45 | #include <linux/slab.h> |
---|
.. | .. |
---|
1423 | 1420 | goto error_unlock; |
---|
1424 | 1421 | |
---|
1425 | 1422 | data->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL); |
---|
1426 | | - if (!data->buffer) { |
---|
| 1423 | + if (!data->buffer) |
---|
1427 | 1424 | err = -ENOMEM; |
---|
1428 | | - goto error_unlock; |
---|
1429 | | - } |
---|
1430 | | - |
---|
1431 | | - err = iio_triggered_buffer_postenable(indio_dev); |
---|
1432 | 1425 | |
---|
1433 | 1426 | error_unlock: |
---|
1434 | 1427 | mutex_unlock(&data->lock); |
---|
.. | .. |
---|
1439 | 1432 | static int gp2ap020a00f_buffer_predisable(struct iio_dev *indio_dev) |
---|
1440 | 1433 | { |
---|
1441 | 1434 | struct gp2ap020a00f_data *data = iio_priv(indio_dev); |
---|
1442 | | - int i, err; |
---|
| 1435 | + int i, err = 0; |
---|
1443 | 1436 | |
---|
1444 | 1437 | mutex_lock(&data->lock); |
---|
1445 | | - |
---|
1446 | | - err = iio_triggered_buffer_predisable(indio_dev); |
---|
1447 | | - if (err < 0) |
---|
1448 | | - goto error_unlock; |
---|
1449 | 1438 | |
---|
1450 | 1439 | for_each_set_bit(i, indio_dev->active_scan_mask, |
---|
1451 | 1440 | indio_dev->masklength) { |
---|
.. | .. |
---|
1468 | 1457 | if (err == 0) |
---|
1469 | 1458 | kfree(data->buffer); |
---|
1470 | 1459 | |
---|
1471 | | -error_unlock: |
---|
1472 | 1460 | mutex_unlock(&data->lock); |
---|
1473 | 1461 | |
---|
1474 | 1462 | return err; |
---|
.. | .. |
---|
1529 | 1517 | init_waitqueue_head(&data->data_ready_queue); |
---|
1530 | 1518 | |
---|
1531 | 1519 | mutex_init(&data->lock); |
---|
1532 | | - indio_dev->dev.parent = &client->dev; |
---|
1533 | 1520 | indio_dev->channels = gp2ap020a00f_channels; |
---|
1534 | 1521 | indio_dev->num_channels = ARRAY_SIZE(gp2ap020a00f_channels); |
---|
1535 | 1522 | indio_dev->info = &gp2ap020a00f_info; |
---|
.. | .. |
---|
1619 | 1606 | |
---|
1620 | 1607 | MODULE_DEVICE_TABLE(i2c, gp2ap020a00f_id); |
---|
1621 | 1608 | |
---|
1622 | | -#ifdef CONFIG_OF |
---|
1623 | 1609 | static const struct of_device_id gp2ap020a00f_of_match[] = { |
---|
1624 | 1610 | { .compatible = "sharp,gp2ap020a00f" }, |
---|
1625 | 1611 | { } |
---|
1626 | 1612 | }; |
---|
1627 | 1613 | MODULE_DEVICE_TABLE(of, gp2ap020a00f_of_match); |
---|
1628 | | -#endif |
---|
1629 | 1614 | |
---|
1630 | 1615 | static struct i2c_driver gp2ap020a00f_driver = { |
---|
1631 | 1616 | .driver = { |
---|
1632 | 1617 | .name = GP2A_I2C_NAME, |
---|
1633 | | - .of_match_table = of_match_ptr(gp2ap020a00f_of_match), |
---|
| 1618 | + .of_match_table = gp2ap020a00f_of_match, |
---|
1634 | 1619 | }, |
---|
1635 | 1620 | .probe = gp2ap020a00f_probe, |
---|
1636 | 1621 | .remove = gp2ap020a00f_remove, |
---|