Message ID | 20230818165452.320984-2-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Kieran Bingham |
Headers | show |
Series | Match data improvements for it66121 driver | expand |
On Fri, Aug 18, 2023 at 05:54:51PM +0100, Biju Das wrote: > The driver has OF match table, still it uses ID lookup table for > retrieving match data. Currently the driver is working on the > assumption that a I2C device registered via OF will always match a > legacy I2C device ID. The correct approach is to have an OF device ID > table using of_device_match_data() if the devices are registered via OF. > Fixes: 9a9f4a01bdae ("drm: bridge: it66121: Move VID/PID to new it66121_chip_info structure") What is the problem? The match works either way with these compatible and i2c IDs.
Hi Andy Shevchenko, > Subject: Re: [PATCH v2 1/2] drm: bridge: it66121: Extend match support for > OF tables > > On Fri, Aug 18, 2023 at 05:54:51PM +0100, Biju Das wrote: > > The driver has OF match table, still it uses ID lookup table for > > retrieving match data. Currently the driver is working on the > > assumption that a I2C device registered via OF will always match a > > legacy I2C device ID. The correct approach is to have an OF device ID > > table using of_device_match_data() if the devices are registered via OF. > > > Fixes: 9a9f4a01bdae ("drm: bridge: it66121: Move VID/PID to new > > it66121_chip_info structure") > > What is the problem? > The match works either way with these compatible and i2c IDs. OK, will drop fixes tag as nothing is broken. Cheers, Biju
diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 466641c77fe9..ba95ad46e259 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1523,7 +1523,10 @@ static int it66121_probe(struct i2c_client *client) ctx->dev = dev; ctx->client = client; - ctx->info = (const struct it66121_chip_info *) id->driver_data; + if (dev_fwnode(&client->dev)) + ctx->info = of_device_get_match_data(&client->dev); + else + ctx->info = (const struct it66121_chip_info *) id->driver_data; of_property_read_u32(ep, "bus-width", &ctx->bus_width); of_node_put(ep); @@ -1609,13 +1612,6 @@ static void it66121_remove(struct i2c_client *client) mutex_destroy(&ctx->lock); } -static const struct of_device_id it66121_dt_match[] = { - { .compatible = "ite,it66121" }, - { .compatible = "ite,it6610" }, - { } -}; -MODULE_DEVICE_TABLE(of, it66121_dt_match); - static const struct it66121_chip_info it66121_chip_info = { .id = ID_IT66121, .vid = 0x4954, @@ -1628,6 +1624,13 @@ static const struct it66121_chip_info it6610_chip_info = { .pid = 0x0611, }; +static const struct of_device_id it66121_dt_match[] = { + { .compatible = "ite,it66121", &it66121_chip_info }, + { .compatible = "ite,it6610", &it6610_chip_info }, + { } +}; +MODULE_DEVICE_TABLE(of, it66121_dt_match); + static const struct i2c_device_id it66121_id[] = { { "it66121", (kernel_ulong_t) &it66121_chip_info }, { "it6610", (kernel_ulong_t) &it6610_chip_info },
The driver has OF match table, still it uses ID lookup table for retrieving match data. Currently the driver is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID. The correct approach is to have an OF device ID table using of_device_match_data() if the devices are registered via OF. Fixes: 9a9f4a01bdae ("drm: bridge: it66121: Move VID/PID to new it66121_chip_info structure") Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- v2: * New patch. --- drivers/gpu/drm/bridge/ite-it66121.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)