View | Details | Raw Unified | Return to bug 33712
Collapse All | Expand All

(-)ugen.c (-14 / +11 lines)
Lines 202-212 Link Here
202
202
203
	sc->sc_udev = udev = uaa->device;
203
	sc->sc_udev = udev = uaa->device;
204
204
205
#if defined(__FreeBSD__)
206
	/* the main device, ctrl endpoint */
207
	make_dev(&ugen_cdevsw, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0),
208
		UID_ROOT, GID_OPERATOR, 0644, "%s", USBDEVNAME(sc->sc_dev));
209
#endif
210
	memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints);
205
	memset(sc->sc_endpoints, 0, sizeof sc->sc_endpoints);
211
206
212
	/* First set configuration index 0, the default one for ugen. */
207
	/* First set configuration index 0, the default one for ugen. */
Lines 237-242 Link Here
237
{
232
{
238
	int endptno;
233
	int endptno;
239
234
235
	/* the main device, ctrl endpoint */
236
	make_dev(&ugen_cdevsw, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0),
237
		UID_ROOT, GID_OPERATOR, 0644, "%s", USBDEVNAME(sc->sc_dev));
238
240
	for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) {
239
	for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) {
241
		if (sc->sc_endpoints[endptno][IN].sc != NULL ||
240
		if (sc->sc_endpoints[endptno][IN].sc != NULL ||
242
		    sc->sc_endpoints[endptno][OUT].sc != NULL ) {
241
		    sc->sc_endpoints[endptno][OUT].sc != NULL ) {
Lines 264-269 Link Here
264
	dev_t dev;
263
	dev_t dev;
265
	struct vnode *vp;
264
	struct vnode *vp;
266
265
266
	/* destroy the device for the control endpoint */
267
	dev = makedev(UGEN_CDEV_MAJOR, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0));
268
	vp = SLIST_FIRST(&dev->si_hlist);
269
	if (vp)
270
		VOP_REVOKE(vp, REVOKEALL);
271
	destroy_dev(dev);
272
267
	/* destroy all devices for the other (existing) endpoints as well */
273
	/* destroy all devices for the other (existing) endpoints as well */
268
	for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) {
274
	for (endptno = 1; endptno < USB_MAX_ENDPOINTS; endptno++) {
269
		if (sc->sc_endpoints[endptno][IN].sc != NULL ||
275
		if (sc->sc_endpoints[endptno][IN].sc != NULL ||
Lines 816-824 Link Here
816
	int s;
822
	int s;
817
#if defined(__NetBSD__) || defined(__OpenBSD__)
823
#if defined(__NetBSD__) || defined(__OpenBSD__)
818
	int maj, mn;
824
	int maj, mn;
819
#elif defined(__FreeBSD__)
820
	dev_t dev;
821
	struct vnode *vp;
822
#endif
825
#endif
823
826
824
#if defined(__NetBSD__) || defined(__OpenBSD__)
827
#if defined(__NetBSD__) || defined(__OpenBSD__)
Lines 857-868 Link Here
857
	mn = self->dv_unit * USB_MAX_ENDPOINTS;
860
	mn = self->dv_unit * USB_MAX_ENDPOINTS;
858
	vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
861
	vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
859
#elif defined(__FreeBSD__)
862
#elif defined(__FreeBSD__)
860
	/* destroy the device for the control endpoint */
861
	dev = makedev(UGEN_CDEV_MAJOR, UGENMINOR(USBDEVUNIT(sc->sc_dev), 0));
862
	vp = SLIST_FIRST(&dev->si_hlist);
863
	if (vp)
864
		VOP_REVOKE(vp, REVOKEALL);
865
	destroy_dev(dev);
866
	ugen_destroy_devnodes(sc);
863
	ugen_destroy_devnodes(sc);
867
#endif
864
#endif

Return to bug 33712