Hi Shimoda-san, On Thu, Dec 10, 2020 at 5:10 AM Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote: > > From: Geert Uytterhoeven, Sent: Wednesday, December 9, 2020 10:26 PM > > On Tue, Dec 8, 2020 at 9:06 AM Yoshihiro Shimoda > > <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote: > <snip> > > > index 80c6ef0..57bdb6a 100644 > > > --- a/drivers/mfd/bd9571mwv.c > > > +++ b/drivers/mfd/bd9571mwv.c > > > > > @@ -127,13 +137,12 @@ static int bd9571mwv_identify(struct bd9571mwv *bd) > > > ret); > > > return ret; > > > } > > > - > > > - if (value != BD9571MWV_PRODUCT_CODE_VAL) { > > > + /* Confirm the product code */ > > > + if (value != bd->data->product_code_val) { > > > dev_err(dev, "Invalid product code ID %02x (expected %02x)\n", > > > - value, BD9571MWV_PRODUCT_CODE_VAL); > > > + value, bd->data->product_code_val); > > > return -EINVAL; > > > } > > > > Reading the product code register, and checking the product code value > > can be removed, as bd9571mwv_probe() has verified it already. > > Indeed. I'll remove this. OK. > > > --- a/include/linux/mfd/bd9571mwv.h > > > +++ b/include/linux/mfd/bd9571mwv.h > > > + */ > > > +struct bd957x_data { > > > + int product_code_val; > > > > unsigned int? > > We can remove this member. True. > Or, keeping this member and then we check the product code by this member > instead of switch() like below? > > /* No build test, JFYI */ > struct bd957x_data *data_array[] = { > &bd9571mwv_data, > &bd9574mwf_data, > }; > > for (i = 0; I < ARRAY_SIZE(data_array); i++) { > if (val == data_array[i].product_code_val) { > bd->data = data_array[i]; > break; > } > } Given we probably won't have more than a handful variants, I'm leaning towards the switch() approach. 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