Hi Biju,

On Mon, Aug 21, 2023 at 12:20:39PM +0000, Biju Das wrote:
> > Subject: Re: [PATCH] drm: bridge: it66121: Extend match support for OF 
> > tables
> > On Mon, Aug 14, 2023 at 09:06:46AM +0000, Biju Das wrote:
> > > > Subject: Re: [PATCH] drm: bridge: it66121: Extend match support for OF 
> > > > tables
> > > > On Sun, Aug 13, 2023 at 09:05:20AM +0100, Biju Das wrote:
> > > > > The driver has OF match table, still it uses ID lookup table for
> > > > > retrieving match data. Replace ID look up with
> > > > > i2c_get_match_data() for retrieving OF/ACPI/I2C match data by
> > > > > adding similar match data for OF table.
> > > >
> > > > Could you please explain in the commit message *why* this is desired ?
> > >
> > > 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()/device_match_data()/
> > > I2c_get_match_data() if the devices are registered via OF.
> > >
> > > Basically, it is fixing
> > >
> > > Fixes: 9a9f4a01bdae ("drm: bridge: it66121: Move VID/PID to new
> > > it66121_chip_info structure")
> > >
> > > But i2c_get_match_data() is recently introduced.
> > 
> > Thanks for the explanation. Could you record this in the commit message (if
> > not done already) ?
> > 
> > It would be really nice if we could drop the i2c_device_id...
> 
> The above suggestions are taken care in subsequent version [1]
> 
> [1] 
> https://lore.kernel.org/linux-renesas-soc/20230818191817.340360-1-biju.das...@bp.renesas.com/T/#t

Thank you.

> > > Maybe one patch with fixes tag using of_device_get_match_data and ID
> > > lookup for retrieving match data from OF/I2C tables
> > >
> > > and another patch to simplify using i2c_get_match_data() by replacing
> > > of_device_get_match_data and ID lookup.
> > 
> > I'm fine with a single patch.
> 
> Are you ok with [1] or want to squash with single patch?

I'm also OK with two patches, there's no need to go back and forth just
for this.

> > > > > While at it, drop unused local varibale id from probe().
> > > >
> > > > I'd drop this sentence, that's not a "while at it" change but an
> > > > integral part of this patch.
> > >
> > > Agreed.
> > >
> > > > > Signed-off-by: Biju Das <biju.das...@bp.renesas.com>
> > > > > ---
> > > > >  This patch is only compile tested.
> > > > > ---
> > > > >  drivers/gpu/drm/bridge/ite-it66121.c | 17 ++++++++---------
> > > > >  1 file changed, 8 insertions(+), 9 deletions(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/bridge/ite-it66121.c
> > > > > b/drivers/gpu/drm/bridge/ite-it66121.c
> > > > > index 466641c77fe9..a80246ef4ffe 100644
> > > > > --- a/drivers/gpu/drm/bridge/ite-it66121.c
> > > > > +++ b/drivers/gpu/drm/bridge/ite-it66121.c
> > > > > @@ -1501,7 +1501,6 @@ static const char * const it66121_supplies[]
> > > > > = {
> > > > >
> > > > >  static int it66121_probe(struct i2c_client *client)  {
> > > > > -     const struct i2c_device_id *id = 
> > > > > i2c_client_get_device_id(client);
> > > > >       u32 revision_id, vendor_ids[2] = { 0 }, device_ids[2] = { 0 };
> > > > >       struct device_node *ep;
> > > > >       int ret;
> > > > > @@ -1523,7 +1522,7 @@ static int it66121_probe(struct i2c_client 
> > > > > *client)
> > > > >
> > > > >       ctx->dev = dev;
> > > > >       ctx->client = client;
> > > > > -     ctx->info = (const struct it66121_chip_info *) id->driver_data;
> > > > > +     ctx->info = i2c_get_match_data(client);
> > > > >
> > > > >       of_property_read_u32(ep, "bus-width", &ctx->bus_width);
> > > > >       of_node_put(ep);
> > > > > @@ -1609,13 +1608,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 +1620,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 },

-- 
Regards,

Laurent Pinchart

Reply via email to