diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index f739b4b642c9..f13c919cf93b 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -103,17 +103,37 @@ struct ugen_softc { int sc_disconnected; /* device is gone */ }; +#if defined(__NetBSD__) int ugenopen __P((dev_t, int, int, struct proc *)); int ugenclose __P((dev_t, int, int, struct proc *p)); int ugenread __P((dev_t, struct uio *uio, int)); int ugenwrite __P((dev_t, struct uio *uio, int)); int ugenioctl __P((dev_t, u_long, caddr_t, int, struct proc *)); int ugenpoll __P((dev_t, int, struct proc *)); +#elif defined(__FreeBSD__) +d_open_t ugenopen; +d_close_t ugenclose; +d_read_t ugenread; +d_write_t ugenwrite; +d_ioctl_t ugenioctl; +d_poll_t ugenpoll; + +#define UGEN_CDEV_MAJOR 114 + +static struct cdevsw ugen_cdevsw = { + ugenopen, ugenclose, ugenread, ugenwrite, + ugenioctl, nostop, nullreset, nodevtotty, + ugenpoll, nommap, nostrat, + "ugen", NULL, -1 +}; +#endif + void ugenintr __P((usbd_request_handle reqh, usbd_private_handle addr, usbd_status status)); void ugen_disco __P((void *)); -#define UGEN_CDEV_MAJOR 114 + + int ugen_set_config __P((struct ugen_softc *sc, int configno)); usb_config_descriptor_t *ugen_get_cdesc __P((struct ugen_softc *sc, int index, @@ -974,6 +994,7 @@ ugen_detach(device_t self) { char *devinfo = (char *) device_get_desc(self); + DPRINTF(("%s: disconnected\n", USBDEVNAME(self))); if (devinfo) { device_set_desc(self, NULL); free(devinfo, M_USB); @@ -981,5 +1002,6 @@ ugen_detach(device_t self) return 0; } -DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass, usbd_driver_load, 0); +CDEV_DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass, + UGEN_CDEV_MAJOR, ugen_cdevsw, usbd_driver_load, 0); #endif