diff options
Diffstat (limited to 'drivers/extcon/extcon-class.c')
-rw-r--r-- | drivers/extcon/extcon-class.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 4c2f2c543bb7..043dcd9946c9 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/fs.h> | 29 | #include <linux/fs.h> |
30 | #include <linux/err.h> | 30 | #include <linux/err.h> |
31 | #include <linux/extcon.h> | 31 | #include <linux/extcon.h> |
32 | #include <linux/of.h> | ||
32 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
33 | #include <linux/sysfs.h> | 34 | #include <linux/sysfs.h> |
34 | #include <linux/of.h> | 35 | #include <linux/of.h> |
@@ -997,13 +998,16 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) | |||
997 | return ERR_PTR(-ENODEV); | 998 | return ERR_PTR(-ENODEV); |
998 | } | 999 | } |
999 | 1000 | ||
1000 | edev = extcon_get_extcon_dev(node->name); | 1001 | mutex_lock(&extcon_dev_list_lock); |
1001 | if (!edev) { | 1002 | list_for_each_entry(edev, &extcon_dev_list, entry) { |
1002 | dev_err(dev, "unable to get extcon device : %s\n", node->name); | 1003 | if (edev->dev.parent && edev->dev.parent->of_node == node) { |
1003 | return ERR_PTR(-ENODEV); | 1004 | mutex_unlock(&extcon_dev_list_lock); |
1005 | return edev; | ||
1006 | } | ||
1004 | } | 1007 | } |
1008 | mutex_unlock(&extcon_dev_list_lock); | ||
1005 | 1009 | ||
1006 | return edev; | 1010 | return ERR_PTR(-EPROBE_DEFER); |
1007 | } | 1011 | } |
1008 | #else | 1012 | #else |
1009 | struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) | 1013 | struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index) |