rtc: abx80x: Remove use of i2c_match_id()
PATCH 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
PATCH 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
@@ -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,
Signature · 1 line
2.39.2
PATCH 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 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 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 2/6 rtc: m41t80: 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-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