hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/iio/light/zopt2201.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * zopt2201.c - Support for IDT ZOPT2201 ambient light and UV B sensor
34 *
45 * Copyright 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net>
5
- *
6
- * This file is subject to the terms and conditions of version 2 of
7
- * the GNU General Public License. See the file COPYING in the main
8
- * directory of this archive for more details.
96 *
107 * Datasheet: https://www.idt.com/document/dst/zopt2201-datasheet
118 * 7-bit I2C slave addresses 0x53 (default) or 0x52 (programmed)
....@@ -21,6 +18,8 @@
2118
2219 #include <linux/iio/iio.h>
2320 #include <linux/iio/sysfs.h>
21
+
22
+#include <asm/unaligned.h>
2423
2524 #define ZOPT2201_DRV_NAME "zopt2201"
2625
....@@ -222,7 +221,7 @@
222221 goto fail;
223222 mutex_unlock(&data->lock);
224223
225
- return (buf[2] << 16) | (buf[1] << 8) | buf[0];
224
+ return get_unaligned_le24(&buf[0]);
226225
227226 fail:
228227 mutex_unlock(&data->lock);
....@@ -528,7 +527,6 @@
528527 data->client = client;
529528 mutex_init(&data->lock);
530529
531
- indio_dev->dev.parent = &client->dev;
532530 indio_dev->info = &zopt2201_info;
533531 indio_dev->channels = zopt2201_channels;
534532 indio_dev->num_channels = ARRAY_SIZE(zopt2201_channels);