B1;2005;0cPeter,
On Tue, 27 Apr 2010, Peter P Waskiewicz Jr wrote:
Grr, I knew that I missed something. That'll teach me to review
patches before the coffee has reached my brain cells :)
So you need a reference to your device, so what about the following:
struct irq_affinity_hint;
struct irq_affinity_hint {
unsigned int (*callback)(unsigned int irq, struct irq_affinity_hint *hint,
cpumask_var_t *mask);
}
Now you embed that struct into your device private data structure and
you get the reference to it back in the callback function. No extra
kmalloc/kfree, less code.
One other thing I noticed, but forgot to comment on:
Why do we return 0, when there is no callback and no hint available ?
We don't want to have cpumask enforced on stack. Please make that:
cpumask_var_t mask;
if (!alloc_cpumask_var(&mask, GFP_KERNEL))
return -ENOMEM;
The access to desc-> needs to be protected with
desc->lock. Otherwise you might race with a callback unregister.
Thanks,
tglx
--