From adeb72abfb209391efb7f3b7906a8c5cbfdcf0d9 Mon Sep 17 00:00:00 2001 From: Nick Hibma Date: Fri, 4 Aug 2000 19:05:49 +0000 Subject: [PATCH] Finally make the module dependencies work. kern_linker.c now allows modules to depend on modules in the same file (uhub depends on usb) or even on themselves (usb on usb, makes the define in usb_port.h a lot less convoluted). Use ANSI prototypes. --- sys/dev/usb/usb.c | 15 +++++++++------ sys/dev/usb/usb_port.h | 30 +++++++++++------------------- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 3688aada86ac..0767649e58f9 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -64,7 +64,6 @@ #include #include -#define USBCORE #include #include #include @@ -128,7 +127,7 @@ d_open_t usbopen; d_close_t usbclose; d_read_t usbread; d_ioctl_t usbioctl; -int usbpoll __P((dev_t, int, struct proc *)); +int usbpoll(dev_t, int, struct proc *); struct cdevsw usb_cdevsw = { /* open */ usbopen, @@ -148,10 +147,10 @@ struct cdevsw usb_cdevsw = { }; #endif -Static usbd_status usb_discover __P((struct usb_softc *)); +Static usbd_status usb_discover(struct usb_softc *); #if defined(__NetBSD__) || defined(__OpenBSD__) -Static void usb_create_event_thread __P((void *)); -Static void usb_event_thread __P((void *)); +Static void usb_create_event_thread(void *); +Static void usb_event_thread(void *); #endif #define USB_MAX_EVENTS 50 @@ -166,7 +165,7 @@ Static struct selinfo usb_selevent; Static struct proc *usb_async_proc; /* process who wants USB SIGIO */ Static int usb_dev_open = 0; -Static int usb_get_next_event __P((struct usb_event *)); +Static int usb_get_next_event(struct usb_event *); #if defined(__NetBSD__) || defined(__OpenBSD__) /* Flag to see if we are in the cold boot process. */ @@ -181,6 +180,10 @@ USB_DECLARE_DRIVER_INIT(usb, DEVMETHOD(device_shutdown, bus_generic_shutdown) ); +#if defined(__FreeBSD__) +MODULE_VERSION(usb, 1); +#endif + USB_MATCH(usb) { DPRINTF(("usbd_match\n")); diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h index 61ac38254397..30e822549fda 100644 --- a/sys/dev/usb/usb_port.h +++ b/sys/dev/usb/usb_port.h @@ -82,10 +82,10 @@ typedef struct device *device_ptr_t; #define logprintf printf #define USB_DECLARE_DRIVER(dname) \ -int __CONCAT(dname,_match) __P((struct device *, struct cfdata *, void *)); \ -void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \ -int __CONCAT(dname,_detach) __P((struct device *, int)); \ -int __CONCAT(dname,_activate) __P((struct device *, enum devact)); \ +int __CONCAT(dname,_match)(struct device *, struct cfdata *, void *); \ +void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \ +int __CONCAT(dname,_detach)(struct device *, int); \ +int __CONCAT(dname,_activate)(struct device *, enum devact); \ \ extern struct cfdriver __CONCAT(dname,_cd); \ \ @@ -194,10 +194,10 @@ typedef struct device device_ptr_t; #define usb_untimeout(f, d, h) untimeout((f), (d)) #define USB_DECLARE_DRIVER(dname) \ -int __CONCAT(dname,_match) __P((struct device *, void *, void *)); \ -void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \ -int __CONCAT(dname,_detach) __P((struct device *, int)); \ -int __CONCAT(dname,_activate) __P((struct device *, enum devact)); \ +int __CONCAT(dname,_match)(struct device *, void *, void *); \ +void __CONCAT(dname,_attach)(struct device *, struct device *, void *); \ +int __CONCAT(dname,_detach)(struct device *, int); \ +int __CONCAT(dname,_activate)(struct device *, enum devact); \ \ struct cfdriver __CONCAT(dname,_cd) = { \ NULL, #dname, DV_DULL \ @@ -299,7 +299,7 @@ __CONCAT(dname,_detach)(self, flags) \ #define PWR_RESUME 0 #define PWR_SUSPEND 1 -#define USB_DECLARE_DRIVER_INIT2(dname, init...) \ +#define USB_DECLARE_DRIVER_INIT(dname, init...) \ Static device_probe_t __CONCAT(dname,_match); \ Static device_attach_t __CONCAT(dname,_attach); \ Static device_detach_t __CONCAT(dname,_detach); \ @@ -318,17 +318,9 @@ Static driver_t __CONCAT(dname,_driver) = { \ #dname, \ __CONCAT(dname,_methods), \ sizeof(struct __CONCAT(dname,_softc)) \ -} +}; \ +MODULE_DEPEND(dname, usb, 1, 1, 1) -#ifdef USBCORE -#define USB_DECLARE_DRIVER_INIT(dname, init...) \ - USB_DECLARE_DRIVER_INIT2(dname, init); \ - MODULE_VERSION(usb, 1) -#else -#define USB_DECLARE_DRIVER_INIT(dname, init...) \ - USB_DECLARE_DRIVER_INIT2(dname, init); \ - MODULE_DEPEND(dname, usb, 1, 1, 1) -#endif #define METHODS_NONE {0,0} #define USB_DECLARE_DRIVER(dname) USB_DECLARE_DRIVER_INIT(dname, METHODS_NONE)