From 739ba1bfdb15e773999aafddbd6c59b5737797a0 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 24 Apr 2014 20:12:15 +0900 Subject: extcon: Add devm_extcon_dev_allocate/free to manage the resource of extcon device This patch add device managed devm_extcon_dev_{allocate,free} to automatically free the memory of extcon_dev structure without handling free operation. Signed-off-by: Chanwoo Choi Reviewed-by: Felipe Balbi --- include/linux/extcon.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/linux/extcon.h') diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 15361a2f2f19..36f49c405dfb 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -196,6 +196,9 @@ extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); */ extern struct extcon_dev *extcon_dev_allocate(const char **cables); extern void extcon_dev_free(struct extcon_dev *edev); +extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **cables); +extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); /* * get/set/update_state access the 32b encoded state value, which represents @@ -280,6 +283,14 @@ static inline struct extcon_dev *extcon_dev_allocate(const char **cables) static inline void extcon_dev_free(struct extcon_dev *edev) { } +static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **cables) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } + static inline u32 extcon_get_state(struct extcon_dev *edev) { return 0; -- cgit v1.2.3-59-g8ed1b