* Russell King - ARM Linux wrote:
> On Tue, Feb 07, 2012 at 08:04:00AM +0100, Thierry Reding wrote:
> > One of the major problems when converting to a non-global namespace is how 
> > to
> > represent the relationship in code. For device tree this should be easy to 
> > do
> > because it has all the infrastructure in place. For non-device-tree devices 
> > I
> > have no idea yet how this could be done. Perhaps by using something like the
> > clock API and using names for lookup?
> 
> Well, the first step is to make sure that the pwm 'chip' drivers don't
> know anything about the global numberspace.
> 
> That limits the extent of the global numberspace to the pwm core and
> pwm users.  You then don't have to worry about the pwm chip drivers
> while you work out how to solve the other half of the problem.

I see. That would mean that pwm_request() gets a global PWM index, looks up
the corresponding PWM chip and device then pass the chip-relative index to
the driver's ops.

I think that can be simplified even further. For instance if the pwm_device
structure contains a pointer to its parent struct pwm_chip, then that can be
used directly to call into the driver's ops. And the ops could be modified to
take a pwm_device instead of the global PWM index. That would be similar to
how struct irq_data is used.

Thierry

Attachment: pgpRJqVeNdq9E.pgp
Description: PGP signature

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

Reply via email to