From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752987AbcGTHjq (ORCPT ); Wed, 20 Jul 2016 03:39:46 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:53480 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752006AbcGTHiv (ORCPT ); Wed, 20 Jul 2016 03:38:51 -0400 X-AuditID: cbfee68e-f79266d000001428-d2-578f2a88a98a From: Chanwoo Choi To: linux-kernel@vger.kernel.org Cc: cw00.choi@samsung.com, myungjoo.ham@samsung.com, ckeepax@opensource.wolfsonmicro.com Subject: [PATCH 4/4] extcon: Block the bit masking operation for cable state except for extcon core Date: Wed, 20 Jul 2016 16:38:47 +0900 Message-id: <1469000327-15615-5-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1469000327-15615-1-git-send-email-cw00.choi@samsung.com> References: <1469000327-15615-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrELMWRmVeSWpSXmKPExsWyRsSkQLdDqz/c4PUTbYt/U26wW1z/8pzV 4vKuOWwWtxtXsDmweLyc+JvNo2/LKkaPz5vkApijuGxSUnMyy1KL9O0SuDK+nMkpOCtTsWDR JbYGxjPiXYycHBICJhJrnxxgg7DFJC7cWw9kc3EICaxglNg67RAbTNHxf3MZIRJLGSX27GyH qvrCKPGypZcRpIpNQEti/4sbYB0iAgoSm3ufsYLYzAJREkcuf2EHsYUFUiVmftwMFmcRUJW4 9/s6M4jNK+Aq0XVyESvENjmJD3segdVzCrhJbDr/HKxGCKhmy8bzYIslBL6zSexp3ssGMUhA 4tvkQyxdjBxACVmJTQeYIeZIShxccYNlAqPwAkaGVYyiqQXJBcVJ6UVGesWJucWleel6yfm5 mxiBQXv637O+HYw3D1gfYhTgYFTi4Y042BcuxJpYVlyZe4jRFGjDRGYp0eR8YGzklcQbGpsZ W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F hutE7Hv3wlaJpTgj0VCLuag4EQC2f2nsogIAAA== 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 restrict the usage of extcon_update_state() in the extcon core because the extcon_update_state() use the bit masking to change the state of external connector. When this function is used in device drivers, it may occur the probelm with the handling mistake of bit masking. Also, this patch removes the extcon_get/set_state() functions because these functions use the bit masking which is reluctant way. Instead, extcon provides the extcon_set/get_cable_state_() functions. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon.c | 20 +------------------- include/linux/extcon.h | 30 ------------------------------ 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index ad5e4546f82c..5b61000cde26 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -224,7 +224,7 @@ static ssize_t cable_state_show(struct device *dev, * Note that the notifier provides which bits are changed in the state * variable with the val parameter (second) to the callback. */ -int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) +static int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) { char name_buf[120]; char state_buf[120]; @@ -300,24 +300,6 @@ int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state) return 0; } -EXPORT_SYMBOL_GPL(extcon_update_state); - -/** - * extcon_set_state() - Set the cable attach states of the extcon device. - * @edev: the extcon device - * @state: new cable attach status for @edev - * - * Note that notifier provides which bits are changed in the state - * variable with the val parameter (second) to the callback. - */ -int extcon_set_state(struct extcon_dev *edev, u32 state) -{ - if (!edev) - return -EINVAL; - - return extcon_update_state(edev, 0xffffffff, state); -} -EXPORT_SYMBOL_GPL(extcon_set_state); /** * extcon_get_cable_state_() - Get the status of a specific cable. diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 61004413dc64..667b1d35af12 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -150,20 +150,6 @@ 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/update_state access the 32b encoded state value, which represents - * states of all possible cables of the multistate port. For example, if one - * calls extcon_set_state(edev, 0x7), it may mean that all the three cables - * are attached to the port. - */ -static inline u32 extcon_get_state(struct extcon_dev *edev) -{ - return edev->state; -} - -extern int extcon_set_state(struct extcon_dev *edev, u32 state); -extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state); - -/* * get/set_cable_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. */ @@ -232,22 +218,6 @@ 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 u32 extcon_get_state(struct extcon_dev *edev) -{ - return 0; -} - -static inline int extcon_set_state(struct extcon_dev *edev, u32 state) -{ - return 0; -} - -static inline int extcon_update_state(struct extcon_dev *edev, u32 mask, - u32 state) -{ - return 0; -} - static inline int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id) { -- 1.9.1