All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Prabhakar <prabhakar.csengg@gmail.com>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil@xs4all.nl>, Shawn Tu <shawnx.tu@intel.com>,
	Jacopo Mondi <jacopo@jmondi.org>,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH v2 4/5] media: i2c: ov5645: Return zero for s_stream(0)
Date: Mon, 17 Oct 2022 07:12:10 +0000	[thread overview]
Message-ID: <Y00ASntfSkMsWTN0@paasikivi.fi.intel.com> (raw)
In-Reply-To: <Y0xxlTP53dwx8VD+@pendragon.ideasonboard.com>

On Mon, Oct 17, 2022 at 12:03:17AM +0300, Laurent Pinchart wrote:
> Hi Sakari,
> 
> On Sun, Oct 16, 2022 at 08:19:40PM +0000, Sakari Ailus wrote:
> > On Sun, Oct 16, 2022 at 02:23:13AM +0300, Laurent Pinchart wrote:
> > > On Sat, Oct 15, 2022 at 09:35:12PM +0000, Sakari Ailus wrote:
> > > > On Sat, Oct 15, 2022 at 09:25:37AM +0300, Laurent Pinchart wrote:
> > > > > On Fri, Oct 14, 2022 at 07:34:58PM +0100, Prabhakar wrote:
> > > > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > > > > 
> > > > > > Always return zero while stopping the stream as the caller will ignore the
> > > > > > return value.
> > > > > > 
> > > > > > This patch drops checking the return value of ov5645_write_reg() and
> > > > > > continues further in the code path while stopping stream. The user anyway
> > > > > > gets an error message in case ov5645_write_reg() fails.
> > > > > 
> > > > > Continuing all the way to pm_runtime_put() is fine, but I don't think
> > > > > the function should return 0. It's not up to the driver to decide if a
> > > > > failure would be useful to signal to the caller or not.
> > > > 
> > > > If the function returns an error when disabling streaming, what is the
> > > > expected power state of the device after this?
> > > 
> > > That's up to us to decide :-)
> > > 
> > > > The contract between the caller and the callee is that the state is not
> > > > changed if there is an error.
> > > 
> > > For most APIs, but that's not universal.
> > > 
> > > > This is a special case as very few callers
> > > > check the return value for streamoff operation and those that do generally
> > > > just print something. I've never seen a caller trying to prevent streaming
> > > > off in this case, for instance.
> > > 
> > > I think the stream off call should proceed and try to power off the
> > > device even if an error occurs along the way, i.e. it shouldn't return
> > > upon the first detected error.
> > > 
> > > > Of course we could document that streaming off always counts as succeeded
> > > > (e.g. decreasing device's runtime PM usage_count) while it could return an
> > > > informational error code. But I wonder if anyone would ever benefit from
> > > > that somehow. :-)
> > > 
> > > I think it could be useful to propagate errors up to inform the user
> > > that something wrong happened. That would involve fixing lots of drivers
> > > along the call chain though, so there's no urgency for the ov5645 to do
> > > so, but isn't it better to propagate the error code instead of hiding
> > > the issue ?
> > 
> > I also don't think hiding the issue would be the best thing to do, but that
> > wouldn't likely be a big problem either.
> > 
> > How about printing a warning in the wrapper while returning zero to the
> > original caller? This would keep the API intact while still leaving a trace
> > on something failing. Of course the driver is also free to print whatever
> > messages it likes.
> 
> While I think error propagation could be more useful in the long run,
> printing a message in the wrapper is a good idea. I like centralized
> error handling, it has a tendency to go wrong when left to individual
> drivers.

I can send a patch...

-- 
Sakari Ailus

  reply	other threads:[~2022-10-17  7:12 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 18:34 [PATCH v2 0/5] media: i2c: ov5645 driver enhancements Prabhakar
2022-10-14 18:34 ` [PATCH v2 1/5] media: dt-bindings: ov5645: Convert OV5645 binding to a schema Prabhakar
2022-10-14 21:00   ` Rob Herring
2022-10-14 21:05   ` Rob Herring
2022-10-14 21:27     ` Lad, Prabhakar
2022-10-14 21:40       ` Rob Herring
2022-10-15  5:54         ` Laurent Pinchart
2022-10-15 13:17           ` Krzysztof Kozlowski
2022-10-17  7:43             ` Lad, Prabhakar
2022-10-26 16:56           ` Rob Herring
2022-10-14 18:34 ` [PATCH v2 2/5] media: i2c: ov5645: Use runtime PM Prabhakar
2022-10-14 19:18   ` Sakari Ailus
2022-10-14 21:30     ` Lad, Prabhakar
2022-10-15  6:05     ` Laurent Pinchart
2022-10-15  6:25       ` Laurent Pinchart
2022-10-26 12:07         ` Lad, Prabhakar
2022-10-27 11:20   ` Sakari Ailus
2022-10-27 12:01     ` Lad, Prabhakar
2022-10-27 12:47       ` Sakari Ailus
2022-10-27 16:32         ` Lad, Prabhakar
2022-10-27 18:37           ` Sakari Ailus
2022-10-28 21:05             ` Lad, Prabhakar
2022-10-31 14:25             ` Sakari Ailus
2022-10-31 16:10               ` Lad, Prabhakar
2022-10-14 18:34 ` [PATCH v2 3/5] media: i2c: ov5645: Drop empty comment Prabhakar
2022-10-15  6:05   ` Laurent Pinchart
2022-10-14 18:34 ` [PATCH v2 4/5] media: i2c: ov5645: Return zero for s_stream(0) Prabhakar
2022-10-15  6:25   ` Laurent Pinchart
2022-10-15 21:35     ` Sakari Ailus
2022-10-15 23:23       ` Laurent Pinchart
2022-10-16 20:19         ` Sakari Ailus
2022-10-16 21:03           ` Laurent Pinchart
2022-10-17  7:12             ` Sakari Ailus [this message]
2022-10-17  7:40               ` Lad, Prabhakar
2022-10-14 18:34 ` [PATCH v2 5/5] media: i2c: ov5645: Call ov5645_entity_init_cfg() before registering the subdev Prabhakar
2022-10-15  6:26   ` Laurent Pinchart
2022-10-26 11:59     ` Lad, Prabhakar
2022-10-14 18:40 ` [PATCH v2 0/5] media: i2c: ov5645 driver enhancements Lad, Prabhakar

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=Y00ASntfSkMsWTN0@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnx.tu@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.