Patch to add private notification data to block notifier.
RFC 1/1 Patch to add private notification data to block notifier.
We where trying to get pm-qos to work with a wireless driver and found that the idiom of passing the *dev in the callback (notification) parameters was not supported.
This makes having drivers as clients of PM-QOS sort of a challenge. The driver writer would have to mimic code in md.c where it keeps a list of all its instances and iterates over each upon notifier callback. Not that difficult but as the driver writers are so accustomed to having there instance data passed to them by the callers its a pain.
The following patch adds a void * private_data to the notifier_block, and an export for pm-qos to call.
this code compiles(tm), I want to get some feedback before I go too far down this path.
thanks,
--mgross
---------------
include/linux/notifier.h +4 -0
@@ -51,6 +51,7 @@ struct notifier_block {int (*notifier_call)(struct notifier_block *,unsigned long ,void *);struct notifier_block *next;int priority; +void *private_data; };struct atomic_notifier_head {
@@ -138,6 +139,9 @@ extern int blocking_notifier_call_chain(struct blocking_notifier_head *nh, unsigned long val, void *v);extern int __blocking_notifier_call_chain (struct blocking_notifier_head *nh,unsigned long val,void *v,int nr_to_call,int *nr_calls); +extern int __blocking_notifier_call_chain_parm ( +struct blocking_notifier_head *nh,unsigned long val,int nr_to_call, +int *nr_calls);extern int raw_notifier_call_chain (struct raw_notifier_head *nh,unsigned long val,void *v); extern int __raw_notifier_call_chain(struct raw_notifier_head *nh,
kernel/notifier.c +74 -0
86 lines not on this page · raw message
kernel/pm_qos_params.c +3 -2
@@ -158,8 +158,9 @@ static void update_target(int target)spin_unlock_irqrestore (&pm_qos_lock, flags);if (call_notifier) -blocking_notifier_call_chain (pm_qos_array[target]->notifiers, - (unsigned long ) extreme_value,NULL ); +__blocking_notifier_call_chain_parm ( + pm_qos_array[target]->notifiers, + (unsigned long ) extreme_value,-1 ,NULL ); }static int register_pm_qos_misc (struct pm_qos_object *qos)