First of all, thanks for explaining :) On 6 December 2012 04:12, Grant Likely <grant.lik...@secretlab.ca> wrote: > On Sat, 1 Dec 2012 00:33:46 +0530, Viresh Kumar <viresh.ku...@linaro.org> > wrote: >> This first tries to match the table my patch added, _BUT_ the string will >> never match as we had "st,stmpe810" in table and "stmpe810" in dev. > > of_driver_match_device() matches against the compatible list in > dev->of_node, not against the device name. So, if the compatible > property has a string that is in the table, then it really should match > against it.
How could i misread it? Yes you are correct. >> static int i2c_device_probe(struct device *dev) >> { >> ..... >> status = driver->probe(client, i2c_match_id(driver->id_table, client)); > > Here things are a bit wonky. Even if matched against the table, it is table means of_device_id table ? > possible that it also matches against i2c_match_id() and that data is > passed to the driver. It is a possibility or guarantee ? And so whatever device name we got from modalias routine, should match with the names in driver->id_table. > But regardless, it is the responsiblity of the probe function to go and > look if of_driver_match_device() matches against anything if it cares > about the of_match_table entries (for instance, if there is extra data > attached). Ok, so filling .data field in of_device_id[] is not required for our case as we aren't doing anything special in our drivers. >> Which will again match the legacy table to find correct struct i2c_device_id >> *id >> to pass to probe(). >> >> So, the final question: WTF is of_match_table for? > > A bit of history is valuable here. The whole of_modalias_node() thing is > really just a best-effort heuristic for figuring out which driver > *might* work against a device described in the device tree. It won't > work in all circumstances (and it was created at a time when there was > resistance to adding DT knowledge to drivers). An of_match_table is the > robust way of identifying specific devices and allows for matching > against any entry in the compatible list. Got it. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/