aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 00:15:16 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 19:47:46 -0400
commit72adaa962741e8e910300b66bb123b1a9c31a8a8 (patch)
tree3847dca1d8dadc31df3c7e3275cac8592603be33 /drivers/usb/mon
parent54a5c4cd2e4ec0b27c2c3731727f52591456086c (diff)
[PATCH] USB: convert usbmon to use usb notifiers
This also removes 2 usbmon callbacks. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r--drivers/usb/mon/mon_main.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index 508a21028db4..c34944c75047 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -11,6 +11,7 @@
11#include <linux/usb.h> 11#include <linux/usb.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13#include <linux/smp_lock.h> 13#include <linux/smp_lock.h>
14#include <linux/notifier.h>
14 15
15#include "usb_mon.h" 16#include "usb_mon.h"
16#include "../core/hcd.h" 17#include "../core/hcd.h"
@@ -205,6 +206,23 @@ static void mon_bus_remove(struct usb_bus *ubus)
205 up(&mon_lock); 206 up(&mon_lock);
206} 207}
207 208
209static int mon_notify(struct notifier_block *self, unsigned long action,
210 void *dev)
211{
212 switch (action) {
213 case USB_BUS_ADD:
214 mon_bus_add(dev);
215 break;
216 case USB_BUS_REMOVE:
217 mon_bus_remove(dev);
218 }
219 return NOTIFY_OK;
220}
221
222static struct notifier_block mon_nb = {
223 .notifier_call = mon_notify,
224};
225
208/* 226/*
209 * Ops 227 * Ops
210 */ 228 */
@@ -212,8 +230,6 @@ static struct usb_mon_operations mon_ops_0 = {
212 .urb_submit = mon_submit, 230 .urb_submit = mon_submit,
213 .urb_submit_error = mon_submit_error, 231 .urb_submit_error = mon_submit_error,
214 .urb_complete = mon_complete, 232 .urb_complete = mon_complete,
215 .bus_add = mon_bus_add,
216 .bus_remove = mon_bus_remove,
217}; 233};
218 234
219/* 235/*
@@ -329,6 +345,8 @@ static int __init mon_init(void)
329 } 345 }
330 // MOD_INC_USE_COUNT(which_module?); 346 // MOD_INC_USE_COUNT(which_module?);
331 347
348 usb_register_notify(&mon_nb);
349
332 down(&usb_bus_list_lock); 350 down(&usb_bus_list_lock);
333 list_for_each_entry (ubus, &usb_bus_list, bus_list) { 351 list_for_each_entry (ubus, &usb_bus_list, bus_list) {
334 mon_bus_init(mondir, ubus); 352 mon_bus_init(mondir, ubus);
@@ -342,6 +360,7 @@ static void __exit mon_exit(void)
342 struct mon_bus *mbus; 360 struct mon_bus *mbus;
343 struct list_head *p; 361 struct list_head *p;
344 362
363 usb_unregister_notify(&mon_nb);
345 usb_mon_deregister(); 364 usb_mon_deregister();
346 365
347 down(&mon_lock); 366 down(&mon_lock);