Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Walmsley <pjw@kernel.org>
To: Paul Sherman <shermanpauldylan@gmail.com>
Cc: palmer@dabbelt.com, pjw@kernel.org, aou@eecs.berkeley.edu,
	alex@ghiti.fr,  hchauhan@ventanamicro.com,
	apatel@ventanamicro.com,  linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: sbi: fix errno mapping for SBI_ERR_ALREADY_* error codes
Date: Wed, 29 Jul 2026 12:43:30 -0600 (MDT)	[thread overview]
Message-ID: <8760a4fc-fde1-85be-174d-dc6dc6012265@kernel.org> (raw)
In-Reply-To: <20260727221508.5179-1-shermanpauldylan@gmail.com>

Hi,

On Mon, 27 Jul 2026, Paul Sherman wrote:

> SBI error codes SBI_ERR_ALREADY_AVAILABLE (-6), SBI_ERR_ALREADY_STARTED
> (-7), and SBI_ERR_ALREADY_STOPPED (-8) have no explicit case in
> sbi_err_map_linux_errno() and fall through to the default branch,
> returning -ENOTSUPP (-524).
> 
> Map these three codes to -EALREADY, which correctly reflects their
> semantics: the requested operation was not performed because the target
> is already in the desired state.

It looks like -EALREADY is defined as "connection already in progress," 
which doesn't quite map to the meaning of these errors, here.

https://en.cppreference.com/cpp/error/errno_macros

Does this patch fix anything or change any behavior?

> Also add a documentation comment enumerating all SBI error codes and
> their Linux errno mappings, making the translation table self-documenting
> and making any future omissions immediately visible.

I don't think the comment is a good idea; it creates one more artifact 
that can get out of sync with the code.  We'd just expect people to read 
the code, I think.


- Paul

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2026-07-29 18:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 22:15 [PATCH] riscv: sbi: fix errno mapping for SBI_ERR_ALREADY_* error codes Paul Sherman
2026-07-29 18:43 ` Paul Walmsley [this message]
2026-07-30  0:01   ` Paul Sherman

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=8760a4fc-fde1-85be-174d-dc6dc6012265@kernel.org \
    --to=pjw@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=hchauhan@ventanamicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=shermanpauldylan@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox