Skip to content

Commit ce6f749

Browse files
committed
extcon: gpio: Add the missing supported_cable parameter to devm_extcon_dev_allocate()
The commit 2a9de9c ("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: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 60f9b9e commit ce6f749

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/extcon/extcon-gpio.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,15 @@ static int gpio_extcon_probe(struct platform_device *pdev)
7070

7171
if (!pdata)
7272
return -EBUSY;
73-
if (!pdata->irq_flags) {
74-
dev_err(&pdev->dev, "IRQ flag is not specified.\n");
73+
if (!pdata->irq_flags || pdata->extcon_id > EXTCON_NONE)
7574
return -EINVAL;
76-
}
7775

7876
data = devm_kzalloc(&pdev->dev, sizeof(struct gpio_extcon_data),
7977
GFP_KERNEL);
8078
if (!data)
8179
return -ENOMEM;
8280

83-
data->edev = devm_extcon_dev_allocate(&pdev->dev, NULL);
81+
data->edev = devm_extcon_dev_allocate(&pdev->dev, &pdata->extcon_id);
8482
if (IS_ERR(data->edev)) {
8583
dev_err(&pdev->dev, "failed to allocate extcon device\n");
8684
return -ENOMEM;

‎include/linux/extcon/extcon-gpio.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
/**
2727
* struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
2828
* @name: The name of this GPIO extcon device.
29+
* @extcon_id: The unique id of specific external connector.
2930
* @gpio: Corresponding GPIO.
3031
* @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
3132
* If true, low state of gpio means active.
@@ -45,6 +46,7 @@
4546
*/
4647
struct gpio_extcon_platform_data {
4748
const char *name;
49+
unsigned int extcon_id;
4850
unsigned gpio;
4951
bool gpio_active_low;
5052
unsigned long debounce;

0 commit comments

Comments
 (0)