extcon: Set parent device of extcon device using prameter of devm_extcon_dev_allocate
authorChanwoo Choi <cw00.choi@samsung.com>
Fri, 30 May 2014 01:13:15 +0000 (10:13 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 16 Jun 2014 04:33:19 +0000 (13:33 +0900)
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>
drivers/extcon/extcon-adc-jack.c
drivers/extcon/extcon-arizona.c
drivers/extcon/extcon-class.c
drivers/extcon/extcon-gpio.c
drivers/extcon/extcon-max77693.c
drivers/extcon/extcon-max8997.c
drivers/extcon/extcon-palmas.c

index e18f95be37338a725de3ad39ae2bdd158a59805b..d860229e4de1455a31c0700aa5667d0b3d6a679d 100644 (file)
@@ -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 */
index c2eed30cfc3a55c4b46ffd2d3d6d06bf6d7487b0..0b1ee9f553780b7cf181e4b248abb4daf9dedd28 100644 (file)
@@ -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) {
index 18d42c0e458133d7fe316f0e0c70f4e2b0ab9425..4c2f2c543bb753cfeb9c871e222615af3168d60d 100644 (file)
@@ -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);
 
index 645b283568192f4ff0c77009bc39df2ceaee14ec..5b7ec274cb637572edacb0fe6e59f3a502ac5cc5 100644 (file)
@@ -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;
index 2c7c3e191591ee98afa892357aebcc43c5f39a99..e9ec6ae8b0d8b7fef3b3ed041e424bd8e5dd42b7 100644 (file)
@@ -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) {
index d9f7f1baaa030f50e8568caa7724194dbc8ea854..d22c379766dd2b00d8b865f70e04426be7311a08 100644 (file)
@@ -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) {
index 5efa96c001965fe9789f2f1884091e9e89d64e34..230e1220ce48bc49ef24bd5683ca1c074e94202e 100644 (file)
@@ -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);