* [PATCH] iio: accel: da280: Simplify id-matching
@ 2024-01-01 13:32 Hans de Goede
2024-01-01 15:42 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2024-01-01 13:32 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Hans de Goede, Lars-Peter Clausen, linux-iio
da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
so it can be dropped.
And things can be simplified further by using i2c_get_match_data() which
will also check i2c_client_id style ids.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/iio/accel/da280.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
index 572bfe9694b0..e4cd4b3a28ab 100644
--- a/drivers/iio/accel/da280.c
+++ b/drivers/iio/accel/da280.c
@@ -89,17 +89,6 @@ static const struct iio_info da280_info = {
.read_raw = da280_read_raw,
};
-static enum da280_chipset da280_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 -EINVAL;
-
- return (enum da280_chipset) id->driver_data;
-}
-
static void da280_disable(void *client)
{
da280_enable(client, false);
@@ -107,7 +96,6 @@ static void da280_disable(void *client)
static int da280_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
int ret;
struct iio_dev *indio_dev;
struct da280_data *data;
@@ -128,11 +116,7 @@ static int da280_probe(struct i2c_client *client)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = da280_channels;
- if (ACPI_HANDLE(&client->dev)) {
- chip = da280_match_acpi_device(&client->dev);
- } else {
- chip = id->driver_data;
- }
+ chip = (uintptr_t)i2c_get_match_data(client);
if (chip == da217) {
indio_dev->name = "da217";
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: accel: da280: Simplify id-matching
2024-01-01 13:32 [PATCH] iio: accel: da280: Simplify id-matching Hans de Goede
@ 2024-01-01 15:42 ` Jonathan Cameron
2024-01-04 15:42 ` Hans de Goede
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-01-01 15:42 UTC (permalink / raw)
To: Hans de Goede; +Cc: Lars-Peter Clausen, linux-iio
On Mon, 1 Jan 2024 14:32:34 +0100
Hans de Goede <hdegoede@redhat.com> wrote:
> da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
> so it can be dropped.
>
> And things can be simplified further by using i2c_get_match_data() which
> will also check i2c_client_id style ids.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hi Hans and happy new year,
This runs into a slightly nasty corner case (which can't actually happen because
we know it will match) of a NULL return on failure to match which ends up
being the first enum entry whereas we should probably return an error.
My preferred cleanup would be to make both id tables point to a set of structs
that encode the device differences as data rather than ids.
struct da280_chip_info {
const char *name;
int num_channels;
}
or something along those lines. Then we can rely on the generic lookup function
without taking care about the 0 value.
Jonathan
> ---
> drivers/iio/accel/da280.c | 18 +-----------------
> 1 file changed, 1 insertion(+), 17 deletions(-)
>
> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
> index 572bfe9694b0..e4cd4b3a28ab 100644
> --- a/drivers/iio/accel/da280.c
> +++ b/drivers/iio/accel/da280.c
> @@ -89,17 +89,6 @@ static const struct iio_info da280_info = {
> .read_raw = da280_read_raw,
> };
>
> -static enum da280_chipset da280_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 -EINVAL;
> -
> - return (enum da280_chipset) id->driver_data;
> -}
> -
> static void da280_disable(void *client)
> {
> da280_enable(client, false);
> @@ -107,7 +96,6 @@ static void da280_disable(void *client)
>
> static int da280_probe(struct i2c_client *client)
> {
> - const struct i2c_device_id *id = i2c_client_get_device_id(client);
> int ret;
> struct iio_dev *indio_dev;
> struct da280_data *data;
> @@ -128,11 +116,7 @@ static int da280_probe(struct i2c_client *client)
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = da280_channels;
>
> - if (ACPI_HANDLE(&client->dev)) {
> - chip = da280_match_acpi_device(&client->dev);
> - } else {
> - chip = id->driver_data;
> - }
> + chip = (uintptr_t)i2c_get_match_data(client);
>
> if (chip == da217) {
> indio_dev->name = "da217";
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: accel: da280: Simplify id-matching
2024-01-01 15:42 ` Jonathan Cameron
@ 2024-01-04 15:42 ` Hans de Goede
0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2024-01-04 15:42 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Lars-Peter Clausen, linux-iio
Hi,
On 1/1/24 16:42, Jonathan Cameron wrote:
> On Mon, 1 Jan 2024 14:32:34 +0100
> Hans de Goede <hdegoede@redhat.com> wrote:
>
>> da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
>> so it can be dropped.
>>
>> And things can be simplified further by using i2c_get_match_data() which
>> will also check i2c_client_id style ids.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Hi Hans and happy new year,
>
> This runs into a slightly nasty corner case (which can't actually happen because
> we know it will match) of a NULL return on failure to match which ends up
> being the first enum entry whereas we should probably return an error.
>
> My preferred cleanup would be to make both id tables point to a set of structs
> that encode the device differences as data rather than ids.
>
> struct da280_chip_info {
> const char *name;
> int num_channels;
> }
>
> or something along those lines. Then we can rely on the generic lookup function
> without taking care about the 0 value.
That is a good idea, thanks.
I have prepared (and will send out shortly) a v2 implementing this.
Regards,
Hans
>> ---
>> drivers/iio/accel/da280.c | 18 +-----------------
>> 1 file changed, 1 insertion(+), 17 deletions(-)
>>
>> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
>> index 572bfe9694b0..e4cd4b3a28ab 100644
>> --- a/drivers/iio/accel/da280.c
>> +++ b/drivers/iio/accel/da280.c
>> @@ -89,17 +89,6 @@ static const struct iio_info da280_info = {
>> .read_raw = da280_read_raw,
>> };
>>
>> -static enum da280_chipset da280_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 -EINVAL;
>> -
>> - return (enum da280_chipset) id->driver_data;
>> -}
>> -
>> static void da280_disable(void *client)
>> {
>> da280_enable(client, false);
>> @@ -107,7 +96,6 @@ static void da280_disable(void *client)
>>
>> static int da280_probe(struct i2c_client *client)
>> {
>> - const struct i2c_device_id *id = i2c_client_get_device_id(client);
>> int ret;
>> struct iio_dev *indio_dev;
>> struct da280_data *data;
>> @@ -128,11 +116,7 @@ static int da280_probe(struct i2c_client *client)
>> indio_dev->modes = INDIO_DIRECT_MODE;
>> indio_dev->channels = da280_channels;
>>
>> - if (ACPI_HANDLE(&client->dev)) {
>> - chip = da280_match_acpi_device(&client->dev);
>> - } else {
>> - chip = id->driver_data;
>> - }
>> + chip = (uintptr_t)i2c_get_match_data(client);
>>
>> if (chip == da217) {
>> indio_dev->name = "da217";
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] iio: accel: da280: Simplify id-matching
@ 2024-01-04 16:01 Hans de Goede
2024-01-04 16:02 ` Hans de Goede
2024-01-07 16:10 ` Jonathan Cameron
0 siblings, 2 replies; 6+ messages in thread
From: Hans de Goede @ 2024-01-04 16:01 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Hans de Goede, Lars-Peter Clausen, linux-iio
da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
so it can be dropped.
And things can be simplified further by using i2c_get_match_data() which
will also check i2c_client_id style ids.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
- Add a new da280_match_data struct to hold the name + num_channels and
use that instead of the da280_chipset enum
- Error check i2c_get_match_data() returning NULL
Handle i2c_get_match_data() returning NULL on missing match-data
---
drivers/iio/accel/da280.c | 64 +++++++++++++++------------------------
1 file changed, 25 insertions(+), 39 deletions(-)
diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
index 572bfe9694b0..756e2ea7c056 100644
--- a/drivers/iio/accel/da280.c
+++ b/drivers/iio/accel/da280.c
@@ -23,8 +23,6 @@
#define DA280_MODE_ENABLE 0x1e
#define DA280_MODE_DISABLE 0x9e
-enum da280_chipset { da217, da226, da280 };
-
/*
* a value of + or -4096 corresponds to + or - 1G
* scale = 9.81 / 4096 = 0.002395019
@@ -47,6 +45,11 @@ static const struct iio_chan_spec da280_channels[] = {
DA280_CHANNEL(DA280_REG_ACC_Z_LSB, Z),
};
+struct da280_match_data {
+ const char *name;
+ int num_channels;
+};
+
struct da280_data {
struct i2c_client *client;
};
@@ -89,17 +92,6 @@ static const struct iio_info da280_info = {
.read_raw = da280_read_raw,
};
-static enum da280_chipset da280_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 -EINVAL;
-
- return (enum da280_chipset) id->driver_data;
-}
-
static void da280_disable(void *client)
{
da280_enable(client, false);
@@ -107,16 +99,21 @@ static void da280_disable(void *client)
static int da280_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_client_get_device_id(client);
- int ret;
+ const struct da280_match_data *match_data;
struct iio_dev *indio_dev;
struct da280_data *data;
- enum da280_chipset chip;
+ int ret;
ret = i2c_smbus_read_byte_data(client, DA280_REG_CHIP_ID);
if (ret != DA280_CHIP_ID)
return (ret < 0) ? ret : -ENODEV;
+ match_data = i2c_get_match_data(client);
+ if (!match_data) {
+ dev_err(&client->dev, "Error match-data not set\n");
+ return -EINVAL;
+ }
+
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev)
return -ENOMEM;
@@ -127,23 +124,8 @@ static int da280_probe(struct i2c_client *client)
indio_dev->info = &da280_info;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = da280_channels;
-
- if (ACPI_HANDLE(&client->dev)) {
- chip = da280_match_acpi_device(&client->dev);
- } else {
- chip = id->driver_data;
- }
-
- if (chip == da217) {
- indio_dev->name = "da217";
- indio_dev->num_channels = 3;
- } else if (chip == da226) {
- indio_dev->name = "da226";
- indio_dev->num_channels = 2;
- } else {
- indio_dev->name = "da280";
- indio_dev->num_channels = 3;
- }
+ indio_dev->num_channels = match_data->num_channels;
+ indio_dev->name = match_data->name;
ret = da280_enable(client, true);
if (ret < 0)
@@ -168,17 +150,21 @@ static int da280_resume(struct device *dev)
static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
+static const struct da280_match_data da217_match_data = { "da217", 3 };
+static const struct da280_match_data da226_match_data = { "da226", 2 };
+static const struct da280_match_data da280_match_data = { "da280", 3 };
+
static const struct acpi_device_id da280_acpi_match[] = {
- {"NSA2513", da217},
- {"MIRAACC", da280},
- {},
+ { "NSA2513", (kernel_ulong_t)&da217_match_data },
+ { "MIRAACC", (kernel_ulong_t)&da280_match_data },
+ {}
};
MODULE_DEVICE_TABLE(acpi, da280_acpi_match);
static const struct i2c_device_id da280_i2c_id[] = {
- { "da217", da217 },
- { "da226", da226 },
- { "da280", da280 },
+ { "da217", (kernel_ulong_t)&da217_match_data },
+ { "da226", (kernel_ulong_t)&da226_match_data },
+ { "da280", (kernel_ulong_t)&da280_match_data },
{}
};
MODULE_DEVICE_TABLE(i2c, da280_i2c_id);
--
2.43.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: accel: da280: Simplify id-matching
2024-01-04 16:01 Hans de Goede
@ 2024-01-04 16:02 ` Hans de Goede
2024-01-07 16:10 ` Jonathan Cameron
1 sibling, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2024-01-04 16:02 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Lars-Peter Clausen, linux-iio
Note his is v2, I forgot to pass -v2 when git format-patch(ing) this (sorry).
Regards,
Hans
On 1/4/24 17:01, Hans de Goede wrote:
> da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
> so it can be dropped.
>
> And things can be simplified further by using i2c_get_match_data() which
> will also check i2c_client_id style ids.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> - Add a new da280_match_data struct to hold the name + num_channels and
> use that instead of the da280_chipset enum
> - Error check i2c_get_match_data() returning NULL
>
> Handle i2c_get_match_data() returning NULL on missing match-data
> ---
> drivers/iio/accel/da280.c | 64 +++++++++++++++------------------------
> 1 file changed, 25 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
> index 572bfe9694b0..756e2ea7c056 100644
> --- a/drivers/iio/accel/da280.c
> +++ b/drivers/iio/accel/da280.c
> @@ -23,8 +23,6 @@
> #define DA280_MODE_ENABLE 0x1e
> #define DA280_MODE_DISABLE 0x9e
>
> -enum da280_chipset { da217, da226, da280 };
> -
> /*
> * a value of + or -4096 corresponds to + or - 1G
> * scale = 9.81 / 4096 = 0.002395019
> @@ -47,6 +45,11 @@ static const struct iio_chan_spec da280_channels[] = {
> DA280_CHANNEL(DA280_REG_ACC_Z_LSB, Z),
> };
>
> +struct da280_match_data {
> + const char *name;
> + int num_channels;
> +};
> +
> struct da280_data {
> struct i2c_client *client;
> };
> @@ -89,17 +92,6 @@ static const struct iio_info da280_info = {
> .read_raw = da280_read_raw,
> };
>
> -static enum da280_chipset da280_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 -EINVAL;
> -
> - return (enum da280_chipset) id->driver_data;
> -}
> -
> static void da280_disable(void *client)
> {
> da280_enable(client, false);
> @@ -107,16 +99,21 @@ static void da280_disable(void *client)
>
> static int da280_probe(struct i2c_client *client)
> {
> - const struct i2c_device_id *id = i2c_client_get_device_id(client);
> - int ret;
> + const struct da280_match_data *match_data;
> struct iio_dev *indio_dev;
> struct da280_data *data;
> - enum da280_chipset chip;
> + int ret;
>
> ret = i2c_smbus_read_byte_data(client, DA280_REG_CHIP_ID);
> if (ret != DA280_CHIP_ID)
> return (ret < 0) ? ret : -ENODEV;
>
> + match_data = i2c_get_match_data(client);
> + if (!match_data) {
> + dev_err(&client->dev, "Error match-data not set\n");
> + return -EINVAL;
> + }
> +
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> if (!indio_dev)
> return -ENOMEM;
> @@ -127,23 +124,8 @@ static int da280_probe(struct i2c_client *client)
> indio_dev->info = &da280_info;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = da280_channels;
> -
> - if (ACPI_HANDLE(&client->dev)) {
> - chip = da280_match_acpi_device(&client->dev);
> - } else {
> - chip = id->driver_data;
> - }
> -
> - if (chip == da217) {
> - indio_dev->name = "da217";
> - indio_dev->num_channels = 3;
> - } else if (chip == da226) {
> - indio_dev->name = "da226";
> - indio_dev->num_channels = 2;
> - } else {
> - indio_dev->name = "da280";
> - indio_dev->num_channels = 3;
> - }
> + indio_dev->num_channels = match_data->num_channels;
> + indio_dev->name = match_data->name;
>
> ret = da280_enable(client, true);
> if (ret < 0)
> @@ -168,17 +150,21 @@ static int da280_resume(struct device *dev)
>
> static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
>
> +static const struct da280_match_data da217_match_data = { "da217", 3 };
> +static const struct da280_match_data da226_match_data = { "da226", 2 };
> +static const struct da280_match_data da280_match_data = { "da280", 3 };
> +
> static const struct acpi_device_id da280_acpi_match[] = {
> - {"NSA2513", da217},
> - {"MIRAACC", da280},
> - {},
> + { "NSA2513", (kernel_ulong_t)&da217_match_data },
> + { "MIRAACC", (kernel_ulong_t)&da280_match_data },
> + {}
> };
> MODULE_DEVICE_TABLE(acpi, da280_acpi_match);
>
> static const struct i2c_device_id da280_i2c_id[] = {
> - { "da217", da217 },
> - { "da226", da226 },
> - { "da280", da280 },
> + { "da217", (kernel_ulong_t)&da217_match_data },
> + { "da226", (kernel_ulong_t)&da226_match_data },
> + { "da280", (kernel_ulong_t)&da280_match_data },
> {}
> };
> MODULE_DEVICE_TABLE(i2c, da280_i2c_id);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: accel: da280: Simplify id-matching
2024-01-04 16:01 Hans de Goede
2024-01-04 16:02 ` Hans de Goede
@ 2024-01-07 16:10 ` Jonathan Cameron
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2024-01-07 16:10 UTC (permalink / raw)
To: Hans de Goede; +Cc: Lars-Peter Clausen, linux-iio
On Thu, 4 Jan 2024 17:01:52 +0100
Hans de Goede <hdegoede@redhat.com> wrote:
> da280_match_acpi_device() is a DIY version of acpi_device_get_match_data(),
> so it can be dropped.
>
> And things can be simplified further by using i2c_get_match_data() which
> will also check i2c_client_id style ids.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
LGTM
Applied to the togreg branch of iio.git but note I will be rebasing that
on rc1 once it is available. So in meantime this is only pushed out as
testing to give 0-day a head start.
Thanks,
Jonathan
> ---
> Changes in v2:
> - Add a new da280_match_data struct to hold the name + num_channels and
> use that instead of the da280_chipset enum
> - Error check i2c_get_match_data() returning NULL
>
> Handle i2c_get_match_data() returning NULL on missing match-data
> ---
> drivers/iio/accel/da280.c | 64 +++++++++++++++------------------------
> 1 file changed, 25 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c
> index 572bfe9694b0..756e2ea7c056 100644
> --- a/drivers/iio/accel/da280.c
> +++ b/drivers/iio/accel/da280.c
> @@ -23,8 +23,6 @@
> #define DA280_MODE_ENABLE 0x1e
> #define DA280_MODE_DISABLE 0x9e
>
> -enum da280_chipset { da217, da226, da280 };
> -
> /*
> * a value of + or -4096 corresponds to + or - 1G
> * scale = 9.81 / 4096 = 0.002395019
> @@ -47,6 +45,11 @@ static const struct iio_chan_spec da280_channels[] = {
> DA280_CHANNEL(DA280_REG_ACC_Z_LSB, Z),
> };
>
> +struct da280_match_data {
> + const char *name;
> + int num_channels;
> +};
> +
> struct da280_data {
> struct i2c_client *client;
> };
> @@ -89,17 +92,6 @@ static const struct iio_info da280_info = {
> .read_raw = da280_read_raw,
> };
>
> -static enum da280_chipset da280_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 -EINVAL;
> -
> - return (enum da280_chipset) id->driver_data;
> -}
> -
> static void da280_disable(void *client)
> {
> da280_enable(client, false);
> @@ -107,16 +99,21 @@ static void da280_disable(void *client)
>
> static int da280_probe(struct i2c_client *client)
> {
> - const struct i2c_device_id *id = i2c_client_get_device_id(client);
> - int ret;
> + const struct da280_match_data *match_data;
> struct iio_dev *indio_dev;
> struct da280_data *data;
> - enum da280_chipset chip;
> + int ret;
>
> ret = i2c_smbus_read_byte_data(client, DA280_REG_CHIP_ID);
> if (ret != DA280_CHIP_ID)
> return (ret < 0) ? ret : -ENODEV;
>
> + match_data = i2c_get_match_data(client);
> + if (!match_data) {
> + dev_err(&client->dev, "Error match-data not set\n");
> + return -EINVAL;
> + }
> +
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> if (!indio_dev)
> return -ENOMEM;
> @@ -127,23 +124,8 @@ static int da280_probe(struct i2c_client *client)
> indio_dev->info = &da280_info;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->channels = da280_channels;
> -
> - if (ACPI_HANDLE(&client->dev)) {
> - chip = da280_match_acpi_device(&client->dev);
> - } else {
> - chip = id->driver_data;
> - }
> -
> - if (chip == da217) {
> - indio_dev->name = "da217";
> - indio_dev->num_channels = 3;
> - } else if (chip == da226) {
> - indio_dev->name = "da226";
> - indio_dev->num_channels = 2;
> - } else {
> - indio_dev->name = "da280";
> - indio_dev->num_channels = 3;
> - }
> + indio_dev->num_channels = match_data->num_channels;
> + indio_dev->name = match_data->name;
>
> ret = da280_enable(client, true);
> if (ret < 0)
> @@ -168,17 +150,21 @@ static int da280_resume(struct device *dev)
>
> static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume);
>
> +static const struct da280_match_data da217_match_data = { "da217", 3 };
> +static const struct da280_match_data da226_match_data = { "da226", 2 };
> +static const struct da280_match_data da280_match_data = { "da280", 3 };
> +
> static const struct acpi_device_id da280_acpi_match[] = {
> - {"NSA2513", da217},
> - {"MIRAACC", da280},
> - {},
> + { "NSA2513", (kernel_ulong_t)&da217_match_data },
> + { "MIRAACC", (kernel_ulong_t)&da280_match_data },
> + {}
> };
> MODULE_DEVICE_TABLE(acpi, da280_acpi_match);
>
> static const struct i2c_device_id da280_i2c_id[] = {
> - { "da217", da217 },
> - { "da226", da226 },
> - { "da280", da280 },
> + { "da217", (kernel_ulong_t)&da217_match_data },
> + { "da226", (kernel_ulong_t)&da226_match_data },
> + { "da280", (kernel_ulong_t)&da280_match_data },
> {}
> };
> MODULE_DEVICE_TABLE(i2c, da280_i2c_id);
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-01-07 16:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-01 13:32 [PATCH] iio: accel: da280: Simplify id-matching Hans de Goede
2024-01-01 15:42 ` Jonathan Cameron
2024-01-04 15:42 ` Hans de Goede
-- strict thread matches above, loose matches on Subject: below --
2024-01-04 16:01 Hans de Goede
2024-01-04 16:02 ` Hans de Goede
2024-01-07 16:10 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox