Skip to content

Commit

Permalink
extcon: Add extcon_get_edev_name() API to get the extcon device name
Browse files Browse the repository at this point in the history
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@samsung.com>
  • Loading branch information
Chanwoo Choi committed May 19, 2015
1 parent 71c3ffa commit 707d755
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions include/linux/extcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 707d755

Please sign in to comment.