From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH v1 1/1] math.h: Amend kernel-doc and add a note about signed type limits
Date: Mon, 10 Nov 2025 23:25:21 +0800 [thread overview]
Message-ID: <aRID4efkPf6x6Gqi@google.com> (raw)
In-Reply-To: <20251106152051.2361551-1-andriy.shevchenko@linux.intel.com>
On Thu, Nov 06, 2025 at 04:20:51PM +0100, Andy Shevchenko wrote:
> First of all, amend the existing kernel-doc so the description
> of the function is decoupled with the parameter descriptions.
> Second, add a note to explain behaviour for the signed types when
> supplied value is the minimum (e.g., INT_MIN for int type).
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> include/linux/math.h | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/math.h b/include/linux/math.h
> index 7fcb980677a0..c02cc5b9e6ae 100644
> --- a/include/linux/math.h
> +++ b/include/linux/math.h
> @@ -180,11 +180,16 @@ __STRUCT_FRACT(u32)
>
> /**
> * abs - return absolute value of an argument
> - * @x: the value. If it is unsigned type, it is converted to signed type first.
> - * char is treated as if it was signed (regardless of whether it really is)
> - * but the macro's return type is preserved as char.
> + * @x: the value.
> *
> - * Return: an absolute value of x.
> + * If it is unsigned type, @x is converted to signed type first.
> + * char is treated as if it was signed (regardless of whether it really is)
> + * but the macro's return type is preserved as char.
> + *
> + * NOTE, for signed type if @x is the minimum, the returned result is undefined
> + * as there is not enough bits to represent it as a positive number.
Nit: s/is/are
Otherwise, the patch is:
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Regards,
Kuan-Wei
> + *
> + * Return: an absolute value of @x.
> */
> #define abs(x) __abs_choose_expr(x, long long, \
> __abs_choose_expr(x, long, \
> --
> 2.50.1
>
>
next prev parent reply other threads:[~2025-11-10 15:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 15:20 [PATCH v1 1/1] math.h: Amend kernel-doc and add a note about signed type limits Andy Shevchenko
2025-11-10 15:25 ` Kuan-Wei Chiu [this message]
2025-11-10 15:35 ` 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=aRID4efkPf6x6Gqi@google.com \
--to=visitorckw@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jic23@kernel.org \
--cc=linux-kernel@vger.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 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.