From 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 13 May 2024 10:30:14 +0000 Subject: [PATCH] modify sin led gpio --- kernel/drivers/iio/light/zopt2201.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/kernel/drivers/iio/light/zopt2201.c b/kernel/drivers/iio/light/zopt2201.c index 041ac9e..e0bc9df 100644 --- a/kernel/drivers/iio/light/zopt2201.c +++ b/kernel/drivers/iio/light/zopt2201.c @@ -1,11 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * zopt2201.c - Support for IDT ZOPT2201 ambient light and UV B sensor * * Copyright 2017 Peter Meerwald-Stadler <pmeerw@pmeerw.net> - * - * This file is subject to the terms and conditions of version 2 of - * the GNU General Public License. See the file COPYING in the main - * directory of this archive for more details. * * Datasheet: https://www.idt.com/document/dst/zopt2201-datasheet * 7-bit I2C slave addresses 0x53 (default) or 0x52 (programmed) @@ -21,6 +18,8 @@ #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> + +#include <asm/unaligned.h> #define ZOPT2201_DRV_NAME "zopt2201" @@ -222,7 +221,7 @@ goto fail; mutex_unlock(&data->lock); - return (buf[2] << 16) | (buf[1] << 8) | buf[0]; + return get_unaligned_le24(&buf[0]); fail: mutex_unlock(&data->lock); @@ -528,7 +527,6 @@ data->client = client; mutex_init(&data->lock); - indio_dev->dev.parent = &client->dev; indio_dev->info = &zopt2201_info; indio_dev->channels = zopt2201_channels; indio_dev->num_channels = ARRAY_SIZE(zopt2201_channels); -- Gitblit v1.6.2