mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
Integrate mmi_device_is_available() into mmi_check_dynamic_device_node()
mmi_check_dynamic_device_node() uses of_find_node_by_path() to get device node so that mmi_device_is_available() can use this node to find where is "mmi,status".but need use of_node_put() to put this node in there drivers. So move "mmi_device_is_available()" into "mmi_check_dynamic_device_node()" and put the device node at the end. Change-Id: Id42e73b844ef6928ebea673dcd7f9c57c8804f8b Reviewed-on: https://gerrit.mot.com/2271017 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
f1c46d33ce
commit
2e56ea884d
4 changed files with 19 additions and 15 deletions
|
|
@ -263,11 +263,8 @@ static struct i2c_driver goodix_i2c_driver = {
|
|||
|
||||
int goodix_i2c_bus_init(void)
|
||||
{
|
||||
struct device_node *node;
|
||||
|
||||
ts_info("Goodix i2c driver init");
|
||||
node = mmi_check_dynamic_device_node("goodix_ts_i2c");
|
||||
if (!node || mmi_device_is_available(node))
|
||||
if (mmi_check_dynamic_device_node("goodix_ts_i2c"))
|
||||
return i2c_add_driver(&goodix_i2c_driver);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4551,9 +4551,7 @@ static struct spi_driver fts_spi_driver = {
|
|||
static int __init fts_driver_init(void)
|
||||
{
|
||||
#ifdef I2C_INTERFACE
|
||||
struct device_node *node;
|
||||
node = mmi_check_dynamic_device_node("st_fts");
|
||||
if (!node || mmi_device_is_available(node))
|
||||
if (mmi_check_dynamic_device_node("st_fts"))
|
||||
return i2c_add_driver(&fts_i2c_driver);
|
||||
return -ENODEV;
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -94,33 +94,42 @@ bool mmi_device_is_available(struct device_node *np)
|
|||
}
|
||||
EXPORT_SYMBOL(mmi_device_is_available);
|
||||
|
||||
struct device_node *mmi_check_dynamic_device_node(char *dev_name)
|
||||
bool mmi_check_dynamic_device_node(char *dev_name)
|
||||
{
|
||||
struct property *prop;
|
||||
struct device_node *node, *dst_node;
|
||||
struct device_node *node, *dst_node = NULL;
|
||||
int len;
|
||||
char *val = NULL;
|
||||
bool result = true;
|
||||
|
||||
node = of_find_node_by_path("/chosen");
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
goto out;
|
||||
|
||||
prop = of_find_property(node, "mmi,dynamic_devices", &len);
|
||||
of_node_put(node);
|
||||
if (prop == NULL || len < 0) {
|
||||
pr_err("%s: cannot find mmi,dynamic_devices property\n", __func__);
|
||||
return NULL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
while ((val = (char *)of_prop_next_string(prop, val))) {
|
||||
if (strstr(val, dev_name)) {
|
||||
pr_info("%s: find matched dev name string %s\n", __func__, val);
|
||||
dst_node = of_find_node_by_path(val);
|
||||
return dst_node;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pr_err("%s: cannot find any node with dev_name %s\n", __func__, dev_name);
|
||||
return NULL;
|
||||
|
||||
if (dst_node == NULL) {
|
||||
pr_err("%s: cannot find any node with dev_name %s\n", __func__, dev_name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = mmi_device_is_available(dst_node);
|
||||
of_node_put(dst_node);
|
||||
out:
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(mmi_check_dynamic_device_node);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@
|
|||
#define __MMI_DEVICE_H_INCLUDED
|
||||
|
||||
bool mmi_device_is_available(struct device_node *np);
|
||||
struct device_node *mmi_check_dynamic_device_node(char *dev_name);
|
||||
bool mmi_check_dynamic_device_node(char *dev_name);
|
||||
|
||||
#endif /* __MMI_DEVICE_H_INCLUDED */
|
||||
|
|
|
|||
Loading…
Reference in a new issue