From patchwork Sat Apr 26 11:37:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen Krishna Chatradhi X-Patchwork-Id: 4068101 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23DB4BFF02 for ; Sat, 26 Apr 2014 11:43:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 518D920279 for ; Sat, 26 Apr 2014 11:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4525320274 for ; Sat, 26 Apr 2014 11:43:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752511AbaDZLmn (ORCPT ); Sat, 26 Apr 2014 07:42:43 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:57122 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbaDZLjm (ORCPT ); Sat, 26 Apr 2014 07:39:42 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4M0021MZ251Z60@mailout3.samsung.com>; Sat, 26 Apr 2014 20:39:41 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 0A.75.18501.CFA9B535; Sat, 26 Apr 2014 20:39:41 +0900 (KST) X-AuditID: cbfee68d-b7f4e6d000004845-5c-535b9afc9757 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 7E.08.27725.CFA9B535; Sat, 26 Apr 2014 20:39:40 +0900 (KST) Received: from chnaveen-ubuntu.sisodomain.com ([107.108.83.161]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4M00JX6Z1YTP80@mmp2.samsung.com>; Sat, 26 Apr 2014 20:39:40 +0900 (KST) From: Naveen Krishna Chatradhi To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, dianders@chromium.org, gregkh@linuxfoundation.org, naveenkrishna.ch@gmail.com, lars@metafoo.de, cpgs@samsung.com, grundler@chromium.org, jic23@kernel.org, Naveen Krishna Ch Subject: [PATCH 1/5 v2] iio: exynos_adc: use indio_dev->dev structure to handle child nodes Date: Sat, 26 Apr 2014 17:07:52 +0530 Message-id: <1398512276-4105-2-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1398512276-4105-1-git-send-email-ch.naveen@samsung.com> References: <1398512276-4105-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRmVeSWpSXmKPExsWyRsSkTvfvrOhgg1d72SzuPj/MaPHykKbF 2WUH2SyaF69ns3h15AeTxYOmVUwWSybPZ7WYd+Qdi8XlXXPYLGac38dksWjbf2YHbo/ZDRdZ PHbOusvusWlVJ5vH/rlr2D2WvDnE6tG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZXa3f2Qo2 81ecWbyavYFxIm8XIyeHhICJRMPuVcwQtpjEhXvr2boYuTiEBJYySlw5cZcJpujDy9ksEInp jBL/p75hhXD6mSSWn/gFVsUmYCZxcNFq9i5GDg4RAVmJmd16IDXMIDUNTy8ygsSFBWIlTh9m BSlnEVCV6OxYCtbKK+Ai8XX6GWaQEgkBBYk5k2xAwpwCrhITF10FKxECKnk78TU7yEgJgVPs El2/3rFBzBGQ+Db5EAtEr6zEpgNQz0hKHF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GYLEwenVANjSk1E7vL31XffK/4o DXkhVvqdN/Oics0SRocT2tfOWL/68Ub66OSeWVGMF+b5TdK5/J1r95yWR+4fcvc2Tt14s3Xf rPKZZX7v9OyMu+X8+v3KREQfn+ks6apomfNhS/i7zctDhb9p17SIV81Ke/dnaTnDSseiHke2 CaYsa7aa5UbvWnvx449GJZbijERDLeai4kQAKl1uEgIDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Naveen Krishna Ch Using pdev->dev with device_for_each_child() would iterate over all of the children of the platform device and delete them. Thus, causing crashes during module unload. We should be using the indio_dev->dev structure for registering/unregistering child nodes. Signed-off-by: Naveen Krishna Ch Reported-by: Doug Anderson Reviewed-by: Doug Anderson Tested-by: Doug Anderson --- This change was tested on top of https://lkml.org/lkml/2014/4/21/481 from Doug. drivers/iio/adc/exynos_adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index d25b262..affa93f 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -344,7 +344,7 @@ static int exynos_adc_probe(struct platform_device *pdev) exynos_adc_hw_init(info); - ret = of_platform_populate(np, exynos_adc_match, NULL, &pdev->dev); + ret = of_platform_populate(np, exynos_adc_match, NULL, &indio_dev->dev); if (ret < 0) { dev_err(&pdev->dev, "failed adding child nodes\n"); goto err_of_populate; @@ -353,7 +353,7 @@ static int exynos_adc_probe(struct platform_device *pdev) return 0; err_of_populate: - device_for_each_child(&pdev->dev, NULL, + device_for_each_child(&indio_dev->dev, NULL, exynos_adc_remove_devices); regulator_disable(info->vdd); clk_disable_unprepare(info->clk); @@ -369,7 +369,7 @@ static int exynos_adc_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct exynos_adc *info = iio_priv(indio_dev); - device_for_each_child(&pdev->dev, NULL, + device_for_each_child(&indio_dev->dev, NULL, exynos_adc_remove_devices); regulator_disable(info->vdd); clk_disable_unprepare(info->clk);