[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=WtVSQ5GX6H5CtxNPTdOAJVMj_xNRvG9siZB6_ePZr7CQ@mail.gmail.com>
Date: Fri, 13 Sep 2024 16:43:20 -0700
From: Doug Anderson <dianders@...omium.org>
To: Chen-Yu Tsai <wenst@...omium.org>
Cc: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, Wolfram Sang <wsa@...nel.org>,
Benson Leung <bleung@...omium.org>, Tzung-Bi Shih <tzungbi@...nel.org>,
Mark Brown <broonie@...nel.org>, Liam Girdwood <lgirdwood@...il.com>,
chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org, Johan Hovold <johan@...nel.org>,
Jiri Kosina <jikos@...nel.org>, Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-i2c@...r.kernel.org
Subject: Re: [PATCH v7 09/10] platform/chrome: Introduce device tree hardware prober
Hi,
On Wed, Sep 11, 2024 at 12:29 AM Chen-Yu Tsai <wenst@...omium.org> wrote:
>
> @@ -8,6 +8,7 @@ obj-$(CONFIG_CHROMEOS_ACPI) += chromeos_acpi.o
> obj-$(CONFIG_CHROMEOS_LAPTOP) += chromeos_laptop.o
> obj-$(CONFIG_CHROMEOS_PRIVACY_SCREEN) += chromeos_privacy_screen.o
> obj-$(CONFIG_CHROMEOS_PSTORE) += chromeos_pstore.o
> +obj-$(CONFIG_CHROMEOS_OF_HW_PROBER) += chromeos_of_hw_prober.o
"o" sorts before "p" so "of" should sort before "privacy"?
I guess it's not exactly all sorted, but this small section is. Since
it's arbitrary you could preserve the existing sorting. :-P
> +static const struct hw_prober_entry hw_prober_platforms[] = {
> + { .compatible = "google,hana", .prober = chromeos_i2c_component_prober, .data = &chromeos_i2c_probe_dumb_touchscreen },
> + { .compatible = "google,hana", .prober = chromeos_i2c_component_prober, .data = &chromeos_i2c_probe_dumb_trackpad },
The fact that the example is only using "dumb" probers doesn't make it
quite as a compelling proof that the code will scale up. Any chance
you could add something that requires a bit more oomph? ;-)
> +static int chromeos_of_hw_prober_driver_init(void)
> +{
> + size_t i;
> + int ret;
> +
> + for (i = 0; i < ARRAY_SIZE(hw_prober_platforms); i++)
> + if (of_machine_is_compatible(hw_prober_platforms[i].compatible))
> + break;
> + if (i == ARRAY_SIZE(hw_prober_platforms))
> + return -ENODEV;
> +
> + ret = platform_driver_register(&chromeos_of_hw_prober_driver);
> + if (ret)
> + return ret;
> +
> + chromeos_of_hw_prober_pdev =
> + platform_device_register_simple(DRV_NAME, PLATFORM_DEVID_NONE, NULL, 0);
> + if (IS_ERR(chromeos_of_hw_prober_pdev))
> + goto err;
FWIW if you didn't want to see your prober called over and over again
if one of the devices deferred you could just register one device per
type, right? Then each device would be able to defer separately. Dunno
if it's worth it but figured I'd mention it...
Also: as a high level comment, this all looks much nicer to me now
that it's parameterized. :-)
Powered by blists - more mailing lists