Message ID | 20230826171158.82219-1-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | regulator: sy8824x: Make similar OF and ID table | expand |
On Sat, Aug 26, 2023 at 06:11:58PM +0100, Biju Das wrote: > 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. ... > { } > }; > MODULE_DEVICE_TABLE(of, sy8824_dt_ids); ... > static const struct i2c_device_id sy8824_id[] = { > - { "sy8824", }, > + { "sy8824", (kernel_ulong_t)&sy8824c_cfg }, > { }, Here is even inconsistency with usage of trailing comma in the terminator entry. > };
Hi Andy Shevchenko, Thanks for the feedback. > Subject: Re: [PATCH] regulator: sy8824x: Make similar OF and ID table > > On Sat, Aug 26, 2023 at 06:11:58PM +0100, Biju Das wrote: > > 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. > > ... > > > { } > > }; > > MODULE_DEVICE_TABLE(of, sy8824_dt_ids); > > ... > > > static const struct i2c_device_id sy8824_id[] = { > > - { "sy8824", }, > > + { "sy8824", (kernel_ulong_t)&sy8824c_cfg }, > > > { }, > > Here is even inconsistency with usage of trailing comma in the terminator > entry. OK, it is carry over from original code. Will fix it in v2. Cheers, Biju
diff --git a/drivers/regulator/sy8824x.c b/drivers/regulator/sy8824x.c index d49c0cba09fb..58740a52ac08 100644 --- a/drivers/regulator/sy8824x.c +++ b/drivers/regulator/sy8824x.c @@ -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,28 +204,16 @@ 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);
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. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/regulator/sy8824x.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-)