* [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id()
@ 2025-08-14 17:36 Andrew Davis
2025-08-14 17:36 ` [PATCH 2/6] rtc: m41t80: " Andrew Davis
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-abx80x.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 3fee27914ba80..eca09872ea971 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -772,8 +772,7 @@ static int abx80x_probe(struct i2c_client *client)
struct abx80x_priv *priv;
int i, data, err, trickle_cfg = -EINVAL;
char buf[7];
- const struct i2c_device_id *id = i2c_match_id(abx80x_id, client);
- unsigned int part = id->driver_data;
+ unsigned int part = (uintptr_t)i2c_get_match_data(client);
unsigned int partnumber;
unsigned int majrev, minrev;
unsigned int lot;
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/6] rtc: m41t80: Remove use of i2c_match_id()
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
@ 2025-08-14 17:36 ` Andrew Davis
2025-08-14 17:36 ` [PATCH 3/6] rtc: pcf2127: " Andrew Davis
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-m41t80.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c
index 740cab013f590..b26afef37d9cf 100644
--- a/drivers/rtc/rtc-m41t80.c
+++ b/drivers/rtc/rtc-m41t80.c
@@ -924,13 +924,7 @@ static int m41t80_probe(struct i2c_client *client)
return -ENOMEM;
m41t80_data->client = client;
- if (client->dev.of_node) {
- m41t80_data->features = (unsigned long)
- of_device_get_match_data(&client->dev);
- } else {
- const struct i2c_device_id *id = i2c_match_id(m41t80_id, client);
- m41t80_data->features = id->driver_data;
- }
+ m41t80_data->features = (unsigned long)i2c_get_match_data(client);
i2c_set_clientdata(client, m41t80_data);
m41t80_data->rtc = devm_rtc_allocate_device(&client->dev);
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/6] rtc: pcf2127: Remove use of i2c_match_id()
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
2025-08-14 17:36 ` [PATCH 2/6] rtc: m41t80: " Andrew Davis
@ 2025-08-14 17:36 ` Andrew Davis
2025-08-14 17:36 ` [PATCH 4/6] rtc: rs5c372: " Andrew Davis
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-pcf2127.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 2e1ac0c42e932..22735a996e771 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -1432,10 +1432,10 @@ static const struct regmap_bus pcf2127_i2c_regmap = {
static struct i2c_driver pcf2127_i2c_driver;
static const struct i2c_device_id pcf2127_i2c_id[] = {
- { "pcf2127", PCF2127 },
- { "pcf2129", PCF2129 },
- { "pca2129", PCF2129 },
- { "pcf2131", PCF2131 },
+ { "pcf2127", (kernel_ulong_t)&pcf21xx_cfg[PCF2127] },
+ { "pcf2129", (kernel_ulong_t)&pcf21xx_cfg[PCF2129] },
+ { "pca2129", (kernel_ulong_t)&pcf21xx_cfg[PCF2129] },
+ { "pcf2131", (kernel_ulong_t)&pcf21xx_cfg[PCF2131] },
{ }
};
MODULE_DEVICE_TABLE(i2c, pcf2127_i2c_id);
@@ -1452,18 +1452,9 @@ static int pcf2127_i2c_probe(struct i2c_client *client)
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
- if (client->dev.of_node) {
- variant = of_device_get_match_data(&client->dev);
- if (!variant)
- return -ENODEV;
- } else {
- enum pcf21xx_type type =
- i2c_match_id(pcf2127_i2c_id, client)->driver_data;
-
- if (type >= PCF21XX_LAST_ID)
- return -ENODEV;
- variant = &pcf21xx_cfg[type];
- }
+ variant = i2c_get_match_data(client);
+ if (!variant)
+ return -ENODEV;
config.max_register = variant->max_register,
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/6] rtc: rs5c372: Remove use of i2c_match_id()
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
2025-08-14 17:36 ` [PATCH 2/6] rtc: m41t80: " Andrew Davis
2025-08-14 17:36 ` [PATCH 3/6] rtc: pcf2127: " Andrew Davis
@ 2025-08-14 17:36 ` Andrew Davis
2025-08-14 17:36 ` [PATCH 5/6] rtc: rv8803: " Andrew Davis
2025-08-14 17:36 ` [PATCH 6/6] rtc: rx8025: " Andrew Davis
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-rs5c372.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c
index f8fab0205f8cc..936f4f05c8c7a 100644
--- a/drivers/rtc/rtc-rs5c372.c
+++ b/drivers/rtc/rtc-rs5c372.c
@@ -825,12 +825,7 @@ static int rs5c372_probe(struct i2c_client *client)
rs5c372->client = client;
i2c_set_clientdata(client, rs5c372);
- if (client->dev.of_node) {
- rs5c372->type = (uintptr_t)of_device_get_match_data(&client->dev);
- } else {
- const struct i2c_device_id *id = i2c_match_id(rs5c372_id, client);
- rs5c372->type = id->driver_data;
- }
+ rs5c372->type = (uintptr_t)i2c_get_match_data(client);
/* we read registers 0x0f then 0x00-0x0f; skip the first one */
rs5c372->regs = &rs5c372->buf[1];
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/6] rtc: rv8803: Remove use of i2c_match_id()
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
` (2 preceding siblings ...)
2025-08-14 17:36 ` [PATCH 4/6] rtc: rs5c372: " Andrew Davis
@ 2025-08-14 17:36 ` Andrew Davis
2025-08-14 17:36 ` [PATCH 6/6] rtc: rx8025: " Andrew Davis
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-rv8803.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/rtc/rtc-rv8803.c b/drivers/rtc/rtc-rv8803.c
index 1327251e527c2..fab0fc463ec03 100644
--- a/drivers/rtc/rtc-rv8803.c
+++ b/drivers/rtc/rtc-rv8803.c
@@ -667,13 +667,7 @@ static int rv8803_probe(struct i2c_client *client)
mutex_init(&rv8803->flags_lock);
rv8803->client = client;
- if (client->dev.of_node) {
- rv8803->type = (uintptr_t)of_device_get_match_data(&client->dev);
- } else {
- const struct i2c_device_id *id = i2c_match_id(rv8803_id, client);
-
- rv8803->type = id->driver_data;
- }
+ rv8803->type = (uintptr_t)i2c_get_match_data(client);
i2c_set_clientdata(client, rv8803);
flags = rv8803_read_reg(client, RV8803_FLAG);
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6/6] rtc: rx8025: Remove use of i2c_match_id()
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
` (3 preceding siblings ...)
2025-08-14 17:36 ` [PATCH 5/6] rtc: rv8803: " Andrew Davis
@ 2025-08-14 17:36 ` Andrew Davis
4 siblings, 0 replies; 6+ messages in thread
From: Andrew Davis @ 2025-08-14 17:36 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Andrew Davis
The function i2c_match_id() is used to fetch the matching ID from
the i2c_device_id table. This is often used to then retrieve the
matching driver_data. This can be done in one step with the helper
i2c_get_match_data().
This helper has a couple other benefits:
* It doesn't need the i2c_device_id passed in so we do not need
to have that forward declared, allowing us to remove those or
move the i2c_device_id table down to its more natural spot
with the other module info.
* It also checks for device match data, which allows for OF and
ACPI based probing. That means we do not have to manually check
those first and can remove those checks.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/rtc/rtc-rx8025.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-rx8025.c b/drivers/rtc/rtc-rx8025.c
index aabe62c283a15..397c647a95375 100644
--- a/drivers/rtc/rtc-rx8025.c
+++ b/drivers/rtc/rtc-rx8025.c
@@ -522,7 +522,6 @@ static const struct attribute_group rx8025_attr_group = {
static int rx8025_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_match_id(rx8025_id, client);
struct i2c_adapter *adapter = client->adapter;
struct rx8025_data *rx8025;
int err = 0;
@@ -540,8 +539,7 @@ static int rx8025_probe(struct i2c_client *client)
i2c_set_clientdata(client, rx8025);
- if (id)
- rx8025->model = id->driver_data;
+ rx8025->model = (uintptr_t)i2c_get_match_data(client);
err = rx8025_init_client(client);
if (err)
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-14 17:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 17:36 [PATCH 1/6] rtc: abx80x: Remove use of i2c_match_id() Andrew Davis
2025-08-14 17:36 ` [PATCH 2/6] rtc: m41t80: " Andrew Davis
2025-08-14 17:36 ` [PATCH 3/6] rtc: pcf2127: " Andrew Davis
2025-08-14 17:36 ` [PATCH 4/6] rtc: rs5c372: " Andrew Davis
2025-08-14 17:36 ` [PATCH 5/6] rtc: rv8803: " Andrew Davis
2025-08-14 17:36 ` [PATCH 6/6] rtc: rx8025: " Andrew Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).