Re: [PATCH] ALSA: fix function cast warnings

From: Arnd Bergmann
Date: Tue Feb 13 2024 - 08:31:30 EST


On Tue, Feb 13, 2024, at 13:56, Takashi Iwai wrote:
> On Tue, 13 Feb 2024 11:09:56 +0100,

>>
>> -int snd_rawmidi_receive(struct snd_rawmidi_substream *substream,
>> - const unsigned char *buffer, int count);
>> +int snd_rawmidi_receive(void *ptr, const void *buffer, int count);
>
> If it were only about the type of the buffer argument being a void
> pointer, it's fine. But the substream argument should be explicitly
> typed, otherwise it's confusing for other normal call patterns.
>
> I guess the suitable fix for now would be to provide wrapper functions
> that are used for callbacks and bridge to the actual function with
> pointer cast, something like below. Eventually we can put more const,
> but it's basically irrelevant with the warning itself.

Right, makes sense. I gave your patch a spin and it addresses the
warnings I saw in randconfig builds, so please apply that with
"Reported-by: Arnd Bergmann <arnd@xxxxxxxx>".

Arnd