All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <briannorris@chromium.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH] power: supply: core: Ignore -EIO for uevent
Date: Thu, 25 Aug 2022 18:11:09 -0700	[thread overview]
Message-ID: <YwgdraBXTWk1DhCE@google.com> (raw)
In-Reply-To: <20220825140243.tgotqpymswduzlyy@mercury.elektranox.org>

Hi Sebastian,

Thanks for the response.

On Thu, Aug 25, 2022 at 04:02:43PM +0200, Sebastian Reichel wrote:
> > For uevents, we enumerate all properties. Some battery implementations
> > don't implement all standard properties, and may return -EIO for
> > properties that aren't recognized. This means we never report uevents
> > for such batteries.
> > 
> > It's better to ignore these errors and skip the property, as we do with
> > ENODATA and ENODEV.
> > 
> > Example battery implementation: Acer Chromebook Tab 10 (a.k.a. Google
> > Gru-Scarlet) has a virtual "SBS" battery implementation in its Embedded
> > Controller on top of an otherwise non-SBS battery.
> > 
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > ---
> 
> -EIO means input/output error. If a driver is reporting that for an
> unimplemented feature it's a bug that should be fixed in the driver.
> Handling it here means userspace ABI changes for temporary issues.

I suppose I can agree with your last sentence.

But the first part is much easier said than done. This is sbs-battery.c,
on top of i2c-cros-ec-tunnel.c, talking to an EC (whose firmware is
pretty much unchangeable at this point), which implements a subset of
commands.

The intention is that i2c-cros-ec-tunnel.c will see something like a NAK
/ "invalid argument" response, and it converts that to ENXIO.
Unforunately, for reasons I have yet to figure out, it's very common for
retries (|i2c_retry_count|) to eventually yield an unexpected response
size, which i2c_smbus_xfer_emulated() treats as EIO; so this layer is
seeing EIO.

Anyway, I might be able to coax the i2c/sbs-battery driver to return
ENXIO instead. Would you consider that to be a better case to handle
here? "No such device or address" seems like an appropriate description
of a permanent error, and not a temporary IO error.

Brian

  reply	other threads:[~2022-08-26  1:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 23:57 [PATCH] power: supply: core: Ignore -EIO for uevent Brian Norris
2022-08-25 14:02 ` Sebastian Reichel
2022-08-26  1:11   ` Brian Norris [this message]
2022-09-16 22:25     ` Sebastian Reichel

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=YwgdraBXTWk1DhCE@google.com \
    --to=briannorris@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sebastian.reichel@collabora.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.