Re: [PATCH] lib/list_sort: fix function type mismatches

From: Andy Shevchenko
Date: Sat Jan 11 2020 - 05:35:53 EST


On Sat, Jan 11, 2020 at 10:31 AM George Spelvin <lkml@xxxxxxx> 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).

>
> Andy Shevchenko posted a patch last 7 October that did that.
> <20191007135656.37734-1-andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> (You could also try taking a second look at why __pure doesn't work,
> per AKPM's message of 16 April
> <20190416154522.65aaa348161fc581181b56d9@xxxxxxxxxxxxxxxxxxxx>)

Hint: When you post Message-Id you may prefix them with
https://lore.kernel.org/r/ which makes search a bit more convenient
and faster.


--
With Best Regards,
Andy Shevchenko