Linux IIO development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Marius Cristea <marius.cristea@microchip.com>,
	Trevor Gamblin <tgamblin@baylibre.com>,
	Hans de Goede <hdegoede@redhat.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Subject: [PATCH v1 08/13] iio: gyro: bmg160: Replace custom implementation of iio_get_acpi_device_name()
Date: Wed, 23 Oct 2024 18:17:31 +0300	[thread overview]
Message-ID: <20241023152145.3564943-9-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20241023152145.3564943-1-andriy.shevchenko@linux.intel.com>

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

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/gyro/bmg160_core.c | 15 ---------------
 drivers/iio/gyro/bmg160_i2c.c  |  4 +++-
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c
index 10728d5ccae3..499078537fa4 100644
--- a/drivers/iio/gyro/bmg160_core.c
+++ b/drivers/iio/gyro/bmg160_core.c
@@ -8,7 +8,6 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
-#include <linux/acpi.h>
 #include <linux/pm.h>
 #include <linux/pm_runtime.h>
 #include <linux/iio/iio.h>
@@ -1055,17 +1054,6 @@ static const struct iio_buffer_setup_ops bmg160_buffer_setup_ops = {
 	.postdisable = bmg160_buffer_postdisable,
 };
 
-static const char *bmg160_match_acpi_device(struct device *dev)
-{
-	const struct acpi_device_id *id;
-
-	id = acpi_match_device(dev->driver->acpi_match_table, dev);
-	if (!id)
-		return NULL;
-
-	return dev_name(dev);
-}
-
 int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
 		      const char *name)
 {
@@ -1098,9 +1086,6 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
 
 	mutex_init(&data->mutex);
 
-	if (ACPI_HANDLE(dev))
-		name = bmg160_match_acpi_device(dev);
-
 	indio_dev->channels = bmg160_channels;
 	indio_dev->num_channels = ARRAY_SIZE(bmg160_channels);
 	indio_dev->name = name;
diff --git a/drivers/iio/gyro/bmg160_i2c.c b/drivers/iio/gyro/bmg160_i2c.c
index a81814df5205..9c5d7e8ee99c 100644
--- a/drivers/iio/gyro/bmg160_i2c.c
+++ b/drivers/iio/gyro/bmg160_i2c.c
@@ -17,7 +17,7 @@ static int bmg160_i2c_probe(struct i2c_client *client)
 {
 	const struct i2c_device_id *id = i2c_client_get_device_id(client);
 	struct regmap *regmap;
-	const char *name = NULL;
+	const char *name;
 
 	regmap = devm_regmap_init_i2c(client, &bmg160_regmap_i2c_conf);
 	if (IS_ERR(regmap)) {
@@ -28,6 +28,8 @@ static int bmg160_i2c_probe(struct i2c_client *client)
 
 	if (id)
 		name = id->name;
+	else
+		name = iio_get_acpi_device_name(&client->dev);
 
 	return bmg160_core_probe(&client->dev, regmap, client->irq, name);
 }
-- 
2.43.0.rc1.1336.g36b5255a03ac


  parent reply	other threads:[~2024-10-23 15:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23 15:17 [PATCH v1 00/13] iio: Clean up acpi_match_device() use cases Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 01/13] iio: magnetometer: bmc150: Drop dead code from the driver Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 02/13] iio: adc: pac1934: Replace strange way of checking type of enumeration Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 03/13] iio: imu: inv_mpu6050: " Andy Shevchenko
2024-10-24 12:24   ` Jean-Baptiste Maneyrol
2024-10-23 15:17 ` [PATCH v1 04/13] iio: acpi: Improve iio_read_acpi_mount_matrix() Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 05/13] iio: acpi: Add iio_get_acpi_device_name_and_data() helper function Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 06/13] iio: accel: mma9551: Replace custom implementation of iio_get_acpi_device_name() Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 07/13] iio: accel: mma9553: " Andy Shevchenko
2024-10-23 15:17 ` Andy Shevchenko [this message]
2024-10-23 15:17 ` [PATCH v1 09/13] iio: light: isl29018: Replace a variant of iio_get_acpi_device_name_and_data() Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 10/13] iio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 11/13] iio: light: ltr501: Drop most likely fake ACPI IDs Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 12/13] iio: light: ltr501: Add LTER0303 to the supported devices Andy Shevchenko
2024-10-23 15:17 ` [PATCH v1 13/13] iio: light: ltr501: Replace a variant of iio_get_acpi_device_name_and_data() Andy Shevchenko
2024-10-23 15:36 ` [PATCH v1 00/13] iio: Clean up acpi_match_device() use cases Hans de Goede
2024-10-24  7:52 ` Jonathan Cameron
2024-10-24  8:06   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241023152145.3564943-9-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=hdegoede@redhat.com \
    --cc=jean-baptiste.maneyrol@tdk.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marius.cristea@microchip.com \
    --cc=tgamblin@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox