aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2015-06-11 07:17:02 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2015-08-09 22:48:55 -0400
commit2519b7650e99d90643a7a20d623513de9c95a817 (patch)
tree1bd74e01d8e4d7f2b23725db9d0fb480212fcd17
parent85a77ff0160ab0a70eb4e8b14200e29b4d35c355 (diff)
extcon: Remove optional print_state() function pointer of struct extcon_dev
This patch removes the optional print_state() function pointer which included in 'struct extcon_dev' because the extcon must maintain the consistent name of extcon device on sysfs instead of inconsistent state of external connectors. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-rw-r--r--drivers/extcon/extcon-gpio.c18
-rw-r--r--drivers/extcon/extcon.c8
-rw-r--r--include/linux/extcon.h5
3 files changed, 0 insertions, 31 deletions
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 355459a54e8b..57c24fa52edb 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -65,22 +65,6 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id)
65 return IRQ_HANDLED; 65 return IRQ_HANDLED;
66} 66}
67 67
68static ssize_t extcon_gpio_print_state(struct extcon_dev *edev, char *buf)
69{
70 struct device *dev = edev->dev.parent;
71 struct gpio_extcon_data *extcon_data = dev_get_drvdata(dev);
72 const char *state;
73
74 if (extcon_get_state(edev))
75 state = extcon_data->state_on;
76 else
77 state = extcon_data->state_off;
78
79 if (state)
80 return sprintf(buf, "%s\n", state);
81 return -EINVAL;
82}
83
84static int gpio_extcon_probe(struct platform_device *pdev) 68static int gpio_extcon_probe(struct platform_device *pdev)
85{ 69{
86 struct gpio_extcon_platform_data *pdata = dev_get_platdata(&pdev->dev); 70 struct gpio_extcon_platform_data *pdata = dev_get_platdata(&pdev->dev);
@@ -110,8 +94,6 @@ static int gpio_extcon_probe(struct platform_device *pdev)
110 extcon_data->state_on = pdata->state_on; 94 extcon_data->state_on = pdata->state_on;
111 extcon_data->state_off = pdata->state_off; 95 extcon_data->state_off = pdata->state_off;
112 extcon_data->check_on_resume = pdata->check_on_resume; 96 extcon_data->check_on_resume = pdata->check_on_resume;
113 if (pdata->state_on && pdata->state_off)
114 extcon_data->edev->print_state = extcon_gpio_print_state;
115 97
116 ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN, 98 ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
117 pdev->name); 99 pdev->name);
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index 43b57b02d050..d1fb5b4d024a 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -172,14 +172,6 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
172 int i, count = 0; 172 int i, count = 0;
173 struct extcon_dev *edev = dev_get_drvdata(dev); 173 struct extcon_dev *edev = dev_get_drvdata(dev);
174 174
175 if (edev->print_state) {
176 int ret = edev->print_state(edev, buf);
177
178 if (ret >= 0)
179 return ret;
180 /* Use default if failed */
181 }
182
183 if (edev->max_supported == 0) 175 if (edev->max_supported == 0)
184 return sprintf(buf, "%u\n", edev->state); 176 return sprintf(buf, "%u\n", edev->state);
185 177
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 1656c98175f5..c0f8c4fc5d45 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -75,8 +75,6 @@ struct extcon_cable;
75 * be attached simulataneously. {0x7, 0} is equivalent to 75 * be attached simulataneously. {0x7, 0} is equivalent to
76 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 76 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
77 * can be no simultaneous connections. 77 * can be no simultaneous connections.
78 * @print_state: An optional callback to override the method to print the
79 * status of the extcon device.
80 * @dev: Device of this extcon. 78 * @dev: Device of this extcon.
81 * @state: Attach/detach state of this extcon. Do not provide at 79 * @state: Attach/detach state of this extcon. Do not provide at
82 * register-time. 80 * register-time.
@@ -100,9 +98,6 @@ struct extcon_dev {
100 const unsigned int *supported_cable; 98 const unsigned int *supported_cable;
101 const u32 *mutually_exclusive; 99 const u32 *mutually_exclusive;
102 100
103 /* Optional callbacks to override class functions */
104 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
105
106 /* Internal data. Please do not set. */ 101 /* Internal data. Please do not set. */
107 struct device dev; 102 struct device dev;
108 struct raw_notifier_head *nh; 103 struct raw_notifier_head *nh;