Hi Biju, On Mon, Aug 21, 2023 at 10:53 AM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote: > > Subject: Re: [PATCH 2/2 RESEND] power: supply: sbs-battery: Convert enum- > > >pointer for data in the match tables > > On Mon, Aug 21, 2023 at 10:2 AM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > > wrote: > > > > On Sun, Aug 20, 2023 at 7:12 PM Biju Das > > > > <biju.das.jz@xxxxxxxxxxxxxx> > > > > wrote: > > > > > Convert enum->pointer for data in the match tables, so that > > > > > device_get_match_data() can do match against OF/ACPI/I2C tables, > > > > > once i2c bus type match support added to it and it returns NULL for > > non-match. > > > > > > > > > > Therefore it is better to convert enum->pointer for data match and > > > > > extend match support for both ID and OF tables using > > > > > i2c_get_match_data() by adding struct sbs_data with flags variable > > > > > and replacing flags->data in struct sbs_info. > > > > > > > > > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > > > > > > > > > --- a/drivers/power/supply/sbs-battery.c > > > > > +++ b/drivers/power/supply/sbs-battery.c > > > > > @@ -201,6 +201,10 @@ static const enum power_supply_property > > > > > string_properties[] = { > > > > > > > > > > #define NR_STRING_BUFFERS ARRAY_SIZE(string_properties) > > > > > > > > > > +struct sbs_data { > > > > > + u32 flags; > > > > > +}; > > > > > > > > Unless you plan to add more members to struct sbs_data, I see no > > > > point in this patch: it only increases kernel size. > > > > > > > > The various "data" members in <foo>_id structures are intended to > > > > contain either a pointer or a single integral value. > > > > > > The match data value for sbs_battery is 0. Here the API returns NULL > > > for a non-match. That is the reason it is converted to pointer. > > > > > > So, we cannot differentiate actual matched data and error in this case. > > > > If the driver's .probe() method is called, there must have been a valid > > match, so i2c_get_match_data() will never return NULL due to a non-match. > > I agree. but "return data" can be 0,if the matched value is 0 (for eg: here "sbs_battery"). Yes, so what is the problem? Zero is the expected value for these. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds