From: Sakari Ailus <sakari.ailus@iki.fi>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
Paul Elder <paul.elder@ideasonboard.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Julien Stephan <jstephan@baylibre.com>,
devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v4 3/3] media: i2c: Add driver for THine THP7312
Date: Tue, 31 Oct 2023 10:45:32 +0000 [thread overview]
Message-ID: <ZUDatMX10WK0bdid@valkosipuli.retiisi.eu> (raw)
In-Reply-To: <20231030104241.GJ12144@pendragon.ideasonboard.com>
Hi Laurent,
On Mon, Oct 30, 2023 at 12:42:41PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
>
> On Mon, Oct 30, 2023 at 08:09:36AM +0000, Sakari Ailus wrote:
> > On Sat, Oct 28, 2023 at 06:18:58PM +0300, Laurent Pinchart wrote:
> > > On Fri, Oct 27, 2023 at 02:50:09PM +0000, Sakari Ailus wrote:
> > > > On Fri, Oct 27, 2023 at 03:45:29PM +0300, Laurent Pinchart wrote:
> > > >
> > > > ...
> > > >
> > > > > > > +#include <linux/clk.h>
> > > > > > > +#include <linux/delay.h>
> > > > > > > +#include <linux/device.h>
> > > > > > > +#include <linux/firmware.h>
> > > > > > > +#include <linux/gpio/consumer.h>
> > > > > > > +#include <linux/i2c.h>
> > > > > > > +#include <linux/init.h>
> > > > > > > +#include <linux/iopoll.h>
> > > > > > > +#include <linux/kernel.h>
> > > > > > > +#include <linux/module.h>
> > > > > > > +#include <linux/mtd/spi-nor.h>
> > > > > > > +#include <linux/of_device.h>
> > > > > > > +#include <linux/pm_runtime.h>
> > > > > > > +#include <linux/regulator/consumer.h>
> > > > > > > +#include <linux/slab.h>
> > > > > > > +#include <linux/thp7312.h>
> > > > > >
> > > > > > uapi/linux/thp7321.h ?
> > > > >
> > > > > Is that needed ?
> > > >
> > > > It's a UAPI header. Wouldn't it be reasonable to include it that way
> > > > (instead of relying on searching include/uapi as well)?
> > >
> > > There are some occurences of '#include <uapi/' in drivers/ (I counted
> > > 338), but why is that better ?
> >
> > I'd presume that at some point the -Iinclude/uapi will be cleaned up and
> > then the only option remains to include it from there directly. Why not to
> > do it already now?
>
> Will it be ? I've never heard of such a plan, but I may have missed it.
> I thought it was a feature meant to stay, and the recommended way to
> include headers in the uapi/ directory.
I'm not sure if anyone is cleaning that up actively but it seems like a
fairly obvious candidate for cleanup.
...
> > > > > > > + /*
> > > > > > > + * Register a device for the sensor, to support usage of the regulator
> > > > > > > + * API.
> > > > > > > + */
> > > > > > > + sensor->dev = kzalloc(sizeof(*sensor->dev), GFP_KERNEL);
> > > > > > > + if (!sensor->dev)
> > > > > > > + return -ENOMEM;
> > > > > > > +
> > > > > > > + sensor->dev->parent = dev;
> > > > > > > + sensor->dev->of_node = of_node_get(sensor->of_node);
> > > > > >
> > > > > > This device could well find its way to a non-OF system. Could you use the
> > > > > > fwnode property API instead?
> > > > >
> > > > > I'm pretty sure there will be problems if someone was using this driver
> > > > > on an ACPI-based system, so trying to pretend it's supported without
> > > > > being able to test it may not be the best use of development time. I'll
> > > > > try, but if I hit any issue, I'll keep using the OF-specific functions
> > > > > in the next version.
> > > >
> > > > I'd suggest to use OF functions if there's no corresponding fwnode function
> > > > available. The intention is they cover the same scope, so it is likely
> > > > something that's missing will be added sooner or later.
> > >
> > > I understand, but if the conversion is not complete, it's not very
> > > valuable. I have no objection against using the fwnode API in the
> > > driver, but I'll let someone else handle it when and if needed.
> >
> > If you leave it using OF-only API now in a driver that is not bound to OF
> > in any way, someone moving it to fwnode later may not be able to test it on
> > OF, increasing the likelihood something breaks. So use fwnode API where you
> > can now, and we'll address that one call later on.
>
> Sorry, this is extra work for very little gain (if any) now, so I don't
> plan to do so if I can't implement a full conversion.
I don't see why would you leave this for someone else to clean up later.
It's called "technical debt". Similarly, we have no ACPI-only sensor
drivers that would use ACPI specific functions that would not be available
on non-ACPI systems --- they've all used the fwnode API, missing just
regulators, clocks and GPIOs.
If you like, I think we could have an fwnode version of the same function,
to be used with DT binding compliant format for the device in ACPI DSDT.
Plain ACPI would have no need for the function.
Cc Andy, too.
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2023-10-31 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 13:21 [PATCH v4 0/3] media: i2c: Add driver for THine THP7312 ISP Laurent Pinchart
2023-10-17 13:21 ` [PATCH v4 1/3] dt-bindings: media: Add bindings " Laurent Pinchart
2023-10-18 15:02 ` Krzysztof Kozlowski
2023-10-27 11:55 ` Sakari Ailus
2023-10-27 12:19 ` Laurent Pinchart
[not found] ` <ZTuueXYFeEqqpD6Z@valkosipuli.retiisi.eu>
[not found] ` <20231027124634.GB19539@pendragon.ideasonboard.com>
[not found] ` <ZTvOtnbRrykdr7oW@valkosipuli.retiisi.eu>
[not found] ` <20231027153649.GE12144@pendragon.ideasonboard.com>
[not found] ` <ZTvk6RRXBQib_Qow@valkosipuli.retiisi.eu>
2023-10-28 15:21 ` Laurent Pinchart
2023-10-17 13:21 ` [PATCH v4 2/3] media: uapi: Add controls for the " Laurent Pinchart
2023-10-17 13:21 ` [PATCH v4 3/3] media: i2c: Add driver for THine THP7312 Laurent Pinchart
[not found] ` <ZTutbU1XG_jKZbIp@valkosipuli.retiisi.eu>
[not found] ` <20231027124529.GA19539@pendragon.ideasonboard.com>
[not found] ` <ZTvOIQSmpytUisUD@valkosipuli.retiisi.eu>
2023-10-28 15:18 ` Laurent Pinchart
2023-10-30 8:09 ` Sakari Ailus
2023-10-30 10:42 ` Laurent Pinchart
2023-10-31 10:45 ` Sakari Ailus [this message]
2023-10-31 13:41 ` Andy Shevchenko
2023-10-31 14:24 ` Laurent Pinchart
2023-10-31 16:43 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZUDatMX10WK0bdid@valkosipuli.retiisi.eu \
--to=sakari.ailus@iki.fi \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jstephan@baylibre.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=paul.elder@ideasonboard.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox