mbox series

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

Message ID 1487952874-23635-1-git-send-email-benjamin.gaignard@linaro.org
Headers show
Series Introduce devm_of_platform_populate() helper | expand

Message

Benjamin Gaignard Feb. 24, 2017, 4:14 p.m. UTC
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(-)

Comments

Rob Herring Feb. 27, 2017, 1:30 p.m. UTC | #1
On Sun, Feb 26, 2017 at 2:11 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Fri, Feb 24, 2017 at 10:31:25AM -0600, Rob Herring wrote:
>> On Fri, Feb 24, 2017 at 10:14 AM, Benjamin Gaignard
>> <benjamin.gaignard@linaro.org> wrote:
>> > 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.
>> >
>> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
>> > ---
>> > version 2:
>> > - simplify function prototype to only keep device as parameter
>> >
>> >  drivers/of/platform.c       | 71 +++++++++++++++++++++++++++++++++++++++++++++
>> >  include/linux/of_platform.h | 11 +++++++
>> >  2 files changed, 82 insertions(+)
>>
>> For this and patch 2:
>>
>> Acked-by: Rob Herring <robh@kernel.org>
>
> Is this an ack for merging both through drm-misc, or should we do a
> topic-branch dance here?

You can apply it directly.

Rob
Daniel Vetter Feb. 27, 2017, 4:20 p.m. UTC | #2
On Mon, Feb 27, 2017 at 07:30:24AM -0600, Rob Herring wrote:
> On Sun, Feb 26, 2017 at 2:11 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Fri, Feb 24, 2017 at 10:31:25AM -0600, Rob Herring wrote:
> >> On Fri, Feb 24, 2017 at 10:14 AM, Benjamin Gaignard
> >> <benjamin.gaignard@linaro.org> wrote:
> >> > 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.
> >> >
> >> > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> >> > ---
> >> > version 2:
> >> > - simplify function prototype to only keep device as parameter
> >> >
> >> >  drivers/of/platform.c       | 71 +++++++++++++++++++++++++++++++++++++++++++++
> >> >  include/linux/of_platform.h | 11 +++++++
> >> >  2 files changed, 82 insertions(+)
> >>
> >> For this and patch 2:
> >>
> >> Acked-by: Rob Herring <robh@kernel.org>
> >
> > Is this an ack for merging both through drm-misc, or should we do a
> > topic-branch dance here?
> 
> You can apply it directly.

Ok, this seems like a pretty cool idea, so applied both to drm-misc for
4.12.

Cheers, Daniel