Remove more __OtherBSD__ ifdefs that don't make sense, and haven't for
some time.
This commit is contained in:
parent
778e5b6687
commit
63ba0d2d76
@ -56,17 +56,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/fcntl.h>
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/file.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/ioccom.h>
|
||||
#include <sys/filio.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/ioccom.h>
|
||||
#endif
|
||||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/selinfo.h>
|
||||
@ -134,18 +128,13 @@ struct uhid_softc {
|
||||
int sc_refcnt;
|
||||
u_char sc_dying;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
struct cdev *dev;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define UHIDUNIT(dev) (minor(dev))
|
||||
#define UHID_CHUNK 128 /* chunk size for read */
|
||||
#define UHID_BSIZE 1020 /* buffer size */
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
cdev_decl(uhid);
|
||||
#elif defined(__FreeBSD__)
|
||||
d_open_t uhidopen;
|
||||
d_close_t uhidclose;
|
||||
d_read_t uhidread;
|
||||
@ -165,7 +154,6 @@ static struct cdevsw uhid_cdevsw = {
|
||||
.d_poll = uhidpoll,
|
||||
.d_name = "uhid",
|
||||
};
|
||||
#endif
|
||||
|
||||
static void uhid_intr(usbd_xfer_handle, usbd_private_handle,
|
||||
usbd_status);
|
||||
@ -309,49 +297,19 @@ uhid_attach(device_t self)
|
||||
|
||||
sc->sc_repdesc = desc;
|
||||
sc->sc_repdesc_size = size;
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
sc->dev = make_dev(&uhid_cdevsw, device_get_unit(self),
|
||||
UID_ROOT, GID_OPERATOR,
|
||||
0644, "uhid%d", device_get_unit(self));
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int
|
||||
uhid_activate(device_t self, enum devact act)
|
||||
{
|
||||
struct uhid_softc *sc = (struct uhid_softc *)self;
|
||||
|
||||
switch (act) {
|
||||
case DVACT_ACTIVATE:
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
sc->sc_dying = 1;
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
uhid_detach(device_t self)
|
||||
{
|
||||
USB_DETACH_START(uhid, sc);
|
||||
int s;
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int maj, mn;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
DPRINTF(("uhid_detach: sc=%p flags=%d\n", sc, flags));
|
||||
#else
|
||||
DPRINTF(("uhid_detach: sc=%p\n", sc));
|
||||
#endif
|
||||
|
||||
sc->sc_dying = 1;
|
||||
if (sc->sc_intrpipe != NULL)
|
||||
usbd_abort_pipe(sc->sc_intrpipe);
|
||||
@ -366,19 +324,7 @@ uhid_detach(device_t self)
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if (cdevsw[maj].d_open == uhidopen)
|
||||
break;
|
||||
|
||||
/* Nuke the vnodes for any open instances (calls close). */
|
||||
mn = self->dv_unit;
|
||||
vdevgone(maj, mn, mn, VCHR);
|
||||
#elif defined(__FreeBSD__)
|
||||
destroy_dev(sc->dev);
|
||||
#endif
|
||||
|
||||
if (sc->sc_repdesc)
|
||||
free(sc->sc_repdesc, M_USBDEV);
|
||||
@ -780,6 +726,4 @@ uhidpoll(struct cdev *dev, int events, struct thread *p)
|
||||
return (revents);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
DRIVER_MODULE(uhid, uhub, uhid_driver, uhid_devclass, usbd_driver_load, 0);
|
||||
#endif
|
||||
|
@ -783,9 +783,7 @@ static void umass_dump_buffer (struct umass_softc *sc, u_int8_t *buffer,
|
||||
int buflen, int printlen);
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
MODULE_DEPEND(umass, cam, 1,1,1);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* USB device probe/attach/detach
|
||||
|
@ -350,11 +350,6 @@ ums_attach(device_t self)
|
||||
sc->status.button = sc->status.obutton = 0;
|
||||
sc->status.dx = sc->status.dy = sc->status.dz = 0;
|
||||
|
||||
#ifndef __FreeBSD__
|
||||
sc->rsel.si_flags = 0;
|
||||
sc->rsel.si_pid = 0;
|
||||
#endif
|
||||
|
||||
sc->dev = make_dev(&ums_cdevsw, device_get_unit(self),
|
||||
UID_ROOT, GID_OPERATOR,
|
||||
0644, "ums%d", device_get_unit(self));
|
||||
|
@ -45,10 +45,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#if 1
|
||||
#include <dev/usb/usb_port.h>
|
||||
|
@ -52,14 +52,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/systm.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/device.h> /* for usbdivar.h */
|
||||
#include <machine/bus.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#endif
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
@ -41,11 +41,7 @@
|
||||
typedef struct usb_dma_block {
|
||||
bus_dma_tag_t tag;
|
||||
bus_dmamap_t map;
|
||||
#ifdef __FreeBSD__
|
||||
void *kaddr;
|
||||
#else
|
||||
caddr_t kaddr;
|
||||
#endif
|
||||
bus_dma_segment_t segs[1];
|
||||
int nsegs;
|
||||
size_t size;
|
||||
@ -54,11 +50,7 @@ typedef struct usb_dma_block {
|
||||
LIST_ENTRY(usb_dma_block) next;
|
||||
} usb_dma_block_t;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#define DMAADDR(dma, o) ((dma)->block->segs[0].ds_addr + (dma)->offs + (o))
|
||||
#else
|
||||
#define DMAADDR(dma, o) (((char *)(dma)->block->map->dm_segs[0].ds_addr) + (dma)->offs + (o))
|
||||
#endif
|
||||
#define KERNADDR(dma, o) \
|
||||
((void *)((char *)((dma)->block->kaddr) + (dma)->offs + (o)))
|
||||
|
||||
|
@ -50,15 +50,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/device.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
#include <sys/tty.h>
|
||||
#include <sys/file.h>
|
||||
#include <sys/selinfo.h>
|
||||
@ -243,9 +239,7 @@ struct uscanner_softc {
|
||||
device_t sc_dev; /* base device */
|
||||
usbd_device_handle sc_udev;
|
||||
usbd_interface_handle sc_iface;
|
||||
#if defined(__FreeBSD__)
|
||||
struct cdev *dev;
|
||||
#endif
|
||||
|
||||
u_int sc_dev_flags;
|
||||
|
||||
@ -270,9 +264,6 @@ struct uscanner_softc {
|
||||
u_char sc_dying;
|
||||
};
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
cdev_decl(uscanner);
|
||||
#elif defined(__FreeBSD__)
|
||||
d_open_t uscanneropen;
|
||||
d_close_t uscannerclose;
|
||||
d_read_t uscannerread;
|
||||
@ -290,7 +281,6 @@ static struct cdevsw uscanner_cdevsw = {
|
||||
.d_poll = uscannerpoll,
|
||||
.d_name = "uscanner",
|
||||
};
|
||||
#endif
|
||||
|
||||
static int uscanner_do_read(struct uscanner_softc *, struct uio *, int);
|
||||
static int uscanner_do_write(struct uscanner_softc *, struct uio *, int);
|
||||
@ -373,12 +363,9 @@ uscanner_attach(device_t self)
|
||||
sc->sc_bulkin = ed_bulkin->bEndpointAddress;
|
||||
sc->sc_bulkout = ed_bulkout->bEndpointAddress;
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
/* the main device, ctrl endpoint */
|
||||
sc->dev = make_dev(&uscanner_cdevsw, device_get_unit(sc->sc_dev),
|
||||
UID_ROOT, GID_OPERATOR, 0644, "%s", device_get_nameunit(sc->sc_dev));
|
||||
#endif
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,sc->sc_dev);
|
||||
|
||||
return 0;
|
||||
@ -610,38 +597,13 @@ uscannerwrite(struct cdev *dev, struct uio *uio, int flag)
|
||||
return (error);
|
||||
}
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int
|
||||
uscanner_activate(device_t self, enum devact act)
|
||||
{
|
||||
struct uscanner_softc *sc = (struct uscanner_softc *)self;
|
||||
|
||||
switch (act) {
|
||||
case DVACT_ACTIVATE:
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
case DVACT_DEACTIVATE:
|
||||
sc->sc_dying = 1;
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
uscanner_detach(device_t self)
|
||||
{
|
||||
USB_DETACH_START(uscanner, sc);
|
||||
int s;
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
int maj, mn;
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
DPRINTF(("uscanner_detach: sc=%p flags=%d\n", sc, flags));
|
||||
#elif defined(__FreeBSD__)
|
||||
DPRINTF(("uscanner_detach: sc=%p\n", sc));
|
||||
#endif
|
||||
|
||||
sc->sc_dying = 1;
|
||||
sc->sc_dev_flags = 0; /* make close really close device */
|
||||
@ -659,20 +621,8 @@ uscanner_detach(device_t self)
|
||||
}
|
||||
splx(s);
|
||||
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/* locate the major number */
|
||||
for (maj = 0; maj < nchrdev; maj++)
|
||||
if (cdevsw[maj].d_open == uscanneropen)
|
||||
break;
|
||||
|
||||
/* Nuke the vnodes for any open instances (calls close). */
|
||||
mn = self->dv_unit * USB_MAX_ENDPOINTS;
|
||||
vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
|
||||
#elif defined(__FreeBSD__)
|
||||
/* destroy the device for the control endpoint */
|
||||
destroy_dev(sc->dev);
|
||||
#endif
|
||||
|
||||
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
|
||||
|
||||
return (0);
|
||||
@ -700,6 +650,4 @@ uscannerpoll(struct cdev *dev, int events, struct thread *p)
|
||||
return (revents);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, usbd_driver_load, 0);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user