[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zry0ILkU4VrL3Mms@smile.fi.intel.com>
Date: Wed, 14 Aug 2024 16:41:52 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
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,
Douglas Anderson <dianders@...omium.org>,
Johan Hovold <johan@...nel.org>, Jiri Kosina <jikos@...nel.org>,
linux-i2c@...r.kernel.org
Subject: Re: [PATCH v4 5/6] platform/chrome: Introduce device tree hardware
prober
On Wed, Aug 14, 2024 at 06:10:03PM +0800, Chen-Yu Tsai wrote:
> On Tue, Aug 13, 2024 at 7:46 PM Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com> wrote:
> > On Thu, Aug 08, 2024 at 05:59:28PM +0800, Chen-Yu Tsai wrote:
...
> > > +static void chromeos_of_hw_prober_driver_exit(void)
> > > +{
> > > + if (!chromeos_of_hw_prober_pdev)
> > > + return;
> >
> > First of all, this is dup for the next call, second, when may this conditional
> > be true?
>
> When the module is loaded on a machine that doesn't match any entry,
> neither the driver nor the device are registered. Hence the check.
>
> Or maybe the proper way to handle it is to return -ENODEV or something?
> I'll work towards that.
The rule of thumb is the _exit() is called when your _init() finished with
success. This conditional seems confusing and likely reveals the logic issue
in _init(). Yes, _init() needs to return an error when there is no devices are
registered or expected to be registered. If there are devices that may appear
later on, this should be split to pure device driver and board file that
instantiate device for the known cases.
> > > + platform_device_unregister(chromeos_of_hw_prober_pdev);
> > > + platform_driver_unregister(&chromeos_of_hw_prober_driver);
> > > +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists