diff options
author | Biju Das <biju.das.jz@bp.renesas.com> | 2023-06-23 15:09:45 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2023-06-26 00:58:21 +0200 |
commit | fbc06a53561c64ec6d7f9a1b3bc04597de4cbb2d (patch) | |
tree | aa149a348f4b1ce6e19e88c18c701eb16c8b3c39 /drivers/rtc | |
parent | 380960c40a1d106bba3476c9a010eaf28195115d (diff) | |
download | lwn-fbc06a53561c64ec6d7f9a1b3bc04597de4cbb2d.tar.gz lwn-fbc06a53561c64ec6d7f9a1b3bc04597de4cbb2d.zip |
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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-isl1208.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index 6b3ff21084c5..cefff1d863ac 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -90,10 +90,10 @@ static const struct isl1208_config { }; static const struct i2c_device_id isl1208_id[] = { - { "isl1208", TYPE_ISL1208 }, - { "isl1209", TYPE_ISL1209 }, - { "isl1218", TYPE_ISL1218 }, - { "isl1219", TYPE_ISL1219 }, + { "isl1208", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1208] }, + { "isl1209", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1209] }, + { "isl1218", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1218] }, + { "isl1219", .driver_data = (kernel_ulong_t)&isl1208_configs[TYPE_ISL1219] }, { } }; MODULE_DEVICE_TABLE(i2c, isl1208_id); @@ -822,9 +822,9 @@ isl1208_probe(struct i2c_client *client) } else { const struct i2c_device_id *id = i2c_match_id(isl1208_id, client); - if (id->driver_data >= ISL_LAST_ID) + if (!id) return -ENODEV; - isl1208->config = &isl1208_configs[id->driver_data]; + isl1208->config = (struct isl1208_config *)id->driver_data; } isl1208->rtc = devm_rtc_allocate_device(&client->dev); |