Messages in this thread | | | From | Bruno Randolf <> | Subject | Re: [PATCH v6] Add generic exponentially weighted moving average (EWMA) function | Date | Fri, 12 Nov 2010 10:44:40 +0900 |
| |
On Fri November 12 2010 03:17:34 Stefan Richter wrote: > It seems totally clear-cut to me that code like this is submitted together > with at least one call site, and it is submitted through the tree in which > that call site is maintained.
Ok. So I'll re-send the patch thru John's wireless tree after I fixed up your comments.
> >> (And it's a bit sad that the function will exist in the base vmlinux > >> even for people who don't ever use it, but that's a problem which we > >> don't really have a good solution for). > > > > Hmm, should I switch it back to all inlines? > > Add a hidden Kconfig variable for it which is SELECTed by those Kconfig > prompts that require it? That's the good solution that we use for a number > of similar library functions. > $ cat lib/Makefile
Ok.
> You use WARN_ON in lib/average.c. You should include <linux/bug.h>.
Thanks.
> Why do ewma_init() and ewma_add() return their first argument? They look > to me like they can be straight-forward void functions.
You are right, for ewma_init() it does not make sense.
For ewma_add() I think it does. This has been discussed before (e.g. http://linux.derkeiler.com/Mailing-Lists/Kernel/2010-10/msg09124.html). Some people might want to get the value when they add a sample by using ewma_get(ewma_add(&ewma, val));
Bruno
| |