From nobody Mon Jun 8 05:24:57 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4181638333F for ; Tue, 2 Jun 2026 20:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432636; cv=none; b=D/zwIRRoI8sZaFWDb/aEpKqySWjpmaJYtOh5DxeC1i122SHgSy+OYkt1ON3RQodLnqJv1/PPdVZK5tYxfx3xeFkLsjZ2urFuOvrdIT4eK8+YtY5s2pw9MIxS7lnL4TId83RIjByquM9CGHv2nr+aiX98Jx1qSlmim5iM1iUoNxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432636; c=relaxed/simple; bh=7B9A4fkCckeQK+Jj9pWmNn7b6nxmfuNUeVbvWCcDE7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SYFaPtRdi1J7fju5ELQo2MeVB9OaKF+/mnfe5M1kXMNdVpZ9mnuZJgXXJ6hREB+tmpyIDZ/uoQawrY6a5e5ZyQt4mG7+O6nhU/FwQo35mJPVRqVfq36VWc1eu84IayJM5iZlMF4Qr0qx+G0daHpnQkB5VF8vxa9Ymdvw8F+X9Pw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=A/Bwdf6O; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="A/Bwdf6O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780432635; x=1811968635; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7B9A4fkCckeQK+Jj9pWmNn7b6nxmfuNUeVbvWCcDE7k=; b=A/Bwdf6OKLUkQW5mCW8Pe8oFDvTSuem0hJJfpsPEPGgau/wNzCM9L2bu i/2B0gF8XyZyfBo+Dq5xyRZNGSOlD2RA0Q1tGh8Qp6tHxDKKRqLnOl72x HsABoSNE/IzxXguthih/3Rye+e9seiZXATRsdhKvGBrZ4zE+OZkcZqupv vWq7RtCU+bKP0dfYcFgIrafVmJXlEJBtYGu1fBueP3as+ZHWYkbaZ8UAj 8PJyMoP+/RUq6GYc5ZRJzr59cdIMaOIIwG75z7DDejPBT+DLhM1fTq/TA NSql0oQPBO60M7iDVj1TS/8zDxQTBs4tpcpVFx40hhmFI7KhqA1lWyBuS A==; X-CSE-ConnectionGUID: QSHzuODlRRCk3rqYG7Pk0w== X-CSE-MsgGUID: DGtXLMZHSXCu1kGdOGeWtw== X-IronPort-AV: E=McAfee;i="6800,10657,11805"; a="81227209" X-IronPort-AV: E=Sophos;i="6.24,183,1774335600"; d="scan'208";a="81227209" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2026 13:37:13 -0700 X-CSE-ConnectionGUID: 1lvmbTLZT86EEZTyy8N6AQ== X-CSE-MsgGUID: 4mC4TCkFQgqcTnkrpKsqAQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,183,1774335600"; d="scan'208";a="248940437" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa005.jf.intel.com with ESMTP; 02 Jun 2026 13:37:10 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 1D40C98; Tue, 02 Jun 2026 22:37:09 +0200 (CEST) From: Andy Shevchenko To: Dmitry Antipov , Andy Shevchenko , Petr Mladek , linux-kernel@vger.kernel.org Cc: Andrew Morton , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , rodrigo.alencar@analog.com, dlechner@baylibre.com, jic23@kernel.org Subject: [PATCH v1 1/2] kstrtox: Make _parse_integer() take variadic arguments Date: Tue, 2 Jun 2026 22:29:46 +0200 Message-ID: <20260602203706.103449-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com> References: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having different functions that just use default parameters, combine those to use variadic arguments, so the user may call it using the same name. Signed-off-by: Andy Shevchenko Acked-by: Petr Mladek --- lib/kstrtox.c | 6 ------ lib/kstrtox.h | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/kstrtox.c b/lib/kstrtox.c index edc4eb7c1bca..adc03e27e4a2 100644 --- a/lib/kstrtox.c +++ b/lib/kstrtox.c @@ -94,12 +94,6 @@ unsigned int _parse_integer_limit(const char *s, unsigne= d int base, unsigned lon return rv | overflow; } =20 -noinline -unsigned int _parse_integer(const char *s, unsigned int base, unsigned lon= g long *p) -{ - return _parse_integer_limit(s, base, p, INT_MAX); -} - static int _kstrtoull(const char *s, unsigned int base, unsigned long long= *res) { unsigned long long _res; diff --git a/lib/kstrtox.h b/lib/kstrtox.h index 158c400ca865..6c7ca3b67429 100644 --- a/lib/kstrtox.h +++ b/lib/kstrtox.h @@ -2,10 +2,17 @@ #ifndef _LIB_KSTRTOX_H #define _LIB_KSTRTOX_H =20 +#include + #define KSTRTOX_OVERFLOW (1U << 31) const char *_parse_integer_fixup_radix(const char *s, unsigned int *base); unsigned int _parse_integer_limit(const char *s, unsigned int base, unsign= ed long long *res, size_t max_chars); -unsigned int _parse_integer(const char *s, unsigned int base, unsigned lon= g long *res); + +#define _parse_integer0(s, base, res, ...) \ + _parse_integer_limit(s, base, res, INT_MAX); + +#define _parse_integer(s, base, res, ...) \ + CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_A= RGS__) =20 #endif --=20 2.50.1 From nobody Mon Jun 8 05:24:57 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3068D37F742 for ; Tue, 2 Jun 2026 20:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432635; cv=none; b=sy2X7of72yVFpI2xi0Zsc7w+nf2FtdU/CZxJ/yQint1VcrU7WWPn2Nyo/evT99sj/H4fLLJt7DPz+MsW0Ox1txJsN44ZLjpeDZK4moSBDHpASpYcKaxyoWh9lq85/KO/W297sGSlFutQQ+PbsX7qwH5aoawCW9PC00no5hC/DBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780432635; c=relaxed/simple; bh=HL0z7gxJYesR2g6T6tinyieUGKKjFVCsKLGvIxwVjuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nWmAA4x0rYJu+dKUuHYD9gL591W5p/2AN0dKVnqC1q47uWVh/HrLINoBEdYRwzVr050K2jvSvaMqrkw1TcjJ1Pqtaj3ZKxkMX7r0NvUTfjH2eErSAS4ru9dMHXt1Wj0CRVuoiwZLBD8IBa5GsYrwt30x1n+Ytxuxmy+VeeIlkP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=kf/BCziU; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kf/BCziU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780432633; x=1811968633; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HL0z7gxJYesR2g6T6tinyieUGKKjFVCsKLGvIxwVjuU=; b=kf/BCziUAngiowYwIY0lmr+G1Q9f6ajgN8YmL0FdvxqEHQ0Roev+F0FZ QUFvH9SHQEZeX7q6OaaWa/HnGIiU3k0AUKuHXr3jFe+6DmjoSV6tZRK+1 isfayF8WuwApGb99Z8njn3lFnrjh3jjDI7YKE1fOV5oK1Y1NokVtmyL4A jEoJC2IXl4wTqgzbAYVJzXA+gZyWjGJm7G/7BMlvrdZdfxA6uhxinJ7Av 7i1QXpjmOGSYBNNcoEWPZ/0nHOWcv3jCqBB7StTMxwaCFBN7G2jtn3y9b TGjXM7CYYEpHimfSniYXKj1PZls1Gg208cyfW40JiRLcj/b0CMa4PuUEC g==; X-CSE-ConnectionGUID: RleGhqJST/G/hfnCR89Kkg== X-CSE-MsgGUID: 3juDMZFAQGOkeSZX02CSMA== X-IronPort-AV: E=McAfee;i="6800,10657,11805"; a="81227219" X-IronPort-AV: E=Sophos;i="6.24,183,1774335600"; d="scan'208";a="81227219" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2026 13:37:13 -0700 X-CSE-ConnectionGUID: azZBPNs+Sdq6TykSHadqQw== X-CSE-MsgGUID: l+uANhteR+2IRo1vVhe3Xg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,183,1774335600"; d="scan'208";a="248940436" Received: from black.igk.intel.com ([10.91.253.5]) by orviesa005.jf.intel.com with ESMTP; 02 Jun 2026 13:37:10 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 21C5699; Tue, 02 Jun 2026 22:37:09 +0200 (CEST) From: Andy Shevchenko To: Dmitry Antipov , Andy Shevchenko , Petr Mladek , linux-kernel@vger.kernel.org Cc: Andrew Morton , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , rodrigo.alencar@analog.com, dlechner@baylibre.com, jic23@kernel.org Subject: [PATCH v1 2/2] vsprintf: Convert to use _parse_integer() instead of _parse_integer_limit() Date: Tue, 2 Jun 2026 22:29:47 +0200 Message-ID: <20260602203706.103449-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com> References: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use _parse_integer() that allows optional arguments to be explicitly initialised. Signed-off-by: Andy Shevchenko Acked-by: Petr Mladek --- lib/kstrtox.h | 3 +++ lib/vsprintf.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/kstrtox.h b/lib/kstrtox.h index 6c7ca3b67429..4299b1f92133 100644 --- a/lib/kstrtox.h +++ b/lib/kstrtox.h @@ -12,6 +12,9 @@ unsigned int _parse_integer_limit(const char *s, unsigned= int base, unsigned lon #define _parse_integer0(s, base, res, ...) \ _parse_integer_limit(s, base, res, INT_MAX); =20 +#define _parse_integer1(s, base, res, max_chars, ...) \ + _parse_integer_limit(s, base, res, max_chars); + #define _parse_integer(s, base, res, ...) \ CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_A= RGS__) =20 diff --git a/lib/vsprintf.c b/lib/vsprintf.c index a3017bc58986..1389b50266bf 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -86,7 +86,7 @@ static unsigned long long simple_strntoull(const char *st= artp, char **endp, unsi cp =3D _parse_integer_fixup_radix(startp, &base); prefix_chars =3D cp - startp; if (prefix_chars < max_chars) { - rv =3D _parse_integer_limit(cp, base, &result, max_chars - prefix_chars); + rv =3D _parse_integer(cp, base, &result, max_chars - prefix_chars); /* FIXME */ cp +=3D (rv & ~KSTRTOX_OVERFLOW); } else { --=20 2.50.1