Re: [RFC PATCH v3 3/5] platform/chrome: Introduce device tree hardware prober

From: Doug Anderson
Date: Fri Dec 01 2023 - 20:07:03 EST


Hi,

On Tue, Nov 28, 2023 at 12:45 AM Chen-Yu Tsai <wenst@xxxxxxxxxxxx> wrote:
>
> @@ -61,6 +61,17 @@ config CHROMEOS_TBMC
> To compile this driver as a module, choose M here: the
> module will be called chromeos_tbmc.
>
> +config CHROMEOS_OF_HW_PROBER
> + bool "ChromeOS Device Tree Hardware Prober"

Any reason that it can't be a module?


> + depends on OF
> + depends on I2C
> + select OF_DYNAMIC
> + default OF

You probably don't want "default OF". This means that everyone will
automatically get this new driver enabled which is unlikely to be
right.


> +static int chromeos_of_hw_prober_probe(struct platform_device *pdev)
> +{
> + for (size_t i = 0; i < ARRAY_SIZE(hw_prober_platforms); i++)
> + if (of_machine_is_compatible(hw_prober_platforms[i].compatible)) {
> + int ret;
> +
> + ret = hw_prober_platforms[i].prober(&pdev->dev,
> + hw_prober_platforms[i].data);
> + if (ret)

Should it only check for -EPROBE_DEFER here? ...and then maybe warn
for other cases and go through the loop? If there's some error
enabling the touchscreen I'd still want the trackpad to probe...


> + return ret;
> + }
> +
> + return 0;

Random thought: once we get here, the driver is useless / just wasting
memory. Any way to have it freed? ;-)