[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1430136818-11657-3-git-send-email-cw00.choi@samsung.com>
Date: Mon, 27 Apr 2015 21:13:36 +0900
From: Chanwoo Choi <cw00.choi@...sung.com>
To: linux-kernel@...r.kernel.org
Cc: myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
ckeepax@...nsource.wolfsonmicro.com, cw00.choi@...sung.com
Subject: [PATCH 2/4] extcon: Add extcon_get_edev_name() API to get the extcon
device name
This patch adds the extcon_get_edev_name() API to get the name of extcon device
because all information inclued in the structure extcon_dev should be accessed
by extcon core API instead of directly accessing the data.
Signed-off-by: Chanwoo Choi <cw00.choi@...sung.com>
---
drivers/extcon/extcon.c | 9 +++++++++
include/linux/extcon.h | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 1a93229..c5e9ebf 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1046,6 +1046,15 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)
#endif /* CONFIG_OF */
EXPORT_SYMBOL_GPL(extcon_get_edev_by_phandle);
+/**
+ * extcon_get_edev_name() - Get the name of the extcon device.
+ * @edev: the extcon device
+ */
+const char *extcon_get_edev_name(struct extcon_dev *edev)
+{
+ return !edev ? NULL : edev->name;
+}
+
static int __init extcon_class_init(void)
{
return create_extcon_class();
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 36f49c4..e2cf625 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -259,6 +259,10 @@ extern int extcon_unregister_notifier(struct extcon_dev *edev,
* This function use phandle of devicetree to get extcon device directly.
*/
extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index);
+
+/* Following API to get information of extcon device */
+extern const char *extcon_get_edev_name(struct extcon_dev *edev);
+
#else /* CONFIG_EXTCON */
static inline int extcon_dev_register(struct extcon_dev *edev)
{
--
1.8.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists