lkml.org 
[lkml]   [2020]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] lib/list_sort: fix function type mismatches
On Sat, Jan 11, 2020 at 12:35 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Sat, Jan 11, 2020 at 10:31 AM George Spelvin <lkml@sdf.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

\
 
 \ /
  Last update: 2020-01-11 11:56    [W:0.092 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site