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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241024191200.229894-16-andriy.shevchenko@linux.intel.com>
Date: Thu, 24 Oct 2024 22:05:04 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Jonathan Cameron <Jonathan.Cameron@...wei.com>,
	Marius Cristea <marius.cristea@...rochip.com>,
	Trevor Gamblin <tgamblin@...libre.com>,
	Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>,
	Hans de Goede <hdegoede@...hat.com>,
	linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>
Subject: [PATCH v3 15/24] iio: accel: kxcjk-1013: Replace a variant of iio_get_acpi_device_name_and_data()

IIO core (ACPI part) provides a generic helper that may be used in
the driver. Replace a variant of iio_get_acpi_device_name_and_data().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
 drivers/iio/accel/kxcjk-1013.c | 38 ++++++++++------------------------
 1 file changed, 11 insertions(+), 27 deletions(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index a8c73e401f95..e8074e0c59a4 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -1466,26 +1466,6 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int irq, void *private)
 		return IRQ_HANDLED;
 }
 
-static const char *kxcjk1013_match_acpi_device(struct device *dev,
-					       const struct kx_chipset_info **info,
-					       const char **label)
-{
-	const struct acpi_device_id *id;
-
-	id = acpi_match_device(dev->driver->acpi_match_table, dev);
-	if (!id)
-		return NULL;
-
-	if (strcmp(id->id, "KIOX010A") == 0)
-		*label = "accel-display";
-	else if (strcmp(id->id, "KIOX020A") == 0)
-		*label = "accel-base";
-
-	*info = (const struct kx_chipset_info *)id->driver_data;
-
-	return dev_name(dev);
-}
-
 static int kxcjk1013_probe(struct i2c_client *client)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(client);
@@ -1493,6 +1473,7 @@ static int kxcjk1013_probe(struct i2c_client *client)
 	struct kxcjk1013_data *data;
 	struct iio_dev *indio_dev;
 	struct kxcjk_1013_platform_data *pdata;
+	const void *ddata;
 	const char *name;
 	int ret;
 
@@ -1535,15 +1516,18 @@ static int kxcjk1013_probe(struct i2c_client *client)
 	if (id) {
 		name = id->name;
 		data->info = (const struct kx_chipset_info *)(id->driver_data);
-	} else if (ACPI_HANDLE(&client->dev)) {
-		name = kxcjk1013_match_acpi_device(&client->dev, &data->info,
-						   &indio_dev->label);
-	} else
+	} else {
+		name = iio_get_acpi_device_name_and_data(&client->dev, &ddata);
+		if (name)
+			data->info = ddata;
+		if (data->info == &kxcj91008_kiox010a_info)
+			indio_dev->label = "accel-display";
+		else if (data->info == &kxcj91008_kiox020a_info)
+			indio_dev->label = "accel-base";
+	}
+	if (!name)
 		return -ENODEV;
 
-	if (!data->info)
-		return -EINVAL;
-
 	ret = kxcjk1013_chip_init(data);
 	if (ret < 0)
 		return ret;
-- 
2.43.0.rc1.1336.g36b5255a03ac


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ