Skip to content

Commit fbc06a5

Browse files
bijudasalexandrebelloni
authored andcommitted
rtc: isl1208: Make similar I2C and DT-based matching table
The isl1208_id[].driver_data could store a pointer to the config, like for DT-based matching, making I2C and DT-based matching more similar. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20230623140948.384762-8-biju.das.jz@bp.renesas.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 380960c commit fbc06a5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/rtc/rtc-isl1208.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ static const struct isl1208_config {
9090
};
9191

9292
static const struct i2c_device_id isl1208_id[] = {
93-
{ "isl1208", TYPE_ISL1208 },
94-
{ "isl1209", TYPE_ISL1209 },
95-
{ "isl1218", TYPE_ISL1218 },
96-
{ "isl1219", TYPE_ISL1219 },
93+
{ "isl1208", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1208] },
94+
{ "isl1209", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1209] },
95+
{ "isl1218", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1218] },
96+
{ "isl1219", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1219] },
9797
{ }
9898
};
9999
MODULE_DEVICE_TABLE(i2c, isl1208_id);
@@ -822,9 +822,9 @@ isl1208_probe(struct i2c_client *client)
822822
} else {
823823
const struct i2c_device_id *id = i2c_match_id(isl1208_id, client);
824824

825-
if (id->driver_data >= ISL_LAST_ID)
825+
if (!id)
826826
return -ENODEV;
827-
isl1208->config = &isl1208_configs[id->driver_data];
827+
isl1208->config = (struct isl1208_config *)id->driver_data;
828828
}
829829

830830
isl1208->rtc = devm_rtc_allocate_device(&client->dev);

0 commit comments

Comments
 (0)