Re: [PATCH 1/5] pdev: Fix platform device resource linking

Greg Kroah-Hartman
2013-08-06T10:14:11Z

On Tue, Aug 06, 2013 at 12:45:42PM +0300, Pantelis Antoniou wrote:
> Hi Greg,
>
> On Aug 6, 2013, at 12:36 PM, Greg Kroah-Hartman wrote:
>
> > On Tue, Aug 06, 2013 at 10:53:40AM +0300, Pantelis Antoniou wrote:
> >> Platform device removal uncovered a number of problems with
> >> the way resources are handled in the core platform code.
> >>
> >> Resources now form child/parent linkages and this requires
> >> proper linking of the resources. On top of that the OF core
> >> directly creates it's own platform devices. Simplify things
> >> by providing helper functions that manage the linking properly.
> >
> > Ugh, the OF core shouldn't be creating platform devices. Well, yes, I
> > know it does that today, but ick, ick, ick.
> >
>
> Yep, ick, ick, ick is the correct form.
>
> >> Two functions are provided:
> >>
> >> platform_device_link_resources(), which links all the
> >> linkable resources (if not already linked).
> >>
> >> and platform_device_unlink_resources(), which unlinks all the
> >> resources.
> >
> > Why would anyone need to call this? I'm getting the feeling that OF
> > should just have it's own bus of devices to handle this type of mess.
> > ACPI is going through the same rewrite for this same type of problem
> > (they did things differently.) I suggest you work with the ACPI
> > developers to so the same thing they are, to solve it correctly for
> > everyone.
> >
>
> It's the same problem really. Another bus type might not fly well.
> The same device driver should be (in theory) be made to work unchanged
> either on an OF/ACPI/Fex( :) ) setup.

No, that's not quite true, a driver needs to know how to talk to the
bus, as that is how it communicates to the hardware. It can be done for
different types of busses (see the OHCI USB controller for one example
of this), but a driver will have to know what type of bus it is on in
order to work properly.

> What would it take to move all this into driver core?

What specifically would you move into there?

thanks,

greg k-h