.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * drivers/iio/light/tsl2563.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
8 | 9 | * |
---|
9 | 10 | * Converted to IIO driver |
---|
10 | 11 | * Amit Kucheria <amit.kucheria@verdurent.com> |
---|
11 | | - * |
---|
12 | | - * This program is free software; you can redistribute it and/or |
---|
13 | | - * modify it under the terms of the GNU General Public License |
---|
14 | | - * version 2 as published by the Free Software Foundation. |
---|
15 | | - * |
---|
16 | | - * This program is distributed in the hope that it will be useful, but |
---|
17 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | | - * General Public License for more details. |
---|
20 | | - * |
---|
21 | | - * You should have received a copy of the GNU General Public License |
---|
22 | | - * along with this program; if not, write to the Free Software |
---|
23 | | - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
---|
24 | | - * 02110-1301 USA |
---|
25 | 12 | */ |
---|
26 | 13 | |
---|
27 | 14 | #include <linux/module.h> |
---|
.. | .. |
---|
82 | 69 | #define TSL2563_TIMING_GAIN16 0x10 |
---|
83 | 70 | #define TSL2563_TIMING_GAIN1 0x00 |
---|
84 | 71 | |
---|
85 | | -#define TSL2563_INT_DISBLED 0x00 |
---|
| 72 | +#define TSL2563_INT_DISABLED 0x00 |
---|
86 | 73 | #define TSL2563_INT_LEVEL 0x10 |
---|
87 | 74 | #define TSL2563_INT_PERSIST(n) ((n) & 0x0F) |
---|
88 | 75 | |
---|
.. | .. |
---|
726 | 713 | |
---|
727 | 714 | chip = iio_priv(indio_dev); |
---|
728 | 715 | |
---|
729 | | - i2c_set_clientdata(client, chip); |
---|
| 716 | + i2c_set_clientdata(client, indio_dev); |
---|
730 | 717 | chip->client = client; |
---|
731 | 718 | |
---|
732 | 719 | err = tsl2563_detect(chip); |
---|
.. | .. |
---|
763 | 750 | indio_dev->name = client->name; |
---|
764 | 751 | indio_dev->channels = tsl2563_channels; |
---|
765 | 752 | indio_dev->num_channels = ARRAY_SIZE(tsl2563_channels); |
---|
766 | | - indio_dev->dev.parent = &client->dev; |
---|
767 | 753 | indio_dev->modes = INDIO_DIRECT_MODE; |
---|
768 | 754 | |
---|
769 | 755 | if (client->irq) |
---|
.. | .. |
---|
810 | 796 | |
---|
811 | 797 | static int tsl2563_remove(struct i2c_client *client) |
---|
812 | 798 | { |
---|
813 | | - struct tsl2563_chip *chip = i2c_get_clientdata(client); |
---|
814 | | - struct iio_dev *indio_dev = iio_priv_to_dev(chip); |
---|
| 799 | + struct iio_dev *indio_dev = i2c_get_clientdata(client); |
---|
| 800 | + struct tsl2563_chip *chip = iio_priv(indio_dev); |
---|
815 | 801 | |
---|
816 | 802 | iio_device_unregister(indio_dev); |
---|
817 | 803 | if (!chip->int_enabled) |
---|
.. | .. |
---|
829 | 815 | #ifdef CONFIG_PM_SLEEP |
---|
830 | 816 | static int tsl2563_suspend(struct device *dev) |
---|
831 | 817 | { |
---|
832 | | - struct tsl2563_chip *chip = i2c_get_clientdata(to_i2c_client(dev)); |
---|
| 818 | + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
---|
| 819 | + struct tsl2563_chip *chip = iio_priv(indio_dev); |
---|
833 | 820 | int ret; |
---|
834 | 821 | |
---|
835 | 822 | mutex_lock(&chip->lock); |
---|
.. | .. |
---|
847 | 834 | |
---|
848 | 835 | static int tsl2563_resume(struct device *dev) |
---|
849 | 836 | { |
---|
850 | | - struct tsl2563_chip *chip = i2c_get_clientdata(to_i2c_client(dev)); |
---|
| 837 | + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); |
---|
| 838 | + struct tsl2563_chip *chip = iio_priv(indio_dev); |
---|
851 | 839 | int ret; |
---|
852 | 840 | |
---|
853 | 841 | mutex_lock(&chip->lock); |
---|