Hi Wolfram, Thanks for the feedback. > -----Original Message----- > From: Wolfram Sang <wsa@xxxxxxxxxx> > Sent: Monday, June 5, 2023 10:25 AM > To: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>; Alexandre Belloni > <alexandre.belloni@xxxxxxxxxxx>; linux-i2c@xxxxxxxxxxxxxxx; linux- > rtc@xxxxxxxxxxxxxxx; Geert Uytterhoeven <geert+renesas@xxxxxxxxx>; > Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>; linux- > renesas-soc@xxxxxxxxxxxxxxx > Subject: Re: [PATCH v2] i2c: Add i2c_get_match_data() > > > > + if (client->dev.of_node) > > config = of_device_get_match_data(&client->dev); > > Has it been considered adding this check to the new helper function as > well? Saves even more boilerplate code, I'd think. You mean like below?? The new helper function will do both I2C and DT-based matching?? const void *i2c_get_match_data(const struct i2c_client *client) { struct device_driver *drv = client->dev.driver; struct i2c_driver *driver = to_i2c_driver(drv); const struct i2c_device_id *match; const void *match_data; if (client->dev.of_node){ match_data = of_device_get_match_data(&client->dev); } else { match = i2c_match_id(driver->id_table, client); if (!match) return NULL; match_data = (const void *)match->driver_data; } return match_data; } EXPORT_SYMBOL(i2c_get_match_data); Cheers, Biju