aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/hcd.h16
-rw-r--r--drivers/usb/mon/mon_main.c23
3 files changed, 21 insertions, 20 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 16790ad0e2e4..e8f2b8d8f14d 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -793,7 +793,6 @@ static int usb_register_bus(struct usb_bus *bus)
793 up (&usb_bus_list_lock); 793 up (&usb_bus_list_lock);
794 794
795 usb_notify_add_bus(bus); 795 usb_notify_add_bus(bus);
796 usbmon_notify_bus_add (bus);
797 796
798 dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum); 797 dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);
799 return 0; 798 return 0;
@@ -821,7 +820,6 @@ static void usb_deregister_bus (struct usb_bus *bus)
821 up (&usb_bus_list_lock); 820 up (&usb_bus_list_lock);
822 821
823 usb_notify_remove_bus(bus); 822 usb_notify_remove_bus(bus);
824 usbmon_notify_bus_remove (bus);
825 823
826 clear_bit (bus->busnum, busmap.busmap); 824 clear_bit (bus->busnum, busmap.busmap);
827 825
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index cc33886260cd..a5d92943ff95 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -421,8 +421,6 @@ struct usb_mon_operations {
421 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err); 421 void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
422 void (*urb_complete)(struct usb_bus *bus, struct urb *urb); 422 void (*urb_complete)(struct usb_bus *bus, struct urb *urb);
423 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */ 423 /* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */
424 void (*bus_add)(struct usb_bus *bus);
425 void (*bus_remove)(struct usb_bus *bus);
426}; 424};
427 425
428extern struct usb_mon_operations *mon_ops; 426extern struct usb_mon_operations *mon_ops;
@@ -445,18 +443,6 @@ static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb)
445 if (bus->monitored) 443 if (bus->monitored)
446 (*mon_ops->urb_complete)(bus, urb); 444 (*mon_ops->urb_complete)(bus, urb);
447} 445}
448
449static inline void usbmon_notify_bus_add(struct usb_bus *bus)
450{
451 if (mon_ops)
452 (*mon_ops->bus_add)(bus);
453}
454
455static inline void usbmon_notify_bus_remove(struct usb_bus *bus)
456{
457 if (mon_ops)
458 (*mon_ops->bus_remove)(bus);
459}
460 446
461int usb_mon_register(struct usb_mon_operations *ops); 447int usb_mon_register(struct usb_mon_operations *ops);
462void usb_mon_deregister(void); 448void usb_mon_deregister(void);
@@ -467,8 +453,6 @@ static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
467static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb, 453static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
468 int error) {} 454 int error) {}
469static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {} 455static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {}
470static inline void usbmon_notify_bus_add(struct usb_bus *bus) {}
471static inline void usbmon_notify_bus_remove(struct usb_bus *bus) {}
472 456
473#endif /* CONFIG_USB_MON */ 457#endif /* CONFIG_USB_MON */
474 458
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);