From mboxrd@z Thu Jan 1 00:00:00 1970 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: 8bit 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 --- 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, unsigned int base, unsigned lon return rv | overflow; } -noinline -unsigned int _parse_integer(const char *s, unsigned int base, unsigned long 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 +#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, unsigned long long *res, size_t max_chars); -unsigned int _parse_integer(const char *s, unsigned int base, unsigned long 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_ARGS__) #endif -- 2.50.1