Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587764 > unrolled thread

[PATCH v2 0/2] Introduce devm_of_platform_populate() helper

Started byBenjamin Gaignard <benjamin.gaignard@linaro.org>
First post2017-02-24 17:20 +0100
Last post2017-02-24 17:20 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/2] Introduce devm_of_platform_populate() helper Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2017-02-24 17:20 +0100
    [PATCH v2 2/2] drm: sti: make driver use devm_of_platform_populate() Benjamin Gaignard <benjamin.gaignard@linaro.org> - 2017-02-24 17:20 +0100

#1587764 — [PATCH v2 0/2] Introduce devm_of_platform_populate() helper

FromBenjamin Gaignard <benjamin.gaignard@linaro.org>
Date2017-02-24 17:20 +0100
Subject[PATCH v2 0/2] Introduce devm_of_platform_populate() helper
Message-ID<teqL7-2Ds-3@gated-at.bofh.it>
version 2:
- simplify function prototype to only keep device as parameter
- rebased on v4.10

Lots of calls to of_platform_populate() are not unbalanced by a call
to of_platform_depopulate(). This create issues while drivers are
bind/unbind.
    
In way to solve those issues is to add devm_of_platform_populate()
which will call of_platform_depopulate() when the device is unbound
from the bus. This also could make drivers more robust in case that
probe failed after calling of_platform_populate().

Benjamin Gaignard (2):
  of: add devm_ functions for populate and depopulate
  drm: sti: make driver use devm_of_platform_populate()

 drivers/gpu/drm/sti/sti_drv.c |  3 +-
 drivers/of/platform.c         | 71 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/of_platform.h   | 11 +++++++
 3 files changed, 83 insertions(+), 2 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1587770 — [PATCH v2 2/2] drm: sti: make driver use devm_of_platform_populate()

FromBenjamin Gaignard <benjamin.gaignard@linaro.org>
Date2017-02-24 17:20 +0100
Subject[PATCH v2 2/2] drm: sti: make driver use devm_of_platform_populate()
Message-ID<teqL9-2Ds-51@gated-at.bofh.it>
In reply to#1587764
This make sure that of_platform_depopulate() is called if an error
occur in probe after populating the date from the device tree.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
version 2:
- use simplified devm_of_platform_populate function prototype

 drivers/gpu/drm/sti/sti_drv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index ff71e25..b26b1bc 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -438,7 +438,7 @@ static int sti_platform_probe(struct platform_device *pdev)
 
 	dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
 
-	of_platform_populate(node, NULL, NULL, dev);
+	devm_of_platform_populate(dev);
 
 	child_np = of_get_next_available_child(node, NULL);
 
@@ -454,7 +454,6 @@ static int sti_platform_probe(struct platform_device *pdev)
 static int sti_platform_remove(struct platform_device *pdev)
 {
 	component_master_del(&pdev->dev, &sti_ops);
-	of_platform_depopulate(&pdev->dev);
 
 	return 0;
 }
-- 
1.9.1

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web