Re: [PATCH v2] i2c: Use u8 type in i2c transfer calls

From: Andy Shevchenko
Date: Wed Aug 03 2022 - 12:47:33 EST


On Wed, Aug 3, 2022 at 4:59 PM Jason Gerecke <killertofu@xxxxxxxxx> wrote:
>
> The 'i2c_transfer_buffer_flags' function (and related inlines) defines its

We refer to the functions like func() (without any quotes as well).

> 'buf' argument to be of type 'char*'. This is a poor choice of type given

char *

> that most callers actually pass a 'u8*' and that the function itself ends

most of the callers

u8 *

> up just storing the variable to a 'u8*'-typed member of 'struct i2c_msg'

u8 *

> anyway.
>
> Changing the type of the 'buf' argument to 'u8*' vastly reduces the number

u8 *

> of (admittedly usually-silent) Wpointer-sign warnings that are generated

-Wpointer-sign or replace with simple English words.

> as the types get needlessly juggled back and forth.
>
> At the same time, update the max1363 driver to match the new interface so
> we don't introduce a new Wincompatible-function-pointer-types warning.

-Wincompatible-function-pointer-types

...

> Changes in v2:
> - Added modifications to the max1363 driver required to avoid warnings

Have you really checked _all_ callers of APIs that you have changed here?

For example, drivers/media/usb/em28xx/em28xx-input.c still uses
unsigned char for i2c_master_recv().

I believe you need to create a coccinelle script and run it over the
kernel source tree and then create a patch out of it.

--
With Best Regards,
Andy Shevchenko