Re: [PATCH v2 2/2] lib/string.c: Add wcslen()

From: Nathan Chancellor
Date: Wed Mar 26 2025 - 18:29:10 EST


On Wed, Mar 26, 2025 at 08:41:44PM +0200, Andy Shevchenko wrote:
> On Wed, Mar 26, 2025 at 8:39 PM Andy Shevchenko
> <andy.shevchenko@xxxxxxxxx> wrote:
> > On Wed, Mar 26, 2025 at 7:19 PM Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
>
> ...
>
> > > --- a/include/linux/string.h
> > > +++ b/include/linux/string.h
> > > @@ -7,6 +7,7 @@
> > > #include <linux/cleanup.h> /* for DEFINE_FREE() */
> > > #include <linux/compiler.h> /* for inline */
> > > #include <linux/types.h> /* for size_t */
> >
> > > +#include <linux/nls_types.h> /* for wchar_t */
> >
> > I know it's not ordered, but can we at least not make it worse, i.e.
> > squeeze this to be after the compiler.h? Or even somewhere after below
> > the err*.h? Whatever gives a better (sparsely) ordered overall
> > result...
>
> I just checked, and the only unordered piece is those two: types +
> stddef right now, and if you move nls_types.h after errno.h it will
> keep the status quo.
>
> > > #include <linux/stddef.h> /* for NULL */
> > > #include <linux/err.h> /* for ERR_PTR() */

Yeah, I had noticed there was no alphabetical consistency, so I decided
to use this place to keep the types together but I have no strong
opinion. I can send v3 tomorrow unless Kees is happy with this version
and is okay with just applying this diff on top.

Cheers,
Nathan

diff --git a/include/linux/string.h b/include/linux/string.h
index 4a48f8eac301..750715768a62 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -7,10 +7,10 @@
#include <linux/cleanup.h> /* for DEFINE_FREE() */
#include <linux/compiler.h> /* for inline */
#include <linux/types.h> /* for size_t */
-#include <linux/nls_types.h> /* for wchar_t */
#include <linux/stddef.h> /* for NULL */
#include <linux/err.h> /* for ERR_PTR() */
#include <linux/errno.h> /* for E2BIG */
+#include <linux/nls_types.h> /* for wchar_t */
#include <linux/overflow.h> /* for check_mul_overflow() */
#include <linux/stdarg.h>
#include <uapi/linux/string.h>