Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1447804 > unrolled thread

[PATCH v2 0/5] extcon: Block the usgae of extcon_set/get/update_state() except for extcon core

Started byChanwoo Choi <cw00.choi@samsung.com>
First post2016-07-21 13:20 +0200
Last post2016-07-21 13:20 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/5] extcon: Block the usgae of  extcon_set/get/update_state() except for extcon core Chanwoo Choi <cw00.choi@samsung.com> - 2016-07-21 13:20 +0200
    [PATCH v2 4/5] extcon: Remove the state_store() to prevent the wrong  access Chanwoo Choi <cw00.choi@samsung.com> - 2016-07-21 13:20 +0200

#1447804 — [PATCH v2 0/5] extcon: Block the usgae of extcon_set/get/update_state() except for extcon core

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-07-21 13:20 +0200
Subject[PATCH v2 0/5] extcon: Block the usgae of extcon_set/get/update_state() except for extcon core
Message-ID<rXk1A-6EN-29@gated-at.bofh.it>
This patchset blocks the usgae of extcon_get/get_update_state()
except for extcon core. Instead, extcon framework provide the
other APIs with unique extcon id as following:
- extcon_set_cable_state_()
- extcon_get_cable_state_()

Changes from v1:
- Add patch3 to remove the usage of extcon_set_state() on extcon-gpio.c

Chanwoo Choi (5):
  extcon: arizona: Remove the usage of extcon_update_state()
  extcon: adc-jack: Remove the usage of extcon_set_state()
  extcon: gpio: Remove the usage of extcon_set_state()
  extcon: Remove the state_store() to prevent the wrong access
  extcon: Block the bit masking operation for cable state except for extcon core

 drivers/extcon/extcon-adc-jack.c       | 26 +++++++++++----------
 drivers/extcon/extcon-arizona.c        | 11 +++++----
 drivers/extcon/extcon-gpio.c           |  2 +-
 drivers/extcon/extcon.c                | 41 ++--------------------------------
 include/linux/extcon.h                 | 30 -------------------------
 include/linux/extcon/extcon-adc-jack.h |  4 ++--
 6 files changed, 26 insertions(+), 88 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1447805 — [PATCH v2 4/5] extcon: Remove the state_store() to prevent the wrong access

FromChanwoo Choi <cw00.choi@samsung.com>
Date2016-07-21 13:20 +0200
Subject[PATCH v2 4/5] extcon: Remove the state_store() to prevent the wrong access
Message-ID<rXkbg-6I6-19@gated-at.bofh.it>
In reply to#1447804
This patch removes the state_store() which change the state of external
connectors with bit masking on user-space. It is wrong access to modify
the change the state of external connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 319659c6af28..ad5e4546f82c 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -174,26 +174,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
-
-static ssize_t state_store(struct device *dev, struct device_attribute *attr,
-			   const char *buf, size_t count)
-{
-	u32 state;
-	ssize_t ret = 0;
-	struct extcon_dev *edev = dev_get_drvdata(dev);
-
-	ret = sscanf(buf, "0x%x", &state);
-	if (ret == 0)
-		ret = -EINVAL;
-	else
-		ret = extcon_set_state(edev, state);
-
-	if (ret < 0)
-		return ret;
-
-	return count;
-}
-static DEVICE_ATTR_RW(state);
+static DEVICE_ATTR_RO(state);
 
 static ssize_t name_show(struct device *dev, struct device_attribute *attr,
 		char *buf)
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web