From patchwork Fri Apr 25 10:14:43 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: 4058881 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 57BE39F3EE for ; Fri, 25 Apr 2014 10:16:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9491A2039D for ; Fri, 25 Apr 2014 10:16:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7388F203A9 for ; Fri, 25 Apr 2014 10:16:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752873AbaDYKQr (ORCPT ); Fri, 25 Apr 2014 06:16:47 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:28099 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752636AbaDYKQi (ORCPT ); Fri, 25 Apr 2014 06:16:38 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4L00LSU0JOVK80@mailout1.samsung.com>; Fri, 25 Apr 2014 19:16:36 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.122]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id E5.8D.11496.4063A535; Fri, 25 Apr 2014 19:16:36 +0900 (KST) X-AuditID: cbfee691-b7f3e6d000002ce8-e4-535a36047346 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 12.62.25708.4063A535; Fri, 25 Apr 2014 19:16:36 +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 <0N4L00LYZ0JCQJ30@mmp2.samsung.com>; Fri, 25 Apr 2014 19:16:35 +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, Naveen Krishna Ch Subject: [PATCH 1/5] iio: exynos_adc: use indio_dev->dev structure to handle child nodes Date: Fri, 25 Apr 2014 15:44:43 +0530 Message-id: <1398420888-5506-2-git-send-email-ch.naveen@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1398420888-5506-1-git-send-email-ch.naveen@samsung.com> References: <1398420888-5506-1-git-send-email-ch.naveen@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42JZI2JSpctiFhVs8KdNw+Lu88OMFi8PaVqc XXaQzaJ58Xo2i1dHfjBZLJk8n9Vi3pF3LBaXd81hs5hxfh+TxaJt/5kduDxmN1xk8dg56y67 x/65a9g9lrw5xOrRt2UVo8fnTXIBbFFcNimpOZllqUX6dglcGQf7n7IWzOSr+PT/MXsDYxtP FyMHh4SAicSBiyFdjJxAppjEhXvr2boYuTiEBJYySvy4+IcZImEisXHmMlaIxHRGiT99U6Cc fiaJHe33GUGq2ATMJA4uWs0OMlVEQFZiZrceSA2zwF9GiXkvt4DVCAtESVxf1c8CYrMIqEqs ef+DHcTmFXCRmP3nLjvERQoScybZgIQ5BVwl1u8+xgpiCwGV3N/yB2yvhMAhdonTp5+zQ8wR kPg2+RALRK+sxKYDUEdLShxccYNlAqPwAkaGVYyiqQXJBcVJ6UWmesWJ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VZiY+oX5y1Sez3p7Uabh3NyUBetWrX9mt/vtidSqJVO3ptRz z6x6JzSd88fFl0+Sdq71eb3H0Evu8qlj181PCzz9nDTt4JT3i7mnnOw/sMT/WO7C9M0fW068 3cDAdzsvq8xbiaU4I9FQi7moOBEAqqtjqvkCAAA= 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);