PERFORCE change 157430 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon Feb 9 05:59:36 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=157430

Change 157430 by hselasky at hselasky_laptop001 on 2009/02/09 13:58:44

	
	USB process naming cleanup.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#25 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_process.c#17 edit
.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_process.h#8 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.c#25 (text+ko) ====

@@ -168,16 +168,16 @@
 
 	/* Get rid of USB callback processes */
 
-	usb2_proc_unsetup(&bus->giant_callback_proc);
-	usb2_proc_unsetup(&bus->non_giant_callback_proc);
+	usb2_proc_free(&bus->giant_callback_proc);
+	usb2_proc_free(&bus->non_giant_callback_proc);
 
 	/* Get rid of USB roothub process */
 
-	usb2_proc_unsetup(&bus->roothub_proc);
+	usb2_proc_free(&bus->roothub_proc);
 
 	/* Get rid of USB explore process */
 
-	usb2_proc_unsetup(&bus->explore_proc);
+	usb2_proc_free(&bus->explore_proc);
 
 	return (0);
 }
@@ -375,6 +375,8 @@
 static void
 usb2_attach_sub(device_t dev, struct usb2_bus *bus)
 {
+	const char *pname = device_get_nameunit(dev);
+
 	/* Initialise USB process messages */
 	bus->explore_msg[0].hdr.pm_callback = &usb2_bus_explore;
 	bus->explore_msg[0].bus = bus;
@@ -398,20 +400,20 @@
 
 	/* Create USB explore, roothub and callback processes */
 
-	if (usb2_proc_setup(&bus->giant_callback_proc,
-	    &bus->bus_mtx, USB_PRI_MED)) {
+	if (usb2_proc_create(&bus->giant_callback_proc,
+	    &bus->bus_mtx, pname, USB_PRI_MED)) {
 		printf("WARNING: Creation of USB Giant "
 		    "callback process failed.\n");
-	} else if (usb2_proc_setup(&bus->non_giant_callback_proc,
-	    &bus->bus_mtx, USB_PRI_HIGH)) {
+	} else if (usb2_proc_create(&bus->non_giant_callback_proc,
+	    &bus->bus_mtx, pname, USB_PRI_HIGH)) {
 		printf("WARNING: Creation of USB non-Giant "
 		    "callback process failed.\n");
-	} else if (usb2_proc_setup(&bus->roothub_proc,
-	    &bus->bus_mtx, USB_PRI_HIGH)) {
+	} else if (usb2_proc_create(&bus->roothub_proc,
+	    &bus->bus_mtx, pname, USB_PRI_HIGH)) {
 		printf("WARNING: Creation of USB roothub "
 		    "process failed.\n");
-	} else if (usb2_proc_setup(&bus->explore_proc,
-	    &bus->bus_mtx, USB_PRI_MED)) {
+	} else if (usb2_proc_create(&bus->explore_proc,
+	    &bus->bus_mtx, pname, USB_PRI_MED)) {
 		printf("WARNING: Creation of USB explore "
 		    "process failed.\n");
 	} else {

==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_process.c#17 (text+ko) ====

@@ -164,7 +164,7 @@
 }
 
 /*------------------------------------------------------------------------*
- *	usb2_proc_setup
+ *	usb2_proc_create
  *
  * This function will create a process using the given "prio" that can
  * execute callbacks. The mutex pointed to by "p_mtx" will be applied
@@ -197,18 +197,12 @@
 	return (0);
 
 error:
-	usb2_proc_unsetup(up);
+	usb2_proc_free(up);
 	return (ENOMEM);
 }
 
-uint8_t
-usb2_proc_setup(struct usb2_process *up, struct mtx *p_mtx, uint8_t prio)
-{
-	return (usb2_proc_create(up, p_mtx, "usbproc", prio) ? 1 : 0);
-}
-
 /*------------------------------------------------------------------------*
- *	usb2_proc_unsetup
+ *	usb2_proc_free
  *
  * NOTE: If the structure pointed to by "up" is all zero, this
  * function does nothing.
@@ -217,7 +211,7 @@
  * removed nor called.
  *------------------------------------------------------------------------*/
 void
-usb2_proc_unsetup(struct usb2_process *up)
+usb2_proc_free(struct usb2_process *up)
 {
 	if (!(up->up_mtx)) {
 		/* not initialised */
@@ -232,12 +226,6 @@
 	up->up_mtx = NULL;
 }
 
-void
-usb2_proc_free(struct usb2_process *up)
-{
-	usb2_proc_unsetup(up);
-}
-
 /*------------------------------------------------------------------------*
  *	usb2_proc_msignal
  *

==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_process.h#8 (text+ko) ====

@@ -79,14 +79,11 @@
 
 uint8_t	usb2_proc_cwait(struct usb2_process *up, int timeout);
 uint8_t	usb2_proc_is_gone(struct usb2_process *up);
-uint8_t	usb2_proc_setup(struct usb2_process *up, struct mtx *p_mtx,
-	    uint8_t prio);
 int	usb2_proc_create(struct usb2_process *up, struct mtx *p_mtx,
 	    const char *pmesg, uint8_t prio);
 void	usb2_proc_csignal(struct usb2_process *up);
 void	usb2_proc_drain(struct usb2_process *up);
 void	usb2_proc_mwait(struct usb2_process *up, void *pm0, void *pm1);
-void	usb2_proc_unsetup(struct usb2_process *up);
 void	usb2_proc_free(struct usb2_process *up);
 void   *usb2_proc_msignal(struct usb2_process *up, void *pm0, void *pm1);
 


More information about the p4-projects mailing list