From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F24843E9D8 for ; Wed, 3 Jun 2026 11:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780485832; cv=none; b=nkpvMPCKz4F/HeHNGieTrcwsanuQ0cDr40eUWo1YPj2TZkJgUgOLqlJA3GoxZqI3HoZtOyqckPm0Pl3kvBVFAxqOIdRILbD4IqPWVIfAIcJjjDsI+sJJQ9p1Rmm8pXRetBCmFo6Fq3eKp2stwVKRAxoAQ2cHkAbUhZvkagR4wtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780485832; c=relaxed/simple; bh=gP/nrpLfELqL13R151ZyIvlhNXXmuzz41AkqAKskRUo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Dnytww0SXgBn8HHVrFo92Wpp9cVN6CLPY077mH8T1nuMah77fRd+QPaAq0eYqj0g9ZtZmnM+n13c1pe/TPV0IL9yevVs8Z0mAhU33D22+VmOr8ELdbYJPlsLYgpZ/0IiAAWGzZX1DPhSJvcQ05Owv6XT3PtyE/JnCxbUk/gIMG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=fJ9DR6BG; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="fJ9DR6BG" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-45eee266c6cso4845416f8f.1 for ; Wed, 03 Jun 2026 04:23:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780485828; x=1781090628; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=799pQoegvfClCvewLBdGKt3mJPZFGxVJrUYltfEZjQg=; b=fJ9DR6BGfDmFBdZZQ65GyZ1X55iaSDWFYlaC71qVdSoxoqQ6kad3xA678KuvYYp1Pk MbGb4Zx9m8g4V791+5+2NDqBmd/AY6KVI4wpZTR30Q1vmNiz+pHMPTrP5mpSQbcyuihx PFfnkOCylo5ATmINPmFCWELdhZTLGIY3JQqbGOSixEyo1+QqETuZYu5AldiPCUTX8gDq kawuzN8SYQppZ3I5EJ5Syv7SO+WI3AR57ANRzhPgHYUH5ruOk7BxLPuyg/uyBB48BtTk M6XfHbllTxkLzTHIFBAXZO/wOoWvlqbygp1wJxvD+W6IPNtbNjSjdE/QqcGqZXfvp45a sAiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780485828; x=1781090628; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=799pQoegvfClCvewLBdGKt3mJPZFGxVJrUYltfEZjQg=; b=ochwsdh4kx438g4hdMi3Q9CtI0p17y1UGLddl4Y6f/KrCM3K/3/jOkgKH+3ozvYavC 6ATRBQt7QdiELfKl/TsGd/ylzmTPp65A6t8CFbYFbS9SjYu96IYDC6czN+4H7wUd+Puz zP/Zluer/Yq9ObAya4la1laP3K0TkABxGu9XPSL+32H//V2U4xrgeqcEjqjatm/zBkkt ZYyZ8s8nCduzhCydXABh38+9KW8T1QiiDbXfJ+JXngv0s/N9bvdW4miVGzWRLX4SOzyw zBQ4kZRYjXDX2hrWpyIueeJRjkoavBvHTfLwQ3o60SMPpMAoOM5dutli3UXYqYM2qGBP Ex9w== X-Forwarded-Encrypted: i=1; AFNElJ8DEIzV3Zn1LQXmV82ldA/73IX5HpWavjcVIEeOW6Mvh76w0W2V7XjuPFmq7nt/zwd1TkJgd2K1PlfN+AA=@vger.kernel.org X-Gm-Message-State: AOJu0Yxy04L3q1cXOZGlXkBXFd2Psw3EEBVZVFt+Rk462pQs44WAAcoM X0syJN+wwnm1QBGnAAlSDcVYmOII6yjH0yDesB99KqpDitTRA/BeQ4x5KwZkmJHdasw= X-Gm-Gg: Acq92OE6sAVOek9usWX1c2oi5mXPCnVPdoQPCEGykk+oisAkUplrc0XbnHfRqSFuOQc pNPYxVtQgiTJBmaHwV8ddtVOk2udQ1dcNyHZ33P7mwF23t9XsYAeBX0F6aSmeZT079TY8flkJTW cJm3rZNBRe8LVlTKzLwwUqGlzHywUkBTV3L1/doj9iz1V2ATn3PKosn2tguY0hKvfycqcd3E1/g z/o9f0Sfz7figlttktFsPqxxkZYPjlrqkbR6jl+HZIkWuBC8MJWs4WrDwM+Fd9oanTs1Sb68Ff6 up48CbqFJZuxg6Z2bxfG5IUbT+8wErtjEDN6W7Sm0Yh1choS31Fqj/udu0FEF/fAFqXJh6OpxNW mRKD784zb91yVE9jB9J0+ODIF/VMjK/7AtxgbU7qIpa1ISj2Kqcl5jM3b4XjbCXUVD0ecMrJRD+ mK4jCIOm+zNs4ct+OoyYCF1abCgQ== X-Received: by 2002:a05:6000:1818:b0:45e:ef4a:819a with SMTP id ffacd0b85a97d-460218fdf9cmr3120489f8f.17.1780485827868; Wed, 03 Jun 2026 04:23:47 -0700 (PDT) Received: from pathway ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f35fd33sm7235611f8f.35.2026.06.03.04.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 04:23:47 -0700 (PDT) Date: Wed, 3 Jun 2026 13:23:45 +0200 From: Petr Mladek To: Andy Shevchenko Cc: Dmitry Antipov , linux-kernel@vger.kernel.org, Andrew Morton , Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , rodrigo.alencar@analog.com, dlechner@baylibre.com, jic23@kernel.org Subject: Re: [PATCH v1 0/2] kstrtox: make _parse_integer() flexible Message-ID: 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260602203706.103449-1-andriy.shevchenko@linux.intel.com> On Tue 2026-06-02 22:29:45, Andy Shevchenko wrote: > Currently every new wrapper on _parse_integer_limit() will need a new name > to share with users while keeping some optional arguments to be initialised > explicitly. Since there is an attempt to expand this more, I decided to > suggest this mini series to avoid namespace pollution and unneeded churn in > the future. > > To expand this API more, the possible future change may be: > > unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *res, > - size_t max_chars); > + size_t max_chars, $new_opt_arg); > > #define _parse_integer0(s, base, res, ...) \ > - _parse_integer_limit(s, base, res, INT_MAX); > + _parse_integer_limit(s, base, res, INT_MAX, $new_opt_arg=$default); > > #define _parse_integer1(s, base, res, max_chars, ...) \ > - _parse_integer_limit(s, base, res, max_chars); > + _parse_integer_limit(s, base, res, max_chars, $new_opt_arg=$default); > > +#define _parse_integer2(s, base, res, max_chars, new_opt_arg, ...) \ > + _parse_integer_limit(s, base, res, max_chars, new_opt_arg); I guess that this is about _parse_integer_limit_init() from https://lore.kernel.org/all/20260531-adf41513-iio-driver-v15-2-da09adf1c0dd@analog.com/ I personally find _parse_integer(*s, base. *res) _parse_integer_limit(*s, base, *res, max_chars) _parse_integer_limit_init(*s, base, init, *res, max_chars) a bit more self-explanatory than _parse_integer(*s, base. *res) _parse_integer(*s, base, *res, max_chars) _parse_integer(*s, base, *res, max_chars, init) especially when the meaning of the arguments need not be obvious when the function is used in the code. Also the macro magic increases the complexity of the code. On the other hand, I do not have strong opinion. It is not a big deal. I am not going to block it. > So you got the idea. (It is roughly overloaded function in OOP.) Best Regards, Petr