mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
i2c: Match using traditional OF methods, then by vendor-less compatible strings
This function provides a single call for all I2C devices which need to match firstly using traditional OF means i.e by of_node, then if that fails we attempt to match using the supplied I2C client name with a list of supplied compatible strings with the '<vendor>,' string removed. The latter is required due to the unruly naming conventions used currently by I2C devices. Acked-by: Grant Likely <[email protected]> Signed-off-by: Lee Jones <[email protected]> [Kieran: Fix static inline usage on !CONFIG_OF] Tested-by: Kieran Bingham <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Tested-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Kieran Bingham <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
This commit is contained in:
parent
cabcf4f6be
commit
298d4de1ed
2 changed files with 28 additions and 0 deletions
|
|
@ -1799,6 +1799,22 @@ i2c_of_match_device_sysfs(const struct of_device_id *matches,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
const struct of_device_id
|
||||
*i2c_of_match_device(const struct of_device_id *matches,
|
||||
struct i2c_client *client)
|
||||
{
|
||||
const struct of_device_id *match;
|
||||
|
||||
if (!(client && matches))
|
||||
return NULL;
|
||||
|
||||
match = of_match_device(matches, &client->dev);
|
||||
if (match)
|
||||
return match;
|
||||
|
||||
return i2c_of_match_device_sysfs(matches, client);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(i2c_of_match_device);
|
||||
#else
|
||||
static void of_i2c_register_devices(struct i2c_adapter *adap) { }
|
||||
#endif /* CONFIG_OF */
|
||||
|
|
|
|||
Loading…
Reference in a new issue