On Mon, Jul 24, 2023 at 02:06:07PM +0300, Andy Shevchenko wrote: > On Sun, Jul 23, 2023 at 09:37:20AM +0100, Biju Das wrote: > > Thank you for your contribution! > My comments below. > > > Extend device_get_match_data() to buses (for eg: I2C) by adding a > > callback device_get_match_data() to struct bus_type() and call this method > > as a fallback for generic fwnode based device_get_match_data(). > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> > > You can't just throw one's SoB tag without clear understanding what's going on > here (either wrong authorship or missing Co-developed-by or...?). > > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> ... > > const void *device_get_match_data(const struct device *dev) Btw, this needs a documentation update to explain how it works now. > > { > > - return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); > > + const void *data; > > + > > + data = fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); > > + if (!data && dev->bus && dev->bus->get_match_data) > > + data = dev->bus->get_match_data(dev); > > + > > + return data; > > Much better looking is > > data = fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); > if (data) > return data; > > if (dev->bus && dev->bus->get_match_data) > return dev->bus->get_match_data(dev); > > return NULL; > > > } -- With Best Regards, Andy Shevchenko