lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Apr 2021 15:50:42 -0300
From:   Lucas Stankus <lucas.p.stankus@...il.com>
To:     lars@...afoo.de, Michael.Hennerich@...log.com, jic23@...nel.org,
        gregkh@...uxfoundation.org
Cc:     linux-iio@...r.kernel.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: [PATCH 3/3] staging: iio: cdc: ad7746: use dt binding to set the
 excitation level

Set device excitation level using properties from device tree binding
instead of using platform_data.
As this replaces the last instance where the platform_data struct was
used, remove ad7746.h header file since it's no longer needed.

Signed-off-by: Lucas Stankus <lucas.p.stankus@...il.com>
---
 drivers/staging/iio/cdc/ad7746.c | 16 ++++++----------
 drivers/staging/iio/cdc/ad7746.h | 24 ------------------------
 2 files changed, 6 insertions(+), 34 deletions(-)
 delete mode 100644 drivers/staging/iio/cdc/ad7746.h

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 63041b164dbe..3c75d147c3dd 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -18,8 +18,6 @@
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 
-#include "ad7746.h"
-
 /*
  * AD7746 Register Definition
  */
@@ -676,11 +674,10 @@ static const struct iio_info ad7746_info = {
 static int ad7746_probe(struct i2c_client *client,
 			const struct i2c_device_id *id)
 {
-	struct ad7746_platform_data *pdata = client->dev.platform_data;
 	struct device_node *np = client->dev.of_node;
 	struct ad7746_chip_info *chip;
 	struct iio_dev *indio_dev;
-	unsigned int exca_en, excb_en;
+	unsigned int exca_en, excb_en, exclvl;
 	unsigned char regval = 0;
 	int ret = 0;
 
@@ -721,12 +718,11 @@ static int ad7746_probe(struct i2c_client *client,
 			regval |= AD7746_EXCSETUP_NEXCB;
 	}
 
-	if (pdata) {
-		regval |= AD7746_EXCSETUP_EXCLVL(pdata->exclvl);
-	} else {
-		dev_warn(&client->dev, "No platform data? using default\n");
-		regval = AD7746_EXCSETUP_EXCLVL(3);
-	}
+	ret = of_property_read_u32(np, "adi,excitation-voltage-level", &exclvl);
+	if (!ret)
+		regval |= AD7746_EXCSETUP_EXCLVL(exclvl);
+	else
+		regval |= AD7746_EXCSETUP_EXCLVL(3);
 
 	ret = i2c_smbus_write_byte_data(chip->client,
 					AD7746_REG_EXC_SETUP, regval);
diff --git a/drivers/staging/iio/cdc/ad7746.h b/drivers/staging/iio/cdc/ad7746.h
deleted file mode 100644
index 6cae4ecf779e..000000000000
--- a/drivers/staging/iio/cdc/ad7746.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * AD7746 capacitive sensor driver supporting AD7745, AD7746 and AD7747
- *
- * Copyright 2011 Analog Devices Inc.
- */
-
-#ifndef IIO_CDC_AD7746_H_
-#define IIO_CDC_AD7746_H_
-
-/*
- * TODO: struct ad7746_platform_data needs to go into include/linux/iio
- */
-
-#define AD7466_EXCLVL_0		0 /* +-VDD/8 */
-#define AD7466_EXCLVL_1		1 /* +-VDD/4 */
-#define AD7466_EXCLVL_2		2 /* +-VDD * 3/8 */
-#define AD7466_EXCLVL_3		3 /* +-VDD/2 */
-
-struct ad7746_platform_data {
-	unsigned char exclvl;	/*Excitation Voltage Level */
-};
-
-#endif /* IIO_CDC_AD7746_H_ */
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ