[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXv+5Hz3wfjCRa2AiOQgOv7zo8bzAmtG=a=jWJhO2MZNrFtpw@mail.gmail.com>
Date: Mon, 4 Dec 2023 15:24:42 +0800
From: Chen-Yu Tsai <wenst@...omium.org>
To: Doug Anderson <dianders@...omium.org>
Cc: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
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>,
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>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
andriy.shevchenko@...ux.intel.com, Jiri Kosina <jikos@...nel.org>,
linus.walleij@...aro.org, broonie@...nel.org,
gregkh@...uxfoundation.org, hdegoede@...hat.com,
james.clark@....com, james@...iv.tech, keescook@...omium.org,
rafael@...nel.org, tglx@...utronix.de,
Jeff LaBundy <jeff@...undy.com>, linux-input@...r.kernel.org,
linux-i2c@...r.kernel.org
Subject: Re: [RFC PATCH v3 3/5] platform/chrome: Introduce device tree
hardware prober
On Sat, Dec 2, 2023 at 8:58 AM Doug Anderson <dianders@...omium.org> wrote:
>
> Hi,
>
> On Tue, Nov 28, 2023 at 12:45 AM Chen-Yu Tsai <wenst@...omium.org> 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?
No technical one. However if it's a module, the user has to manually load
it. So I think it's more of a usability thing.
OOTH I think this needs to be a module if I2C is built as a module.
Somehow I had thought of it at one point but then it slipped my mind.
> > + 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.
I thought this whole section was guarded behind KCONFIG_CHROME_PLATFORMS.
So if the user has CHROME_PLATFORMS enabled and has OF enabled, they
likely need the prober.
> > +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...
Makes sense. However there's no extra information to give in the
warning though.
> > + return ret;
> > + }
> > +
> > + return 0;
>
> Random thought: once we get here, the driver is useless / just wasting
> memory. Any way to have it freed? ;-)
I don't think there is a good way to do that, except maybe marking all
the functions as __init? But that likely doesn't work in combination
with deferred probing (say the i2c driver is a module).
ChenYu
Powered by blists - more mailing lists