summaryrefslogtreecommitdiff
path: root/drivers/extcon/extcon-class.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-24 17:12:31 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-24 17:12:31 -0800
commit1a3c724afd07a485c7066140f67d466f39263dc6 (patch)
tree8d65d5863db77da87542087b8b2f4e7a5f97a206 /drivers/extcon/extcon-class.c
parente88b1fc6a1c1d088824eb4869a70c374da9ebc86 (diff)
parent6ab0b1171b068a1be871184fc704074ad7e5b9e7 (diff)
Merge tag 'extcon-next-for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-testing
Update extcon for v3.19 This patchset fix minor issue of extcon driver. Detailed description for patchset: - Fix typo and change jig cable name of extcon-max77693.c - Update the extcon_get_edev_by_phandle() because previous extcon_get_edev_by_phandle() considered the platform device driver. So, this modification supports OF-based extcon lookup method by using the list of extcon devices.
Diffstat (limited to 'drivers/extcon/extcon-class.c')
-rw-r--r--drivers/extcon/extcon-class.c14
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 @@
#include <linux/fs.h>
#include <linux/err.h>
#include <linux/extcon.h>
+#include <linux/of.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/of.h>
@@ -997,13 +998,16 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
return ERR_PTR(-ENODEV);
}
- edev = extcon_get_extcon_dev(node->name);
- if (!edev) {
- dev_err(dev, "unable to get extcon device : %s\n", node->name);
- return ERR_PTR(-ENODEV);
+ mutex_lock(&extcon_dev_list_lock);
+ list_for_each_entry(edev, &extcon_dev_list, entry) {
+ if (edev->dev.parent && edev->dev.parent->of_node == node) {
+ mutex_unlock(&extcon_dev_list_lock);
+ return edev;
+ }
}
+ mutex_unlock(&extcon_dev_list_lock);
- return edev;
+ return ERR_PTR(-EPROBE_DEFER);
}
#else
struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)