regulator: sy8824x: Make similar OF and ID table
authorBiju Das <biju.das.jz@bp.renesas.com>
Mon, 28 Aug 2023 16:54:47 +0000 (17:54 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 11 Sep 2023 00:31:24 +0000 (01:31 +0100)
Make similar OF and ID table to extend support for ID match using
i2c_match_data(). Currently it works only for OF match tables as the
driver_data is wrong for ID match.

While at it, drop trailing comma in the terminator entry from ID
table.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230828165447.106058-1-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/sy8824x.c

index d49c0cba09fbdbb744349c4f2f85a8444d94bec1..c05b67e26ac85636edea9901209dae168bbb4b7a 100644 (file)
@@ -142,7 +142,7 @@ static int sy8824_i2c_probe(struct i2c_client *client)
        }
 
        di->dev = dev;
-       di->cfg = of_device_get_match_data(dev);
+       di->cfg = i2c_get_match_data(client);
 
        regmap = devm_regmap_init_i2c(client, di->cfg->config);
        if (IS_ERR(regmap)) {
@@ -204,29 +204,17 @@ static const struct sy8824_config sy20278_cfg = {
 };
 
 static const struct of_device_id sy8824_dt_ids[] = {
-       {
-               .compatible = "silergy,sy8824c",
-               .data = &sy8824c_cfg
-       },
-       {
-               .compatible = "silergy,sy8824e",
-               .data = &sy8824e_cfg
-       },
-       {
-               .compatible = "silergy,sy20276",
-               .data = &sy20276_cfg
-       },
-       {
-               .compatible = "silergy,sy20278",
-               .data = &sy20278_cfg
-       },
+       { .compatible = "silergy,sy8824c", .data = &sy8824c_cfg },
+       { .compatible = "silergy,sy8824e", .data = &sy8824e_cfg },
+       { .compatible = "silergy,sy20276", .data = &sy20276_cfg },
+       { .compatible = "silergy,sy20278", .data = &sy20278_cfg },
        { }
 };
 MODULE_DEVICE_TABLE(of, sy8824_dt_ids);
 
 static const struct i2c_device_id sy8824_id[] = {
-       { "sy8824", },
-       { },
+       { "sy8824", (kernel_ulong_t)&sy8824c_cfg },
+       { }
 };
 MODULE_DEVICE_TABLE(i2c, sy8824_id);