[PATCH RFC] clk: add support for automatic parent handling

Mark Brown
2011-04-21T11:50:50Z

On Thu, Apr 21, 2011 at 11:21:53AM +0200, Thomas Gleixner wrote:
> On Thu, 21 Apr 2011, Sascha Hauer wrote:
> > On Wed, Apr 20, 2011 at 09:52:15PM +0200, Thomas Gleixner wrote:

> > > - a field for the base register
> > > - a struct for the offsets of the most common registers relative to
> > > base

> > What's wrong with embedding struct clk into a more specific clock and
> > access it with container_of()? It must be done anyway once a field is
> > missing in struct clk, or we end up with a lot of fields in struct clk
> > which are used in only few types of clocks.

> As I explained already, that's the whole purpose of frameworks. See
> clockevents, clocksource, genirq. Lots of stuff is only used by a very
> small subset, but it's better to have that in common code than growing
> warts at all ends.

There's nothing intrinsic about the concept of a clock which means that
it needs to be memory mapped or have a particular set of registers for
us to work with. This sounds like something that ought to be factored
out but it's not obvious to me that it should be part of the core struct.