diff mbox

[1/5] iio: exynos_adc: use indio_dev->dev structure to handle child nodes

Message ID 1398420888-5506-2-git-send-email-ch.naveen@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Naveen Krishna Chatradhi April 25, 2014, 10:14 a.m. UTC
From: Naveen Krishna Ch <ch.naveen@samsung.com>

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 <ch.naveen@samsung.com>
---
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(-)

Comments

Doug Anderson April 25, 2014, 3:46 p.m. UTC | #1
Naveen,

Thanks for sending this.  Given that Jonathan Cameron was involved in
the previous discussion, it probably would have been wise to include
him on the CC list.

On Fri, Apr 25, 2014 at 3:14 AM, Naveen Krishna Chatradhi
<ch.naveen@samsung.com> wrote:
> From: Naveen Krishna Ch <ch.naveen@samsung.com>
>
> 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 <ch.naveen@samsung.com>
> ---
> 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(-)

Reported-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jonathan Cameron April 26, 2014, 12:53 p.m. UTC | #2
On 25/04/14 16:46, Doug Anderson wrote:
> Naveen,
>
> Thanks for sending this.  Given that Jonathan Cameron was involved in
> the previous discussion, it probably would have been wise to include
> him on the CC list.
In my case, don't worry too much as I have linux-iio coming into exactly
the same place in my inbox. Doug is correct that it is generally a good
idea unless someone has asked you not to.
>
> On Fri, Apr 25, 2014 at 3:14 AM, Naveen Krishna Chatradhi
> <ch.naveen@samsung.com> wrote:
>> From: Naveen Krishna Ch <ch.naveen@samsung.com>
>>
>> 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 <ch.naveen@samsung.com>
>> ---
>> 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(-)
>
> Reported-by: Doug Anderson <dianders@chromium.org>
> Reviewed-by: Doug Anderson <dianders@chromium.org>
> Tested-by: Doug Anderson <dianders@chromium.org>
Applied to the fixes-togreg branch of iio.git

Thanks,
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Naveen Krishna Ch April 26, 2014, 1:51 p.m. UTC | #3
Hello Jonathan,

On 26 April 2014 18:23, Jonathan Cameron <jic23@kernel.org> wrote:
> On 25/04/14 16:46, Doug Anderson wrote:
>>
>> Naveen,
>>
>> Thanks for sending this.  Given that Jonathan Cameron was involved in
>> the previous discussion, it probably would have been wise to include
>> him on the CC list.
>
> In my case, don't worry too much as I have linux-iio coming into exactly
> the same place in my inbox. Doug is correct that it is generally a good
> idea unless someone has asked you not to.
Sure, will make it a habit.
>
>>
>> On Fri, Apr 25, 2014 at 3:14 AM, Naveen Krishna Chatradhi
>> <ch.naveen@samsung.com> wrote:
>>>
>>> From: Naveen Krishna Ch <ch.naveen@samsung.com>
>>>
>>> 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 <ch.naveen@samsung.com>
>>> ---
>>> 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(-)
>>
>>
>> Reported-by: Doug Anderson <dianders@chromium.org>
>> Reviewed-by: Doug Anderson <dianders@chromium.org>
>> Tested-by: Doug Anderson <dianders@chromium.org>
>
> Applied to the fixes-togreg branch of iio.git
I've submitted the v2.
Kindly, review the other 4 patches in this series.
Thanks
>
> Thanks.
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
diff mbox

Patch

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);