Skip to content

Commit

Permalink
extcon: Set parent device of extcon device using prameter of devm_ext…
Browse files Browse the repository at this point in the history
…con_dev_allocate

This patch set the parent device of extcon device using first parameter of
devm_extco_dev_allocate() to remove duplicate code on all of extcon provider
drivers.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reported-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tested-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
  • Loading branch information
chanwoochoi committed Jun 16, 2014
1 parent 24a279b commit ac65a62
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion drivers/extcon/extcon-adc-jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ static int adc_jack_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to allocate extcon device\n");
return -ENOMEM;
}
data->edev->dev.parent = &pdev->dev;
data->edev->name = pdata->name;

/* Check the length of array and set num_cables */
Expand Down
1 change: 0 additions & 1 deletion drivers/extcon/extcon-arizona.c
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)
return -ENOMEM;
}
info->edev->name = "Headset Jack";
info->edev->dev.parent = arizona->dev;

ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret < 0) {
Expand Down
2 changes: 2 additions & 0 deletions drivers/extcon/extcon-class.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@ struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
return edev;
}

edev->dev.parent = dev;

*ptr = edev;
devres_add(dev, ptr);

Expand Down
1 change: 0 additions & 1 deletion drivers/extcon/extcon-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ static int gpio_extcon_probe(struct platform_device *pdev)
return -ENOMEM;
}
extcon_data->edev->name = pdata->name;
extcon_data->edev->dev.parent = &pdev->dev;

extcon_data->gpio = pdata->gpio;
extcon_data->gpio_active_low = pdata->gpio_active_low;
Expand Down
1 change: 0 additions & 1 deletion drivers/extcon/extcon-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
goto err_irq;
}
info->edev->name = DEV_NAME;
info->edev->dev.parent = &pdev->dev;

ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret) {
Expand Down
1 change: 0 additions & 1 deletion drivers/extcon/extcon-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ static int max8997_muic_probe(struct platform_device *pdev)
goto err_irq;
}
info->edev->name = DEV_NAME;
info->edev->dev.parent = &pdev->dev;

ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret) {
Expand Down
1 change: 0 additions & 1 deletion drivers/extcon/extcon-palmas.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static int palmas_usb_probe(struct platform_device *pdev)
return -ENOMEM;
}
palmas_usb->edev->name = kstrdup(node->name, GFP_KERNEL);
palmas_usb->edev->dev.parent = palmas_usb->dev;
palmas_usb->edev->mutually_exclusive = mutually_exclusive;

status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);
Expand Down

0 comments on commit ac65a62

Please sign in to comment.