extcon: Remove deadcode
PATCH 1/1 extcon: Remove deadcode
From: "Dr. David Alan Gilbert" <[email protected]>
extcon_get_edev_name() has been unused since it was added in 2015 by commit 707d7550875a ("extcon: Add extcon_get_edev_name() API to get the extcon device name")
extcon_get_property_capability() has been unused since it was added in 2016 by
commit ceaa98f442cf ("extcon: Add the support for the capability of each property")
(It seems everyone just uses extcon_get_property)
extcon_set_property_sync() has been unused since it was added in 2016 by
commit a580982f0836 ("extcon: Add the synchronization extcon APIs to support the notification")
Everyone seems to use the none _sync version, and there's one place where they just call sync after it.
Remove them.
--- drivers/extcon/extcon.c | 67 --------------------------------- include/linux/extcon-provider.h | 10 ----- include/linux/extcon.h | 20 +--------- 3 files changed, 1 insertion(+), 96 deletions(-)
drivers/extcon/extcon.c +0 -67
@@ -755,63 +755,6 @@ int extcon_set_property(struct extcon_dev *edev, unsigned int id, }EXPORT_SYMBOL_GPL (extcon_set_property); -/** -* extcon_set_property_sync() - Set property of an external connector with sync. -* @edev: the extcon device -* @id: the unique id indicating an external connector -* @prop: the property id indicating an extcon property -* @prop_val: the pointer including the new value of extcon property -* -* Note that when setting the property value of external connector, -* the external connector should be attached. The each property should -* be included in the list of supported properties according to extcon type. -* -* Returns 0 if success or error number if fail. -*/ -int extcon_set_property_sync (struct extcon_dev *edev,unsigned int id, -unsigned int prop, -union extcon_property_value prop_val) -{ -int ret; - - ret =extcon_set_property (edev, id, prop, prop_val); -if (ret <0 ) -return ret; - -return extcon_sync (edev, id); -} -EXPORT_SYMBOL_GPL (extcon_set_property_sync); - -/** -* extcon_get_property_capability() - Get the capability of the property -* for an external connector. -* @edev: the extcon device -* @id: the unique id indicating an external connector -* @prop: the property id indicating an extcon property -* -* Returns 1 if the property is available or 0 if not available. -*/ -int extcon_get_property_capability (struct extcon_dev *edev,unsigned int id, -unsigned int prop) -{ -int index; - -if (!edev) -return -EINVAL ; - -/* Check whether the property is supported or not */ -if (!is_extcon_property_supported (id, prop)) -return -EINVAL ; - -/* Find the cable index of external connector by using id */ - index =find_cable_index_by_id (edev, id); -if (index <0 ) -return index; - -return is_extcon_property_capability (edev, id, index, prop); -} -EXPORT_SYMBOL_GPL (extcon_get_property_capability); -/** * extcon_set_property_capability() - Set the capability of the property * for an external connector.
@@ -1465,16 +1408,6 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)EXPORT_SYMBOL_GPL (extcon_find_edev_by_node);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; -} -EXPORT_SYMBOL_GPL (extcon_get_edev_name); -static int __init extcon_class_init (void ) {return create_extcon_class ();
include/linux/extcon-provider.h +0 -10
@@ -55,9 +55,6 @@ int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,int extcon_set_property (struct extcon_dev *edev,unsigned int id,unsigned int prop,union extcon_property_value prop_val); -int extcon_set_property_sync (struct extcon_dev *edev,unsigned int id, -unsigned int prop, -union extcon_property_value prop_val);int extcon_set_property_capability (struct extcon_dev *edev,unsigned int id,unsigned int prop);
@@ -118,13 +115,6 @@ static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,return 0 ; } -static inline int extcon_set_property_sync (struct extcon_dev *edev, -unsigned int id,unsigned int prop, -union extcon_property_value prop_val) -{ -return 0 ; -} -static inline int extcon_set_property_capability (struct extcon_dev *edev,unsigned int id,unsigned int prop) {
include/linux/extcon.h +1 -19
@@ -175,19 +175,14 @@ struct extcon_dev;int extcon_get_state (struct extcon_dev *edev,unsigned int id);/* -* Following APIs get the property of each external connector. +* Following API get the property of each external connector. * The 'id' argument indicates the defined external connector * and the 'prop' indicates the extcon property. * -* And extcon_get_property_capability() get the capability of the property -* for each external connector. They are used to get the capability of the -* property of each external connector based on the id and property. */ int extcon_get_property (struct extcon_dev *edev,unsigned int id,unsigned int prop,union extcon_property_value *prop_val); -int extcon_get_property_capability (struct extcon_dev *edev, -unsigned int id,unsigned int prop);/* * Following APIs register the notifier block in order to detect
@@ -228,9 +223,6 @@ struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);struct extcon_dev *extcon_get_edev_by_phandle (struct device *dev,int index); -/* Following API get the name of extcon device. */ -const char *extcon_get_edev_name (struct extcon_dev *edev); -#else /* CONFIG_EXTCON */ static inline int extcon_get_state (struct extcon_dev *edev,unsigned int id) {
@@ -244,12 +236,6 @@ static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,return 0 ; } -static inline int extcon_get_property_capability (struct extcon_dev *edev, -unsigned int id,unsigned int prop) -{ -return 0 ; -} -static inline int extcon_register_notifier (struct extcon_dev *edev,unsigned int id,struct notifier_block *nb) {
@@ -312,10 +298,6 @@ static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, return ERR_PTR(-ENODEV); } -static inline const char *extcon_get_edev_name (struct extcon_dev *edev) -{ -return NULL ; -}#endif /* CONFIG_EXTCON */ /*
Signature · 1 line
2.47.0
Quoted 19 lines · * [email protected] ([email protected]) wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
extcon_get_edev_name()has been unused since it was added in 2015 by commit707d7550875a("extcon: Addextcon_get_edev_name()API to get the extcon device name")
extcon_get_property_capability()has been unused since it was added in 2016 by
commitceaa98f442cf("extcon: Add the support for the capability of each property")
(It seems everyone just usesextcon_get_property)
extcon_set_property_sync()has been unused since it was added in 2016 by
commita580982f0836("extcon: Add the synchronization extcon APIs to support the notification")
Everyone seems to use the none_syncversion, and there's one place where they just call sync after it.
Quoted 3 lines
Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
Gentle ping please; no rush.
Dave
Quoted 181 lines
--- drivers/extcon/extcon.c | 67 --------------------------------- include/linux/extcon-provider.h | 10 ----- include/linux/extcon.h | 20 +--------- 3 files changed, 1 insertion(+), 96 deletions(-)drivers/extcon/extcon.c +0
-67@@ -755,63 +755,6 @@ int extcon_set_property(struct extcon_dev *edev, unsigned int id, }EXPORT_SYMBOL_GPL (extcon_set_property); -/** -* extcon_set_property_sync() - Set property of an external connector with sync. -* @edev: the extcon device -* @id: the unique id indicating an external connector -* @prop: the property id indicating an extcon property -* @prop_val: the pointer including the new value of extcon property -* -* Note that when setting the property value of external connector, -* the external connector should be attached. The each property should -* be included in the list of supported properties according to extcon type. -* -* Returns 0 if success or error number if fail. -*/ -int extcon_set_property_sync (struct extcon_dev *edev,unsigned int id, -unsigned int prop, -union extcon_property_value prop_val) -{ -int ret; - - ret =extcon_set_property (edev, id, prop, prop_val); -if (ret <0 ) -return ret; - -return extcon_sync (edev, id); -} -EXPORT_SYMBOL_GPL (extcon_set_property_sync); - -/** -* extcon_get_property_capability() - Get the capability of the property -* for an external connector. -* @edev: the extcon device -* @id: the unique id indicating an external connector -* @prop: the property id indicating an extcon property -* -* Returns 1 if the property is available or 0 if not available. -*/ -int extcon_get_property_capability (struct extcon_dev *edev,unsigned int id, -unsigned int prop) -{ -int index; - -if (!edev) -return -EINVAL ; - -/* Check whether the property is supported or not */ -if (!is_extcon_property_supported (id, prop)) -return -EINVAL ; - -/* Find the cable index of external connector by using id */ - index =find_cable_index_by_id (edev, id); -if (index <0 ) -return index; - -return is_extcon_property_capability (edev, id, index, prop); -} -EXPORT_SYMBOL_GPL (extcon_get_property_capability); -/** * extcon_set_property_capability() - Set the capability of the property * for an external connector. @@ -1465,16 +1408,6 @@ struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index)EXPORT_SYMBOL_GPL (extcon_find_edev_by_node);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; -} -EXPORT_SYMBOL_GPL (extcon_get_edev_name); -static int __init extcon_class_init (void ) {return create_extcon_class ();include/linux/extcon-provider.h +0
-10@@ -55,9 +55,6 @@ int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,int extcon_set_property (struct extcon_dev *edev,unsigned int id,unsigned int prop,union extcon_property_value prop_val); -int extcon_set_property_sync (struct extcon_dev *edev,unsigned int id, -unsigned int prop, -union extcon_property_value prop_val);int extcon_set_property_capability (struct extcon_dev *edev,unsigned int id,unsigned int prop);@@ -118,13 +115,6 @@ static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,return 0 ; } -static inline int extcon_set_property_sync (struct extcon_dev *edev, -unsigned int id,unsigned int prop, -union extcon_property_value prop_val) -{ -return 0 ; -} -static inline int extcon_set_property_capability (struct extcon_dev *edev,unsigned int id,unsigned int prop) {include/linux/extcon.h +1
-19@@ -175,19 +175,14 @@ struct extcon_dev;int extcon_get_state (struct extcon_dev *edev,unsigned int id);/* -* Following APIs get the property of each external connector. +* Following API get the property of each external connector. * The 'id' argument indicates the defined external connector * and the 'prop' indicates the extcon property. * -* And extcon_get_property_capability() get the capability of the property -* for each external connector. They are used to get the capability of the -* property of each external connector based on the id and property. */ int extcon_get_property (struct extcon_dev *edev,unsigned int id,unsigned int prop,union extcon_property_value *prop_val); -int extcon_get_property_capability (struct extcon_dev *edev, -unsigned int id,unsigned int prop);/* * Following APIs register the notifier block in order to detect @@ -228,9 +223,6 @@ struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);struct extcon_dev *extcon_get_edev_by_phandle (struct device *dev,int index); -/* Following API get the name of extcon device. */ -const char *extcon_get_edev_name (struct extcon_dev *edev); -#else /* CONFIG_EXTCON */ static inline int extcon_get_state (struct extcon_dev *edev,unsigned int id) {@@ -244,12 +236,6 @@ static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,return 0 ; } -static inline int extcon_get_property_capability (struct extcon_dev *edev, -unsigned int id,unsigned int prop) -{ -return 0 ; -} -static inline int extcon_register_notifier (struct extcon_dev *edev,unsigned int id,struct notifier_block *nb) {@@ -312,10 +298,6 @@ static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, return ERR_PTR(-ENODEV); } -static inline const char *extcon_get_edev_name (struct extcon_dev *edev) -{ -return NULL ; -}#endif /* CONFIG_EXTCON */ /* Signature · 1 line
2.47.0
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
MyungJoo Ham
maintainerFrom: Dr. David Alan Gilbert / [email protected]
Quoted 20 lines · * [email protected] ([email protected]) wrote:
Quoted 19 lines
From: "Dr. David Alan Gilbert" <[email protected]>
extcon_get_edev_name()has been unused since it was added in 2015 by commit707d7550875a("extcon: Addextcon_get_edev_name()API to get the extcon device name")
extcon_get_property_capability()has been unused since it was added in 2016 by
commitceaa98f442cf("extcon: Add the support for the capability of each property")
(It seems everyone just usesextcon_get_property)
extcon_set_property_sync()has been unused since it was added in 2016 by
commita580982f0836("extcon: Add the synchronization extcon APIs to support the notification")
Everyone seems to use the none_syncversion, and there's one place where they just call sync after it.
Quoted 7 lines
Quoted 3 lines
Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>Gentle ping please; no rush.
Dave
It's not a dead code.
There are drivers (usually .ko) using them, usually Android mobile devices.
Cheers,
MyungJoo
Quoted 28 lines · * MyungJoo Ham ([email protected]) wrote:
From: Dr. David Alan Gilbert / [email protected]
Quoted 27 lines · * [email protected] ([email protected]) wrote:
Quoted 19 lines
From: "Dr. David Alan Gilbert" <[email protected]>
extcon_get_edev_name()has been unused since it was added in 2015 by commit707d7550875a("extcon: Addextcon_get_edev_name()API to get the extcon device name")
extcon_get_property_capability()has been unused since it was added in 2016 by
commitceaa98f442cf("extcon: Add the support for the capability of each property")
(It seems everyone just usesextcon_get_property)
extcon_set_property_sync()has been unused since it was added in 2016 by
commita580982f0836("extcon: Add the synchronization extcon APIs to support the notification")
Everyone seems to use the none_syncversion, and there's one place where they just call sync after it.Quoted 3 lines
Remove them.
Signed-off-by Dr. David Alan Gilbert <[email protected]>Gentle ping please; no rush.
Dave
Thanks for the reply,
Quoted 5 lines
It's not a dead code.
There are drivers (usually .ko) using them, usually Android mobile devices.
Ah hmm; ok, I'll drop that.
Of course it would be great to get some of these upstreamed rather than us having mysterious interfaces lying around for ~10 years!
Dave
Quoted 3 lines
Cheers,
MyungJoo
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/