* [PATCH] rfkill: strip pointless notifier chain
@ 2008-12-10 16:48 Johannes Berg
2008-12-10 17:01 ` Ivo van Doorn
2008-12-10 17:40 ` Ivo van Doorn
0 siblings, 2 replies; 6+ messages in thread
From: Johannes Berg @ 2008-12-10 16:48 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless
No users, so no reason to have it.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
include/linux/rfkill.h | 7 ----
net/rfkill/rfkill.c | 83 ++-----------------------------------------------
2 files changed, 5 insertions(+), 85 deletions(-)
--- everything.orig/include/linux/rfkill.h 2008-12-10 17:30:35.000000000 +0100
+++ everything/include/linux/rfkill.h 2008-12-10 17:30:39.000000000 +0100
@@ -149,11 +149,4 @@ static inline char *rfkill_get_led_name(
#endif
}
-/* rfkill notification chain */
-#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
- switch has changed */
-
-int register_rfkill_notifier(struct notifier_block *nb);
-int unregister_rfkill_notifier(struct notifier_block *nb);
-
#endif /* RFKILL_H */
--- everything.orig/net/rfkill/rfkill.c 2008-12-10 17:32:17.000000000 +0100
+++ everything/net/rfkill/rfkill.c 2008-12-10 17:35:38.000000000 +0100
@@ -53,51 +53,6 @@ static struct rfkill_gsw_state rfkill_gl
static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)];
static bool rfkill_epo_lock_active;
-static BLOCKING_NOTIFIER_HEAD(rfkill_notifier_list);
-
-
-/**
- * register_rfkill_notifier - Add notifier to rfkill notifier chain
- * @nb: pointer to the new entry to add to the chain
- *
- * See blocking_notifier_chain_register() for return value and further
- * observations.
- *
- * Adds a notifier to the rfkill notifier chain. The chain will be
- * called with a pointer to the relevant rfkill structure as a parameter,
- * refer to include/linux/rfkill.h for the possible events.
- *
- * Notifiers added to this chain are to always return NOTIFY_DONE. This
- * chain is a blocking notifier chain: notifiers can sleep.
- *
- * Calls to this chain may have been done through a workqueue. One must
- * assume unordered asynchronous behaviour, there is no way to know if
- * actions related to the event that generated the notification have been
- * carried out already.
- */
-int register_rfkill_notifier(struct notifier_block *nb)
-{
- BUG_ON(!nb);
- return blocking_notifier_chain_register(&rfkill_notifier_list, nb);
-}
-EXPORT_SYMBOL_GPL(register_rfkill_notifier);
-
-/**
- * unregister_rfkill_notifier - remove notifier from rfkill notifier chain
- * @nb: pointer to the entry to remove from the chain
- *
- * See blocking_notifier_chain_unregister() for return value and further
- * observations.
- *
- * Removes a notifier from the rfkill notifier chain.
- */
-int unregister_rfkill_notifier(struct notifier_block *nb)
-{
- BUG_ON(!nb);
- return blocking_notifier_chain_unregister(&rfkill_notifier_list, nb);
-}
-EXPORT_SYMBOL_GPL(unregister_rfkill_notifier);
-
static void rfkill_led_trigger(struct rfkill *rfkill,
enum rfkill_state state)
@@ -124,12 +79,9 @@ static void rfkill_led_trigger_activate(
}
#endif /* CONFIG_RFKILL_LEDS */
-static void notify_rfkill_state_change(struct rfkill *rfkill)
+static void rfkill_uevent(struct rfkill *rfkill)
{
- rfkill_led_trigger(rfkill, rfkill->state);
- blocking_notifier_call_chain(&rfkill_notifier_list,
- RFKILL_STATE_CHANGED,
- rfkill);
+ kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
}
static void update_rfkill_state(struct rfkill *rfkill)
@@ -142,7 +94,7 @@ static void update_rfkill_state(struct r
oldstate = rfkill->state;
rfkill->state = newstate;
if (oldstate != newstate)
- notify_rfkill_state_change(rfkill);
+ rfkill_uevent(rfkill);
}
mutex_unlock(&rfkill->mutex);
}
@@ -220,7 +172,7 @@ static int rfkill_toggle_radio(struct rf
}
if (force || rfkill->state != oldstate)
- notify_rfkill_state_change(rfkill);
+ rfkill_uevent(rfkill);
return retval;
}
@@ -405,7 +357,7 @@ int rfkill_force_state(struct rfkill *rf
rfkill->state = state;
if (state != oldstate)
- notify_rfkill_state_change(rfkill);
+ rfkill_uevent(rfkill);
mutex_unlock(&rfkill->mutex);
@@ -618,28 +570,6 @@ static int rfkill_resume(struct device *
#define rfkill_resume NULL
#endif
-static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
- unsigned long eventid,
- void *data)
-{
- struct rfkill *rfkill = (struct rfkill *)data;
-
- switch (eventid) {
- case RFKILL_STATE_CHANGED:
- kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
- break;
- default:
- break;
- }
-
- return NOTIFY_DONE;
-}
-
-static struct notifier_block rfkill_blocking_uevent_nb = {
- .notifier_call = rfkill_blocking_uevent_notifier,
- .priority = 0,
-};
-
static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct rfkill *rfkill = to_rfkill(dev);
@@ -943,14 +873,11 @@ static int __init rfkill_init(void)
return error;
}
- register_rfkill_notifier(&rfkill_blocking_uevent_nb);
-
return 0;
}
static void __exit rfkill_exit(void)
{
- unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
class_unregister(&rfkill_class);
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rfkill: strip pointless notifier chain
2008-12-10 16:48 [PATCH] rfkill: strip pointless notifier chain Johannes Berg
@ 2008-12-10 17:01 ` Ivo van Doorn
2008-12-10 17:20 ` Johannes Berg
2008-12-10 17:40 ` Ivo van Doorn
1 sibling, 1 reply; 6+ messages in thread
From: Ivo van Doorn @ 2008-12-10 17:01 UTC (permalink / raw)
To: Johannes Berg, Henrique de Moraes Holschuh; +Cc: John Linville, linux-wireless
On Wednesday 10 December 2008, Johannes Berg wrote:
> No users, so no reason to have it.
Henrique, you introduced the notifier chain, are there any upcoming
users for it or can it indeed be removed?
Ivo
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> include/linux/rfkill.h | 7 ----
> net/rfkill/rfkill.c | 83 ++-----------------------------------------------
> 2 files changed, 5 insertions(+), 85 deletions(-)
>
> --- everything.orig/include/linux/rfkill.h 2008-12-10 17:30:35.000000000 +0100
> +++ everything/include/linux/rfkill.h 2008-12-10 17:30:39.000000000 +0100
> @@ -149,11 +149,4 @@ static inline char *rfkill_get_led_name(
> #endif
> }
>
> -/* rfkill notification chain */
> -#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
> - switch has changed */
> -
> -int register_rfkill_notifier(struct notifier_block *nb);
> -int unregister_rfkill_notifier(struct notifier_block *nb);
> -
> #endif /* RFKILL_H */
> --- everything.orig/net/rfkill/rfkill.c 2008-12-10 17:32:17.000000000 +0100
> +++ everything/net/rfkill/rfkill.c 2008-12-10 17:35:38.000000000 +0100
> @@ -53,51 +53,6 @@ static struct rfkill_gsw_state rfkill_gl
> static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)];
> static bool rfkill_epo_lock_active;
>
> -static BLOCKING_NOTIFIER_HEAD(rfkill_notifier_list);
> -
> -
> -/**
> - * register_rfkill_notifier - Add notifier to rfkill notifier chain
> - * @nb: pointer to the new entry to add to the chain
> - *
> - * See blocking_notifier_chain_register() for return value and further
> - * observations.
> - *
> - * Adds a notifier to the rfkill notifier chain. The chain will be
> - * called with a pointer to the relevant rfkill structure as a parameter,
> - * refer to include/linux/rfkill.h for the possible events.
> - *
> - * Notifiers added to this chain are to always return NOTIFY_DONE. This
> - * chain is a blocking notifier chain: notifiers can sleep.
> - *
> - * Calls to this chain may have been done through a workqueue. One must
> - * assume unordered asynchronous behaviour, there is no way to know if
> - * actions related to the event that generated the notification have been
> - * carried out already.
> - */
> -int register_rfkill_notifier(struct notifier_block *nb)
> -{
> - BUG_ON(!nb);
> - return blocking_notifier_chain_register(&rfkill_notifier_list, nb);
> -}
> -EXPORT_SYMBOL_GPL(register_rfkill_notifier);
> -
> -/**
> - * unregister_rfkill_notifier - remove notifier from rfkill notifier chain
> - * @nb: pointer to the entry to remove from the chain
> - *
> - * See blocking_notifier_chain_unregister() for return value and further
> - * observations.
> - *
> - * Removes a notifier from the rfkill notifier chain.
> - */
> -int unregister_rfkill_notifier(struct notifier_block *nb)
> -{
> - BUG_ON(!nb);
> - return blocking_notifier_chain_unregister(&rfkill_notifier_list, nb);
> -}
> -EXPORT_SYMBOL_GPL(unregister_rfkill_notifier);
> -
>
> static void rfkill_led_trigger(struct rfkill *rfkill,
> enum rfkill_state state)
> @@ -124,12 +79,9 @@ static void rfkill_led_trigger_activate(
> }
> #endif /* CONFIG_RFKILL_LEDS */
>
> -static void notify_rfkill_state_change(struct rfkill *rfkill)
> +static void rfkill_uevent(struct rfkill *rfkill)
> {
> - rfkill_led_trigger(rfkill, rfkill->state);
> - blocking_notifier_call_chain(&rfkill_notifier_list,
> - RFKILL_STATE_CHANGED,
> - rfkill);
> + kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
> }
>
> static void update_rfkill_state(struct rfkill *rfkill)
> @@ -142,7 +94,7 @@ static void update_rfkill_state(struct r
> oldstate = rfkill->state;
> rfkill->state = newstate;
> if (oldstate != newstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
> }
> mutex_unlock(&rfkill->mutex);
> }
> @@ -220,7 +172,7 @@ static int rfkill_toggle_radio(struct rf
> }
>
> if (force || rfkill->state != oldstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
>
> return retval;
> }
> @@ -405,7 +357,7 @@ int rfkill_force_state(struct rfkill *rf
> rfkill->state = state;
>
> if (state != oldstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
>
> mutex_unlock(&rfkill->mutex);
>
> @@ -618,28 +570,6 @@ static int rfkill_resume(struct device *
> #define rfkill_resume NULL
> #endif
>
> -static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
> - unsigned long eventid,
> - void *data)
> -{
> - struct rfkill *rfkill = (struct rfkill *)data;
> -
> - switch (eventid) {
> - case RFKILL_STATE_CHANGED:
> - kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
> - break;
> - default:
> - break;
> - }
> -
> - return NOTIFY_DONE;
> -}
> -
> -static struct notifier_block rfkill_blocking_uevent_nb = {
> - .notifier_call = rfkill_blocking_uevent_notifier,
> - .priority = 0,
> -};
> -
> static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> struct rfkill *rfkill = to_rfkill(dev);
> @@ -943,14 +873,11 @@ static int __init rfkill_init(void)
> return error;
> }
>
> - register_rfkill_notifier(&rfkill_blocking_uevent_nb);
> -
> return 0;
> }
>
> static void __exit rfkill_exit(void)
> {
> - unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
> class_unregister(&rfkill_class);
> }
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rfkill: strip pointless notifier chain
2008-12-10 17:01 ` Ivo van Doorn
@ 2008-12-10 17:20 ` Johannes Berg
2008-12-10 17:40 ` Ivo van Doorn
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2008-12-10 17:20 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: Henrique de Moraes Holschuh, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 336 bytes --]
On Wed, 2008-12-10 at 18:01 +0100, Ivo van Doorn wrote:
> On Wednesday 10 December 2008, Johannes Berg wrote:
> > No users, so no reason to have it.
>
> Henrique, you introduced the notifier chain, are there any upcoming
> users for it or can it indeed be removed?
It can be added back with the users when needed.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rfkill: strip pointless notifier chain
2008-12-10 17:20 ` Johannes Berg
@ 2008-12-10 17:40 ` Ivo van Doorn
2008-12-10 17:41 ` Johannes Berg
0 siblings, 1 reply; 6+ messages in thread
From: Ivo van Doorn @ 2008-12-10 17:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: Henrique de Moraes Holschuh, John Linville, linux-wireless
On Wednesday 10 December 2008, Johannes Berg wrote:
> On Wed, 2008-12-10 at 18:01 +0100, Ivo van Doorn wrote:
> > On Wednesday 10 December 2008, Johannes Berg wrote:
> > > No users, so no reason to have it.
> >
> > Henrique, you introduced the notifier chain, are there any upcoming
> > users for it or can it indeed be removed?
>
> It can be added back with the users when needed.
Fine, but I was more thinking about how soon would such an upcoming
user arrive. There is no point in deleting the interface when it will
be added within a couple of days.
Anyway, I'll add my ack to the patch.
Ivo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rfkill: strip pointless notifier chain
2008-12-10 16:48 [PATCH] rfkill: strip pointless notifier chain Johannes Berg
2008-12-10 17:01 ` Ivo van Doorn
@ 2008-12-10 17:40 ` Ivo van Doorn
1 sibling, 0 replies; 6+ messages in thread
From: Ivo van Doorn @ 2008-12-10 17:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless
On Wednesday 10 December 2008, Johannes Berg wrote:
> No users, so no reason to have it.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
> ---
> include/linux/rfkill.h | 7 ----
> net/rfkill/rfkill.c | 83 ++-----------------------------------------------
> 2 files changed, 5 insertions(+), 85 deletions(-)
>
> --- everything.orig/include/linux/rfkill.h 2008-12-10 17:30:35.000000000 +0100
> +++ everything/include/linux/rfkill.h 2008-12-10 17:30:39.000000000 +0100
> @@ -149,11 +149,4 @@ static inline char *rfkill_get_led_name(
> #endif
> }
>
> -/* rfkill notification chain */
> -#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
> - switch has changed */
> -
> -int register_rfkill_notifier(struct notifier_block *nb);
> -int unregister_rfkill_notifier(struct notifier_block *nb);
> -
> #endif /* RFKILL_H */
> --- everything.orig/net/rfkill/rfkill.c 2008-12-10 17:32:17.000000000 +0100
> +++ everything/net/rfkill/rfkill.c 2008-12-10 17:35:38.000000000 +0100
> @@ -53,51 +53,6 @@ static struct rfkill_gsw_state rfkill_gl
> static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)];
> static bool rfkill_epo_lock_active;
>
> -static BLOCKING_NOTIFIER_HEAD(rfkill_notifier_list);
> -
> -
> -/**
> - * register_rfkill_notifier - Add notifier to rfkill notifier chain
> - * @nb: pointer to the new entry to add to the chain
> - *
> - * See blocking_notifier_chain_register() for return value and further
> - * observations.
> - *
> - * Adds a notifier to the rfkill notifier chain. The chain will be
> - * called with a pointer to the relevant rfkill structure as a parameter,
> - * refer to include/linux/rfkill.h for the possible events.
> - *
> - * Notifiers added to this chain are to always return NOTIFY_DONE. This
> - * chain is a blocking notifier chain: notifiers can sleep.
> - *
> - * Calls to this chain may have been done through a workqueue. One must
> - * assume unordered asynchronous behaviour, there is no way to know if
> - * actions related to the event that generated the notification have been
> - * carried out already.
> - */
> -int register_rfkill_notifier(struct notifier_block *nb)
> -{
> - BUG_ON(!nb);
> - return blocking_notifier_chain_register(&rfkill_notifier_list, nb);
> -}
> -EXPORT_SYMBOL_GPL(register_rfkill_notifier);
> -
> -/**
> - * unregister_rfkill_notifier - remove notifier from rfkill notifier chain
> - * @nb: pointer to the entry to remove from the chain
> - *
> - * See blocking_notifier_chain_unregister() for return value and further
> - * observations.
> - *
> - * Removes a notifier from the rfkill notifier chain.
> - */
> -int unregister_rfkill_notifier(struct notifier_block *nb)
> -{
> - BUG_ON(!nb);
> - return blocking_notifier_chain_unregister(&rfkill_notifier_list, nb);
> -}
> -EXPORT_SYMBOL_GPL(unregister_rfkill_notifier);
> -
>
> static void rfkill_led_trigger(struct rfkill *rfkill,
> enum rfkill_state state)
> @@ -124,12 +79,9 @@ static void rfkill_led_trigger_activate(
> }
> #endif /* CONFIG_RFKILL_LEDS */
>
> -static void notify_rfkill_state_change(struct rfkill *rfkill)
> +static void rfkill_uevent(struct rfkill *rfkill)
> {
> - rfkill_led_trigger(rfkill, rfkill->state);
> - blocking_notifier_call_chain(&rfkill_notifier_list,
> - RFKILL_STATE_CHANGED,
> - rfkill);
> + kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
> }
>
> static void update_rfkill_state(struct rfkill *rfkill)
> @@ -142,7 +94,7 @@ static void update_rfkill_state(struct r
> oldstate = rfkill->state;
> rfkill->state = newstate;
> if (oldstate != newstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
> }
> mutex_unlock(&rfkill->mutex);
> }
> @@ -220,7 +172,7 @@ static int rfkill_toggle_radio(struct rf
> }
>
> if (force || rfkill->state != oldstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
>
> return retval;
> }
> @@ -405,7 +357,7 @@ int rfkill_force_state(struct rfkill *rf
> rfkill->state = state;
>
> if (state != oldstate)
> - notify_rfkill_state_change(rfkill);
> + rfkill_uevent(rfkill);
>
> mutex_unlock(&rfkill->mutex);
>
> @@ -618,28 +570,6 @@ static int rfkill_resume(struct device *
> #define rfkill_resume NULL
> #endif
>
> -static int rfkill_blocking_uevent_notifier(struct notifier_block *nb,
> - unsigned long eventid,
> - void *data)
> -{
> - struct rfkill *rfkill = (struct rfkill *)data;
> -
> - switch (eventid) {
> - case RFKILL_STATE_CHANGED:
> - kobject_uevent(&rfkill->dev.kobj, KOBJ_CHANGE);
> - break;
> - default:
> - break;
> - }
> -
> - return NOTIFY_DONE;
> -}
> -
> -static struct notifier_block rfkill_blocking_uevent_nb = {
> - .notifier_call = rfkill_blocking_uevent_notifier,
> - .priority = 0,
> -};
> -
> static int rfkill_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> struct rfkill *rfkill = to_rfkill(dev);
> @@ -943,14 +873,11 @@ static int __init rfkill_init(void)
> return error;
> }
>
> - register_rfkill_notifier(&rfkill_blocking_uevent_nb);
> -
> return 0;
> }
>
> static void __exit rfkill_exit(void)
> {
> - unregister_rfkill_notifier(&rfkill_blocking_uevent_nb);
> class_unregister(&rfkill_class);
> }
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rfkill: strip pointless notifier chain
2008-12-10 17:40 ` Ivo van Doorn
@ 2008-12-10 17:41 ` Johannes Berg
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2008-12-10 17:41 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: Henrique de Moraes Holschuh, John Linville, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 805 bytes --]
On Wed, 2008-12-10 at 18:40 +0100, Ivo van Doorn wrote:
> On Wednesday 10 December 2008, Johannes Berg wrote:
> > On Wed, 2008-12-10 at 18:01 +0100, Ivo van Doorn wrote:
> > > On Wednesday 10 December 2008, Johannes Berg wrote:
> > > > No users, so no reason to have it.
> > >
> > > Henrique, you introduced the notifier chain, are there any upcoming
> > > users for it or can it indeed be removed?
> >
> > It can be added back with the users when needed.
>
> Fine, but I was more thinking about how soon would such an upcoming
> user arrive. There is no point in deleting the interface when it will
> be added within a couple of days.
Yeah, but it's been in there for a long time without users already, not
like it was added yesterday and the user will show up tomorrow.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-12-10 17:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-10 16:48 [PATCH] rfkill: strip pointless notifier chain Johannes Berg
2008-12-10 17:01 ` Ivo van Doorn
2008-12-10 17:20 ` Johannes Berg
2008-12-10 17:40 ` Ivo van Doorn
2008-12-10 17:41 ` Johannes Berg
2008-12-10 17:40 ` Ivo van Doorn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).