Re: [PATCH][2.5.35] CPUfreq documentation (4/5)

From: Russell King (rmk@arm.linux.org.uk)
Date: Tue Sep 17 2002 - 06:00:33 EST


On Tue, Sep 17, 2002 at 12:19:37PM +0200, Xavier Bestel wrote:
> Le mar 17/09/2002 à 11:35, Dominik Brodowski a écrit :
>
> > +The third argument, a void *pointer, points to a struct cpufreq_freqs
> > +consisting of five values: cpu, min, max, policy and max_cpu_freq. Min
> > +and max are the lower and upper frequencies (in kHz) of the new
> > +policy, policy the new policy, cpu the number of the affected CPU or
> > +CPUFREQ_ALL_CPUS for all CPUs; and max_cpu_freq the maximum supported
> > +CPU frequency. This value is given for informational purposes only.
>
> - Why choosing a void* ? that doesn't validate type ..

That's the type specified by the notifier code. You have two choices:

int notifier_foo(struct notifier_block *nb, int foo, void *bar)
{
        struct my_bar *my = bar;
}

struct notifier_block nb = {
        .notifier_call = notifier_foo,
};

OR:

int notifier_foo(struct notifier_block *nb, int foo, struct my_bar *my)
{
}

struct notifier_block nb = {
        .notifier_call = (int (*)(struct notifier_block *, int, void *))notifier_foo,
};

So, you end up with a cast in one place or the other. I know which one
I prefer.

> - The struct cpufreq_freqs actually consists of only three values (cpu,
> old, new). The five values you cite here are in the struct
> cpufreq_policy.

Yep, it's a little unclear.

The policy notifiers are called with struct cpufreq_policy, which have
five values. The transition notifiers are called with struct
cpufreq_freqs, which has three values.

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:19 EST