Remove use of i2c_match_id in RTC
v2 cover Remove use of i2c_match_id in RTC
Hello all,
RTC subsystem is one of the last still using i2c_match_id(). This is a v2 but nothing is changed from last time. If I'm not sending this to the right folks let me know.
Thanks,
Andrew
Andrew Davis (6):
rtc: abx80x: Remove use of i2c_match_id()
rtc: m41t80: Remove use of i2c_match_id()
rtc: pcf2127: Remove use of i2c_match_id()
rtc: rs5c372: Remove use of i2c_match_id()
rtc: rv8803: Remove use of i2c_match_id()
rtc: rx8025: Remove use of i2c_match_id()
drivers/rtc/rtc-abx80x.c | 3 +-- drivers/rtc/rtc-m41t80.c | 8 +------- drivers/rtc/rtc-pcf2127.c | 23 +++++++---------------- drivers/rtc/rtc-rs5c372.c | 7 +------ drivers/rtc/rtc-rv8803.c | 8 +------- drivers/rtc/rtc-rx8025.c | 4 +--- 6 files changed, 12 insertions(+), 41 deletions(-)
Signature · 1 line
2.39.2
PATCH v2 1/6 rtc: abx80x: Remove use of i2c_match_id()
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.
--- drivers/rtc/rtc-abx80x.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-abx80x.c +1 -2
@@ -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;
Signature · 1 line
2.39.2
PATCH v2 2/6 rtc: m41t80: Remove use of i2c_match_id()
In reply to Andrew DavisThe 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.
--- drivers/rtc/rtc-m41t80.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/rtc/rtc-m41t80.c +1 -7
@@ -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);
Signature · 1 line
2.39.2
PATCH v2 3/6 rtc: pcf2127: Remove use of i2c_match_id()
In reply to Andrew DavisThe 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.
--- drivers/rtc/rtc-pcf2127.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
drivers/rtc/rtc-pcf2127.c +7 -16
@@ -1449,10 +1449,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);
@@ -1469,18 +1469,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,
Signature · 1 line
2.39.2
PATCH v2 4/6 rtc: rs5c372: Remove use of i2c_match_id()
In reply to Andrew DavisThe 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.
--- drivers/rtc/rtc-rs5c372.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/rtc/rtc-rs5c372.c +1 -6
@@ -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 ];
Signature · 1 line
2.39.2
PATCH v2 5/6 rtc: rv8803: Remove use of i2c_match_id()
In reply to Andrew DavisThe 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.
--- drivers/rtc/rtc-rv8803.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/rtc/rtc-rv8803.c +1 -7
@@ -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 );
Signature · 1 line
2.39.2
PATCH v2 6/6 rtc: rx8025: Remove use of i2c_match_id()
In reply to Andrew DavisThe 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.
--- drivers/rtc/rtc-rx8025.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-rx8025.c +1 -3
@@ -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)
Signature · 1 line
2.39.2
Alexandre Belloni
maintainerQuoted 5 lines · Andrew Davis
Hello all,
RTC subsystem is one of the last still using
i2c_match_id(). This is a v2 but nothing is changed from last time. If I'm not sending this to the right folks let me know.
Do you mean that you intend to remove i2c_match_id from the kernel?
Quoted 23 lines
Thanks,
AndrewAndrew Davis (6):
rtc: abx80x: Remove use ofi2c_match_id()
rtc: m41t80: Remove use ofi2c_match_id()
rtc: pcf2127: Remove use ofi2c_match_id()
rtc: rs5c372: Remove use ofi2c_match_id()
rtc: rv8803: Remove use ofi2c_match_id()
rtc: rx8025: Remove use ofi2c_match_id()drivers/rtc/rtc-abx80x.c | 3 +-- drivers/rtc/rtc-m41t80.c | 8 +------- drivers/rtc/rtc-pcf2127.c | 23 +++++++---------------- drivers/rtc/rtc-rs5c372.c | 7 +------ drivers/rtc/rtc-rv8803.c | 8 +------- drivers/rtc/rtc-rx8025.c | 4 +--- 6 files changed, 12 insertions(+), 41 deletions(-)Signature · 1 line
2.39.2
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 9 lines · Alexandre Belloni
Quoted 5 lines · Andrew Davis
Hello all,
RTC subsystem is one of the last still using
i2c_match_id(). This is a v2 but nothing is changed from last time. If I'm not sending this to the right folks let me know.Do you mean that you intend to remove
i2c_match_idfrom the kernel?
Yes, once I remove all users in the various subsystems (like RTC), I'll remove it from the I2C headers.
It should be replaced with functions like i2c_get_match_data() for reasons given in the commit messages.
Andrew
Quoted 24 lines
Quoted 23 lines
Thanks,
AndrewAndrew Davis (6):
rtc: abx80x: Remove use of i2c_match_id() rtc: m41t80: Remove use of i2c_match_id() rtc: pcf2127: Remove use of i2c_match_id() rtc: rs5c372: Remove use of i2c_match_id() rtc: rv8803: Remove use of i2c_match_id() rtc: rx8025: Remove use of i2c_match_id()drivers/rtc/rtc-abx80x.c | 3 +-- drivers/rtc/rtc-m41t80.c | 8 +------- drivers/rtc/rtc-pcf2127.c | 23 +++++++---------------- drivers/rtc/rtc-rs5c372.c | 7 +------ drivers/rtc/rtc-rv8803.c | 8 +------- drivers/rtc/rtc-rx8025.c | 4 +--- 6 files changed, 12 insertions(+), 41 deletions(-)Signature · 1 line
2.39.2
Alexandre Belloni
maintainerQuoted 8 lines · Andrew Davis
Quoted 7 lines · Alexandre Belloni
Quoted 5 lines · Andrew Davis
Hello all,
RTC subsystem is one of the last still using
i2c_match_id(). This is a v2 but nothing is changed from last time. If I'm not sending this to the right folks let me know.
Quoted 8 lines
Quoted 2 lines
Do you mean that you intend to remove
i2c_match_idfrom the kernel?Yes, once I remove all users in the various subsystems (like RTC), I'll remove it from the I2C headers.
It should be replaced with functions like
i2c_get_match_data()for reasons given in the commit messages.
Ok, this should have been made clear in the original cover letter, the series would have looked a bit less like unnecessary churn.
Quoted 28 lines
Andrew
Quoted 24 lines
Quoted 23 lines
Thanks,
AndrewAndrew Davis (6):
rtc: abx80x: Remove use of i2c_match_id() rtc: m41t80: Remove use of i2c_match_id() rtc: pcf2127: Remove use of i2c_match_id() rtc: rs5c372: Remove use of i2c_match_id() rtc: rv8803: Remove use of i2c_match_id() rtc: rx8025: Remove use of i2c_match_id()drivers/rtc/rtc-abx80x.c | 3 +-- drivers/rtc/rtc-m41t80.c | 8 +------- drivers/rtc/rtc-pcf2127.c | 23 +++++++---------------- drivers/rtc/rtc-rs5c372.c | 7 +------ drivers/rtc/rtc-rv8803.c | 8 +------- drivers/rtc/rtc-rx8025.c | 4 +--- 6 files changed, 12 insertions(+), 41 deletions(-)Signature · 1 line
2.39.2
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 8 lines · Andrew Davis
RTC subsystem is one of the last still using
i2c_match_id(). This is a v2 but nothing is changed from last time. If I'm not sending this to the right folks let me know.Thanks,
Andrew[...]
Applied, thanks!
[1/6] rtc: abx80x: Remove use of i2c_match_id()
https://git.kernel.org/abelloni/c/652dc1328110 [2/6] rtc: m41t80: Remove use of i2c_match_id() https://git.kernel.org/abelloni/c/aade5f4bf9e2 [3/6] rtc: pcf2127: Remove use of i2c_match_id() https://git.kernel.org/abelloni/c/c85ac0b4d7c5 [4/6] rtc: rs5c372: Remove use of i2c_match_id() https://git.kernel.org/abelloni/c/022bfe69575d [5/6] rtc: rv8803: Remove use of i2c_match_id() https://git.kernel.org/abelloni/c/c79e6131b17e [6/6] rtc: rx8025: Remove use of i2c_match_id() https://git.kernel.org/abelloni/c/fbae853a00b4
Best regards,
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com