summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-08-04 19:05:49 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-08-04 19:05:49 +0000
commitabf58c4712b405c6e2630b16f2e1128903b2be51 (patch)
tree89331176b900f663cd42522b1370c89d6028c245
parent53fc8d6ff8bd5095748d8b4fab860b85eb70e33b (diff)
downloadFreeBSD-src-abf58c4712b405c6e2630b16f2e1128903b2be51.zip
FreeBSD-src-abf58c4712b405c6e2630b16f2e1128903b2be51.tar.gz
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.
-rw-r--r--sys/dev/usb/usb.c15
-rw-r--r--sys/dev/usb/usb_port.h30
2 files changed, 20 insertions, 25 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 3688aad..0767649 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -64,7 +64,6 @@
#include <sys/vnode.h>
#include <sys/signalvar.h>
-#define USBCORE
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
@@ -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 61ac382..30e8225 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)
OpenPOWER on IntegriCloud