[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vdpv57_3BixbJaxgWRDLNrB+j357TykSgr0jd5KWERAyg@mail.gmail.com>
Date: Sat, 11 Jan 2020 12:55:03 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: George Spelvin <lkml@....org>
Cc: samitolvanen@...gle.com, Andrew Morton <akpm@...ux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Kees Cook <keescook@...omium.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
Andrey Abramov <st5pub@...dex.ru>
Subject: Re: [PATCH] lib/list_sort: fix function type mismatches
On Sat, Jan 11, 2020 at 12:35 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
> On Sat, Jan 11, 2020 at 10:31 AM George Spelvin <lkml@....org> wrote:
> >
> > > typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *,
> > > - struct list_head const *, struct list_head const *);
> > > + struct list_head *, struct list_head *);
> >
> > I'd prefer to leave the const there for documentation.
>
> Not only. It's useful to show that we are not going to change those parameters.
>
> > Does anyone object to fixing it in the other direction by *adding*
> > const to all the call sites?
>
> Agree.
> Actually we have cmp_r_funct_t which might be used here (I didn't
> check for the possibility, though).
For the record, I have just checked users of list_sort() in regard to
constify of priv parameter and only ACPI HMAT is using it as not
const. UBIFS and XFS do not change the data (if I didn't miss
anything).
But the amount of changes there perhaps not worth of doing. So, maybe
new type like
cmp_w_func_t where priv is not const would be good enough for merge().
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists