Commit ce6f7496 authored by Chanwoo Choi's avatar Chanwoo Choi

extcon: gpio: Add the missing supported_cable parameter to devm_extcon_dev_allocate()

The commit 2a9de9c0 ("extcon: Use the unique id for external connector instead
of string") defines the unique id of each external connector to identify the
type of external connector instead of string name. So, devm_extcon_dev_allocate()
should include the second parameter (unsigned int *supported_cable). This patch
adds the supported_cable parameter which is passed by platform data.
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent 60f9b9e6
...@@ -70,17 +70,15 @@ static int gpio_extcon_probe(struct platform_device *pdev) ...@@ -70,17 +70,15 @@ static int gpio_extcon_probe(struct platform_device *pdev)
if (!pdata) if (!pdata)
return -EBUSY; return -EBUSY;
if (!pdata->irq_flags) { if (!pdata->irq_flags || pdata->extcon_id > EXTCON_NONE)
dev_err(&pdev->dev, "IRQ flag is not specified.\n");
return -EINVAL; return -EINVAL;
}
data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data), data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data),
GFP_KERNEL); GFP_KERNEL);
if (!data) if (!data)
return -ENOMEM; return -ENOMEM;
data->edev = devm_extcon_dev_allocate(&pdev->dev, NULL); data->edev = devm_extcon_dev_allocate(&pdev->dev, &pdata->extcon_id);
if (IS_ERR(data->edev)) { if (IS_ERR(data->edev)) {
dev_err(&pdev->dev, "failed to allocate extcon device\n"); dev_err(&pdev->dev, "failed to allocate extcon device\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/** /**
* struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
* @name: The name of this GPIO extcon device. * @name: The name of this GPIO extcon device.
* @extcon_id: The unique id of specific external connector.
* @gpio: Corresponding GPIO. * @gpio: Corresponding GPIO.
* @gpio_active_low: Boolean describing whether gpio active state is 1 or 0 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
* If true, low state of gpio means active. * If true, low state of gpio means active.
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
*/ */
struct gpio_extcon_platform_data { struct gpio_extcon_platform_data {
const char *name; const char *name;
unsigned int extcon_id;
unsigned gpio; unsigned gpio;
bool gpio_active_low; bool gpio_active_low;
unsigned long debounce; unsigned long debounce;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment