On Wed, 26 Mar 2008 19:52:34 +0300 Dmitry <dbaryshkov@gmail.com> wrote:I think it would definitely help to combine some hooks into one. enable/disable is one example, set_rate/round_rate is another. Hmm. Missing documentation makes it harder to review this stuff... If the only advantage is less code duplication, I'd say it's too much. However... ...that is a good argument. External clock generators come to mind...they can even be parents for other clocks. Sure, but then I won't be able to use the suggested drivers that depend on this stuff. How about we try to slim things down a bit? Let's see... I guess these are always required if we're going to do dynamic registration... This will probably be unused for most platforms, but I guess we need it to get the advantage you're talking about. Reference counting, probably need that too. This one is redundant. Use getrate() instead. Huh? A delay after enabling the clock? Why can't the enable() hook do that if it's really necessary? What's this for? I'm assuming it's necessary to couple clocks to specific devices? We probably need this. Combine these into "mode" or something (with an extra parameter) We need this one. Combine these into one call with an extra "apply" parameter or something. The underlying logic is pretty much the same apart from the "actually write stuff to registers" step. Remove this and let platforms extend the struct instead. They can use container_of() to access the extra fields, which is faster too. The result is something like this: struct clk { struct list_head node; struct clk *parent; const char *name; struct module *owner; int users; int (*can_get) (struct clk *, struct device *); int (*set_parent) (struct clk *, struct clk *); int (*mode) (struct clk *, bool enabled); unsigned long (*getrate) (struct clk*); int (*setrate) (struct clk *, unsigned long, bool apply); }; which is 44 bytes, 12 bytes more than the avr32 version. That can probably be explained by the "node" and "owner" fields, which really are necessary in order to support dynamic registration of clocks. Adding the "dev" and "index" fields takes us to 52 bytes, or 20 bytes more. That's about 1.1K extra in total for 55 clocks, which is still a bit much, but I can probably live with that. Haavard --
| Arjan van de Ven | [patch] Add basic sanity checks to the syscall execution patch |
| debian developer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| monstr | Microblaze init port |
| Linus Torvalds | Re: Back to the future. |
git: | |
| Petr Baudis | Re: Cleaning up git user-interface warts |
| Jan Engelhardt | about c8af1de9 (git status uses pager) |
| Jakub Narebski | Re: VCS comparison table |
| Linus Torvalds | Re: kernel.org mirroring (Re: [GIT PULL] MMC update) |
| Richard Stallman | Real men don't attack straw men |
| Marco Peereboom | Re: Real men don't attack straw men |
| David Newman | setting dscp or tos bits |
| Khalid Schofield | Configuring sendmail openbsd 4.2 |
| Christoph Hellwig | Re: [PATCH RFC] [1/9] Core module symbol namespaces code and intro. |
| Josip Rodin | bnx2_poll panicking kernel |
| Johannes Berg | [RFC v2] mac80211: assign needed_headroom/tailroom for netdevs |
| Francois Romieu | Re: NAPI, rx_no_buffer_count, e1000, r8169 and other actors |
