Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Mar 2009 17:26:28 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 158942 for review
Message-ID:  <200903091726.n29HQSTp033502@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=158942

Change 158942 by hselasky@hselasky_laptop001 on 2009/03/09 17:25:29

	
	USB CORE:
	  - make sure we can compile USB without UGEN
	  - remove some unused defines
	
	USB controller:
	  - fix a misspelled include

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/musb_otg_atmelarm.c#2 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_core.h#3 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_device.c#5 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/musb_otg_atmelarm.c#2 (text+ko) ====

@@ -36,7 +36,7 @@
 
 #include <dev/usb/usb_controller.h>
 #include <dev/usb/usb_bus.h>
-#include <dev/usb/controller/mus2_otg.h>
+#include <dev/usb/controller/musb_otg.h>
 
 #include <sys/rman.h>
 

==== //depot/projects/usb/src/sys/dev/usb/usb_core.h#3 (text+ko) ====

@@ -38,6 +38,10 @@
 #define	USB_USE_CONDVAR 0
 #endif
 
+#ifndef USB_HAVE_UGEN
+#define	USB_HAVE_UGEN 1
+#endif
+
 #ifndef USB_TD_GET_PROC
 #define	USB_TD_GET_PROC(td) (td)->td_proc
 #endif
@@ -46,24 +50,6 @@
 #define	USB_PROC_GET_GID(td) (td)->p_pgid
 #endif
 
-#ifndef USB_VNOPS_FO_CLOSE
-#define	USB_VNOPS_FO_CLOSE(fp, td, perr) do {	\
-    (td)->td_fpop = (fp);			\
-    *(perr) = vnops.fo_close(fp, td);		\
-    (td)->td_fpop = NULL;			\
-} while (0)
-#endif
-
-#ifndef USB_VNOPS_FO_STAT
-#define	USB_VNOPS_FO_STAT(fp, sb, cred, td) \
-    vnops.fo_stat(fp, sb, cred, td)
-#endif
-
-#ifndef USB_VNOPS_FO_TRUNCATE
-#define	USB_VNOPS_FO_TRUNCATE(fp, length, cred, td) \
-    vnops.fo_truncate(fp, length, cred, td)
-#endif
-
 /* Include files */
 
 #include <sys/stdint.h>

==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#5 (text+ko) ====

@@ -73,11 +73,14 @@
 static usb2_error_t usb2_fill_iface_data(struct usb2_device *, uint8_t,
 		    uint8_t);
 static void	usb2_notify_addq(const char *type, struct usb2_device *);
+
+#if USB_HAVE_UGEN
 static void	usb2_fifo_free_wrap(struct usb2_device *, uint8_t, uint8_t);
 static struct cdev *usb2_make_dev(struct usb2_device *, int, int);
 static void	usb2_cdev_create(struct usb2_device *);
 static void	usb2_cdev_free(struct usb2_device *);
 static void	usb2_cdev_cleanup(void *);
+#endif
 
 /* This variable is global to allow easy access to it: */
 
@@ -543,11 +546,13 @@
 	/* detach all interface drivers */
 	usb2_detach_device(udev, USB_IFACE_INDEX_ANY, 1);
 
+#if USB_HAVE_UGEN
 	/* free all FIFOs except control endpoint FIFOs */
 	usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 0);
 
 	/* free all configuration data structures */
 	usb2_cdev_free(udev);
+#endif
 	usb2_free_iface_data(udev);
 
 	if (index == USB_UNCONFIG_INDEX) {
@@ -657,13 +662,17 @@
 			goto done;
 		}
 	}
+#if USB_HAVE_UGEN
 	/* create device nodes for each endpoint */
 	usb2_cdev_create(udev);
+#endif
 
 done:
 	DPRINTF("error=%s\n", usb2_errstr(err));
 	if (err) {
+#if USB_HAVE_UGEN
 		usb2_cdev_free(udev);
+#endif
 		usb2_free_iface_data(udev);
 	}
 	if (do_unlock) {
@@ -717,11 +726,13 @@
 			goto done;
 		}
 	}
+#if USB_HAVE_UGEN
 	/*
 	 * Free all generic FIFOs for this interface, except control
 	 * endpoint FIFOs:
 	 */
 	usb2_fifo_free_wrap(udev, iface_index, 0);
+#endif
 
 	err = usb2_fill_iface_data(udev, iface_index, alt_index);
 	if (err) {
@@ -1433,13 +1444,17 @@
 	/* set device index */
 	udev->device_index = device_index;
 
+	/* Create ugen name */
+	snprintf(udev->ugen_name, sizeof(udev->ugen_name),
+	    USB_GENERIC_NAME "%u.%u", device_get_unit(bus->bdev),
+	    device_index);
+#if USB_HAVE_UGEN
 	/* Create the control endpoint device */
 	udev->default_dev = usb2_make_dev(udev, 0, FREAD|FWRITE);
+
 	/* Create a link from /dev/ugenX.X to the default endpoint */
-	snprintf(udev->ugen_name, sizeof(udev->ugen_name),
-	    USB_GENERIC_NAME "%u.%u", device_get_unit(bus->bdev),
-	    device_index);
 	make_dev_alias(udev->default_dev, udev->ugen_name);
+#endif
 
 	if (udev->flags.usb2_mode == USB_MODE_HOST) {
 
@@ -1692,7 +1707,9 @@
 	    parent_hub->hub->ports + port_index : NULL, udev, device_index);
 
 	/* Link and announce the ugen device name */
+#if USB_HAVE_UGEN
 	udev->ugen_symlink = usb2_alloc_symlink(udev->ugen_name);
+#endif
 	printf("%s: <%s> at %s\n", udev->ugen_name, udev->manufacturer,
 	    device_get_nameunit(udev->bus->bdev));
 
@@ -1706,6 +1723,7 @@
 	return (udev);
 }
 
+#if USB_HAVE_UGEN
 static struct cdev *
 usb2_make_dev(struct usb2_device *udev, int ep, int mode)
 {
@@ -1812,6 +1830,7 @@
 {
 	free(arg, M_USBDEV);
 }
+#endif
 
 /*------------------------------------------------------------------------*
  *	usb2_free_device
@@ -1832,7 +1851,9 @@
 
 	/* Destroy UGEN symlink, if any */
 	if (udev->ugen_symlink) {
+#if USB_HAVE_UGEN
 		usb2_free_symlink(udev->ugen_symlink);
+#endif
 		udev->ugen_symlink = NULL;
 	}
 	/*
@@ -1843,6 +1864,7 @@
 	    udev->parent_hub->hub->ports + udev->port_index : NULL,
 	    NULL, USB_ROOT_HUB_ADDR);
 
+#if USB_HAVE_UGEN
 	/* wait for all pending references to go away: */
 
 	mtx_lock(&usb2_ref_lock);
@@ -1851,11 +1873,13 @@
 		usb2_cv_wait(udev->default_cv + 1, &usb2_ref_lock);
 	}
 	mtx_unlock(&usb2_ref_lock);
+#endif
 
 	if (udev->flags.usb2_mode == USB_MODE_DEVICE) {
 		/* stop receiving any control transfers (Device Side Mode) */
 		usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
 	}
+#if USB_HAVE_UGEN
 	/* free all FIFOs */
 	usb2_fifo_free_wrap(udev, USB_IFACE_INDEX_ANY, 1);
 
@@ -1863,9 +1887,12 @@
 	 * Free all interface related data and FIFOs, if any.
 	 */
 	usb2_cdev_free(udev);
+#endif
 	usb2_free_iface_data(udev);
+#if USB_HAVE_UGEN
 	destroy_dev_sched_cb(udev->default_dev, usb2_cdev_cleanup,
 	    udev->default_dev->si_drv1);
+#endif
 
 	/* unsetup any leftover default USB transfers */
 	usb2_transfer_unsetup(udev->default_xfer, USB_DEFAULT_XFER_MAX);
@@ -2263,6 +2290,7 @@
 	devctl_queue_data(data);
 }
 
+#if USB_HAVE_UGEN
 /*------------------------------------------------------------------------*
  *	usb2_fifo_free_wrap
  *
@@ -2319,6 +2347,7 @@
 		usb2_fifo_free(f);
 	}
 }
+#endif
 
 /*------------------------------------------------------------------------*
  *	usb2_peer_can_wakeup



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903091726.n29HQSTp033502>