From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755784AbcHBB7F (ORCPT ); Mon, 1 Aug 2016 21:59:05 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:50624 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755562AbcHBB6b (ORCPT ); Mon, 1 Aug 2016 21:58:31 -0400 X-AuditID: cbfee68d-f79286d000007a9a-37-579ffe44968b From: Chanwoo Choi To: linux-kernel@vger.kernel.org Cc: cw00.choi@samsung.com, myungjoo.ham@samsung.com, zyw@rock-chips.com, groeck@chromium.org, rogerq@ti.com, chanwoo@kernel.org Subject: [PATCH v3 4/6] extcon: Rename the extcon_set/get_state() to maintain the function naming pattern Date: Tue, 02 Aug 2016 10:58:23 +0900 Message-id: <1470103105-5992-5-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1470103105-5992-1-git-send-email-cw00.choi@samsung.com> References: <1470103105-5992-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPLMWRmVeSWpSXmKPExsWyRsSkQNfl3/xwg28rJCwm3rjCYnH9y3NW i1OvljFbXN41h83iduMKNoueR1oW8x/sYHZg95jdcJHFY9OqTjaPv7P2s3j0bVnF6HH8xnYm j8+b5ALYorhsUlJzMstSi/TtErgy1jTdYStYrVOx51EjSwPjIZUuRk4OCQETiRtr1rJD2GIS F+6tZ+ti5OIQEljBKNHTtpAZpmju8flMEIlZjBKdvYtZIZwvjBKtS1eDVbEJaEnsf3GDDcQW EVCQ2Nz7jBXEZhZoZJS4vSShi5GDQ1ggW+LTrGqQMIuAqsTk9R/ASngFXCReT5/DCrFMTuLD nkdgF3EKuErs3rsVLC4EVLP9+B6wvRICy9glTq0+yg4xSEDi2+RDLCDzJQRkJTYdgDpaUuLg ihssExiFFzAyrGIUTS1ILihOSi8y1CtOzC0uzU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RYqb7XnkT6g94Vz3eVZrmaSRiuX8vN8Wr16Q6bql6A5QU849TOnRHtnXLcWWWB1QuOrlobo 7wusW26vf+1zRyWmIf/gryLHtnyHQuG2k8nfiwy7b78vSb11pTshO65YiaU4I9FQi7moOBEA 3/Jva78CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch just renames the existing extcon_get/set_cable_state_() as following because of maintaining the function naming pattern like as extcon APIs for property. - extcon_set_cable_state_() -> extcon_set_state() - extcon_get_cable_state_() -> extcon_get_state() But, this patch remains the old extcon_set/get_cable_state_() functions to prevent the build break. After altering new APIs, remove the old APIs. Signed-off-by: Chanwoo Choi Tested-by: Chris Zhong Tested-by: Guenter Roeck Reviewed-by: Guenter Roeck --- drivers/extcon/extcon.c | 28 +++++++++++++--------------- include/linux/extcon.h | 25 ++++++++++++++++++------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 7ae0771f29e7..aaf28bc9e4da 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -398,8 +398,7 @@ static ssize_t cable_state_show(struct device *dev, int i = cable->cable_index; return sprintf(buf, "%d\n", - extcon_get_cable_state_(cable->edev, - cable->edev->supported_cable[i])); + extcon_get_state(cable->edev, cable->edev->supported_cable[i])); } /** @@ -495,13 +494,14 @@ static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) } /** - * extcon_get_cable_state_() - Get the status of a specific cable. + * extcon_get_state() - Get the state of a external connector. * @edev: the extcon device that has the cable. * @id: the unique id of each external connector in extcon enumeration. */ -int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id) +int extcon_get_state(struct extcon_dev *edev, const unsigned int id) { - int index; + int index, state; + unsigned long flags; if (!edev) return -EINVAL; @@ -510,22 +510,23 @@ int extcon_get_cable_state_(struct extcon_dev *edev, const unsigned int id) if (index < 0) return index; - if (edev->max_supported && edev->max_supported <= index) - return -EINVAL; + spin_lock_irqsave(&edev->lock, flags); + state = is_extcon_attached(edev, index); + spin_unlock_irqrestore(&edev->lock, flags); - return is_extcon_attached(edev, index); + return state; } -EXPORT_SYMBOL_GPL(extcon_get_cable_state_); +EXPORT_SYMBOL_GPL(extcon_get_state); /** - * extcon_set_cable_state_() - Set the status of a specific cable. + * extcon_set_state() - Set the state of a external connector. * @edev: the extcon device that has the cable. * @id: the unique id of each external connector * in extcon enumeration. * @state: the new cable status. The default semantics is * true: attached / false: detached. */ -int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, +int extcon_set_state(struct extcon_dev *edev, unsigned int id, bool cable_state) { u32 state; @@ -538,9 +539,6 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, if (index < 0) return index; - if (edev->max_supported && edev->max_supported <= index) - return -EINVAL; - /* * Initialize the value of extcon property before setting * the detached state for an external connector. @@ -551,7 +549,7 @@ int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, state = cable_state ? (1 << index) : 0; return extcon_update_state(edev, 1 << index, state); } -EXPORT_SYMBOL_GPL(extcon_set_cable_state_); +EXPORT_SYMBOL_GPL(extcon_set_state); /** * extcon_get_property() - Get the property value of a specific cable. diff --git a/include/linux/extcon.h b/include/linux/extcon.h index ffd32a8975d5..4e7664378d5b 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -221,11 +221,11 @@ extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); /* - * get/set_cable_state access each bit of the 32b encoded state value. + * get/set_state access each bit of the 32b encoded state value. * They are used to access the status of each cable based on the cable id. */ -extern int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id); -extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, +extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); +extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, bool cable_state); /* @@ -310,14 +310,14 @@ static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } -static inline int extcon_get_cable_state_(struct extcon_dev *edev, - unsigned int id) + +static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id) { return 0; } -static inline int extcon_set_cable_state_(struct extcon_dev *edev, - unsigned int id, bool cable_state) +static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, + bool cable_state) { return 0; } @@ -407,4 +407,15 @@ static inline int extcon_unregister_interest(struct extcon_specific_cable_nb { return -EINVAL; } + +static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id) +{ + return extcon_get_state(edev, id); +} + +static inline int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id, + bool cable_state) +{ + return extcon_set_state(edev, id, cable_state); +} #endif /* __LINUX_EXTCON_H__ */ -- 1.9.1