summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSangjung Woo <sangjung.woo@samsung.com>2014-04-21 19:10:08 +0900
committerChanwoo Choi <cw00.choi@samsung.com>2014-04-24 19:36:55 +0900
commit1111244ff4493448c0ee66e814e20c6e81d3b93d (patch)
tree67e3d29dc335fcd67f85d4a4683c271d3749829a /include
parent369afd4ba22f5b8de0c9229b6e62b3f9e2207034 (diff)
extcon: Add resource-managed extcon register function
Add resource-managed extcon device register function for convenience. For example, if a extcon device is attached with new devm_extcon_dev_register(), that extcon device is automatically unregistered on driver detach. Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com> [Fix bug about devm_extcon_dev_match/release() and code clean by Chanwoo Choi] Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/extcon.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index f488145bb2d4..548447be2d8f 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -185,6 +185,10 @@ struct extcon_specific_cable_nb {
*/
extern int extcon_dev_register(struct extcon_dev *edev);
extern void extcon_dev_unregister(struct extcon_dev *edev);
+extern int devm_extcon_dev_register(struct device *dev,
+ struct extcon_dev *edev);
+extern void devm_extcon_dev_unregister(struct device *dev,
+ struct extcon_dev *edev);
extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
/*
@@ -254,6 +258,15 @@ static inline int extcon_dev_register(struct extcon_dev *edev)
static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
+static inline int devm_extcon_dev_register(struct device *dev,
+ struct extcon_dev *edev)
+{
+ return -EINVAL;
+}
+
+static inline void devm_extcon_dev_unregister(struct device *dev,
+ struct extcon_dev *edev) { }
+
static inline u32 extcon_get_state(struct extcon_dev *edev)
{
return 0;