Re: [PATCH v8 7/8] platform/chrome: Introduce device tree hardware prober

From: Andy Shevchenko
Date: Mon Oct 14 2024 - 07:25:44 EST


On Mon, Oct 14, 2024 at 03:04:44PM +0800, Chen-Yu Tsai wrote:
> On Thu, Oct 10, 2024 at 11:29 PM Andy Shevchenko
> <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> > On Tue, Oct 08, 2024 at 03:34:26PM +0800, Chen-Yu Tsai wrote:

...

> > > +static const struct chromeos_i2c_probe_data chromeos_i2c_probe_hana_trackpad = {
> > > + .cfg = &chromeos_i2c_probe_simple_trackpad_cfg,
> >
> > .cfg = DEFINE_I2C_OF_PROBE_CFG(trackpad, i2c_of_probe_simple_ops),
> >
> > Or even
> >
> > #define DEFINE_I2C_OF_PROBE_CFG_SIMPLE(_type_) \
> > DEFINE_I2C_OF_PROBE_CFG(type, &i2c_of_probe_simple_ops)
> >
> > > + .opts = &(const struct i2c_of_probe_simple_opts) {
> >
> > Perhaps also DEFINE_xxx for this compound literal?
>
> I think it's better to leave this one as is.

Using a compound literal like this questions the entire approach.
Why you can't you drop it and use the static initializers?

> Not every entry will
> use the same combination of parameters. And having the entry spelled
> out like this makes it easier to read which value is for what
> parameter, instead of having to go up to the macro definition.
>
> For comparison, this entry uses just two of the parameters, while for
> another platform I'm working on the full set of parameters is needed.
>
> > > + .res_node_compatible = "elan,ekth3000",
> > > + .supply_name = "vcc",
> > > + /*
> > > + * ELAN trackpad needs 2 ms for H/W init and 100 ms for F/W init.
> > > + * Synaptics trackpad needs 100 ms.
> > > + * However, the regulator is set to "always-on", presumably to
> > > + * avoid this delay. The ELAN driver is also missing delays.
> > > + */
> > > + .post_power_on_delay_ms = 0,
> > > + }
> > > +};

--
With Best Regards,
Andy Shevchenko