extcon: madera: Get micd_pol_gpio against extcon device not madera
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Mon, 11 Dec 2017 14:08:35 +0000 (14:08 +0000)
committer강신형 <s47.kang@samsung.com>
Tue, 19 Jun 2018 07:56:47 +0000 (16:56 +0900)
If we devm get the micd_pol_gpio against the madera device it won't be
destroyed until after all the children of the MFD. Usually the
micd_pol_gpio will be supplied by the Madera GPIO driver, this means the
GPIO will normally only be freed after its driver has been removed.

Correct this issue by getting it against the extcon device such that the
GPIO is freed when the extcon device is destroyed, which should happen
before the GPIO device.

Change-Id: I35a3ee9eba7f9edf5c6aba47dd03f6e0ecbe9692
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
drivers/extcon/extcon-madera.c

index e0cfd4c6e02e0a7186466d79910fb8d0f6ee2537..dfc1215e22d0995e9030299f28f65340563c5c56 100644 (file)
@@ -2549,7 +2549,7 @@ static void madera_extcon_process_accdet_node(struct madera_extcon *info,
        else
                gpio_status = GPIOD_OUT_LOW;
 
-       info->micd_pol_gpio = devm_fwnode_get_gpiod_from_child(madera->dev,
+       info->micd_pol_gpio = devm_fwnode_get_gpiod_from_child(info->dev,
                                                        "cirrus,micd-pol",
                                                        node,
                                                        gpio_status,