PERFORCE change 118286 for review

Scott Long scottl at FreeBSD.org
Tue Apr 17 05:22:12 UTC 2007


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

Change 118286 by scottl at scottl-wv1u on 2007/04/17 05:21:56

	Put the ahc and ahd drivers into a commitable form.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7770.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.c#8 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.h#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#17 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.h#11 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_pci.c#7 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.c#8 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.h#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#15 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.h#12 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_pci.c#5 edit
.. //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.c#7 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7770.c#5 (text+ko) ====

@@ -126,7 +126,6 @@
 int
 aic7770_config(struct ahc_softc *ahc, struct aic7770_identity *entry, u_int io)
 {
-	u_long	l;
 	int	error;
 	int	have_seeprom;
 	u_int	hostconf;
@@ -254,7 +253,7 @@
 	if (error != 0)
 		return (error);
 
-	ahc_list_lock(&l);
+	ahc_lock(ahc);
 	/*
 	 * Link this softc in with all other ahc instances.
 	 */
@@ -265,7 +264,7 @@
 	 */
 	ahc_outb(ahc, BCTL, ENABLE);
 
-	ahc_list_unlock(&l);
+	ahc_unlock(ahc);
 
 	return (0);
 }

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.c#8 (text+ko) ====

@@ -5271,6 +5271,7 @@
 		ahd_free(ahd);
 		ahd = NULL;
 	}
+	ahd_lockinit(ahd);
 #ifdef AHD_DEBUG
 	if ((ahd_debug & AHD_SHOW_MEMORY) != 0) {
 		printf("%s: scb size = 0x%x, hscb size = 0x%x\n",
@@ -5342,22 +5343,6 @@
 	ahd->init_level++;
 }
 
-/*
- * Verify that the passed in softc pointer is for a
- * controller that is still configured.
- */
-struct ahd_softc *
-ahd_find_softc(struct ahd_softc *ahd)
-{
-	struct ahd_softc *list_ahd;
-
-	TAILQ_FOREACH(list_ahd, &ahd_tailq, links) {
-		if (list_ahd == ahd)
-			return (ahd);
-	}
-	return (NULL);
-}
-
 void
 ahd_set_unit(struct ahd_softc *ahd, int unit)
 {
@@ -8061,19 +8046,10 @@
 static void
 ahd_reset_poll(void *arg)
 {
-	struct	ahd_softc *ahd;
+	struct	ahd_softc *ahd = (struct ahd_softc *)arg;
 	u_int	scsiseq1;
-	u_long	l;
-	u_long	s;
 	
-	ahd_list_lock(&l);
-	ahd = ahd_find_softc((struct ahd_softc *)arg);
-	if (ahd == NULL) {
-		printf("ahd_reset_poll: Instance %p no longer exists\n", arg);
-		ahd_list_unlock(&l);
-		return;
-	}
-	ahd_lock(ahd, &s);
+	ahd_lock(ahd);
 	ahd_pause(ahd);
 	ahd_update_modes(ahd);
 	ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
@@ -8082,8 +8058,7 @@
 		aic_timer_reset(&ahd->reset_timer, AHD_RESET_POLL_MS,
 				ahd_reset_poll, ahd);
 		ahd_unpause(ahd);
-		ahd_unlock(ahd, &s);
-		ahd_list_unlock(&l);
+		ahd_unlock(ahd);
 		return;
 	}
 
@@ -8094,28 +8069,17 @@
 	ahd_unpause(ahd);
 	ahd->flags &= ~AHD_RESET_POLL_ACTIVE;
 	aic_release_simq(ahd);
-	ahd_unlock(ahd, &s);
-	ahd_list_unlock(&l);
+	ahd_unlock(ahd);
 }
 
 /**************************** Statistics Processing ***************************/
 static void
 ahd_stat_timer(void *arg)
 {
-	struct	ahd_softc *ahd;
-	u_long	l;
-	u_long	s;
+	struct	ahd_softc *ahd = (struct ahd_softc *)arg;
 	int	enint_coal;
 	
-	ahd_list_lock(&l);
-	ahd = ahd_find_softc((struct ahd_softc *)arg);
-	if (ahd == NULL) {
-		printf("ahd_stat_timer: Instance %p no longer exists\n", arg);
-		ahd_list_unlock(&l);
-		return;
-	}
-	ahd_lock(ahd, &s);
-
+	ahd_lock(ahd);
 	enint_coal = ahd->hs_mailbox & ENINT_COALESCE;
 	if (ahd->cmdcmplt_total > ahd->int_coalescing_threshold)
 		enint_coal |= ENINT_COALESCE;
@@ -8139,8 +8103,7 @@
 	ahd->cmdcmplt_counts[ahd->cmdcmplt_bucket] = 0;
 	aic_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_MS,
 			ahd_stat_timer, ahd);
-	ahd_unlock(ahd, &s);
-	ahd_list_unlock(&l);
+	ahd_unlock(ahd);
 }
 
 /****************************** Status Processing *****************************/
@@ -9277,15 +9240,12 @@
 ahd_timeout(struct scb *scb)
 {
 	struct ahd_softc *ahd;
-	u_long s;
 
 	ahd = scb->ahd_softc;
 	if ((scb->flags & SCB_ACTIVE) != 0) {
 		if ((scb->flags & SCB_TIMEDOUT) == 0) {
-			ahd_lock(ahd, &s);
 			LIST_INSERT_HEAD(&ahd->timedout_scbs, scb,
 					 timedout_links);
-			ahd_unlock(ahd, &s);
 			scb->flags |= SCB_TIMEDOUT;
 		}
 		ahd_wakeup_recovery_thread(ahd);
@@ -9304,14 +9264,11 @@
 {
 	struct	scb *scb;
 	struct	scb *active_scb;
-	long	s;
 	int	found;
 	int	was_paused;
 	u_int	active_scbptr;
 	u_int	last_phase;
 
-	ahd_lock(ahd, &s);
-
 	/*
 	 * Pause the controller and manually flush any
 	 * commands that have just completed but that our
@@ -9337,7 +9294,6 @@
 		printf("%s: Timedout SCBs already complete. "
 		       "Interrupts may not be functioning.\n", ahd_name(ahd));
 		ahd_unpause(ahd);
-		ahd_unlock(ahd, &s);
 		return;
 	}
 
@@ -9528,7 +9484,6 @@
 	}
 
 	ahd_unpause(ahd);
-	ahd_unlock(ahd, &s);
 }
 
 /*
@@ -9944,13 +9899,9 @@
 	 */
 	if ((ahd->flags & AHD_TARGETROLE) == 0
 	 && ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
-		u_long	s;
-
 		printf("Configuring Target Mode\n");
-		ahd_lock(ahd, &s);
 		if (LIST_FIRST(&ahd->pending_scbs) != NULL) {
 			ccb->ccb_h.status = CAM_BUSY;
-			ahd_unlock(ahd, &s);
 			return;
 		}
 		ahd->flags |= AHD_TARGETROLE;
@@ -9959,7 +9910,6 @@
 		ahd_pause(ahd);
 		ahd_loadseq(ahd);
 		ahd_restart(ahd);
-		ahd_unlock(ahd, &s);
 	}
 	cel = &ccb->cel;
 	target = ccb->ccb_h.target_id;
@@ -10025,7 +9975,6 @@
 		}
 		SLIST_INIT(&lstate->accept_tios);
 		SLIST_INIT(&lstate->immed_notifies);
-		ahd_lock(ahd, &s);
 		ahd_pause(ahd);
 		if (target != CAM_TARGET_WILDCARD) {
 			tstate->enabled_luns[lun] = lstate;
@@ -10084,7 +10033,6 @@
 			ahd_outb(ahd, SCSISEQ1, scsiseq1);
 		}
 		ahd_unpause(ahd);
-		ahd_unlock(ahd, &s);
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_print_path(ccb->ccb_h.path);
 		printf("Lun now enabled for target mode\n");
@@ -10097,8 +10045,6 @@
 			return;
 		}
 
-		ahd_lock(ahd, &s);
-		
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) {
 			struct ccb_hdr *ccbh;
@@ -10108,7 +10054,6 @@
 			 && !xpt_path_comp(ccbh->path, ccb->ccb_h.path)){
 				printf("CTIO pending\n");
 				ccb->ccb_h.status = CAM_REQ_INVALID;
-				ahd_unlock(ahd, &s);
 				return;
 			}
 		}
@@ -10124,7 +10069,6 @@
 		}
 
 		if (ccb->ccb_h.status != CAM_REQ_CMP) {
-			ahd_unlock(ahd, &s);
 			return;
 		}
 
@@ -10191,7 +10135,6 @@
 			}
 		}
 		ahd_unpause(ahd);
-		ahd_unlock(ahd, &s);
 	}
 #endif
 }

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx.h#7 (text+ko) ====

@@ -1398,7 +1398,6 @@
 int			 ahd_suspend(struct ahd_softc *ahd); 
 int			 ahd_resume(struct ahd_softc *ahd);
 void			 ahd_softc_insert(struct ahd_softc *);
-struct ahd_softc	*ahd_find_softc(struct ahd_softc *ahd);
 void			 ahd_set_unit(struct ahd_softc *, int);
 void			 ahd_set_name(struct ahd_softc *, char *);
 struct scb		*ahd_get_scb(struct ahd_softc *ahd, u_int col_idx);

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.c#17 (text+ko) ====

@@ -114,16 +114,12 @@
 	struct cam_devq *devq;
 	struct cam_sim *sim;
 	struct cam_path *path;
-	u_long s;
 	int count;
 
 	count = 0;
 	devq = NULL;
 	sim = NULL;
 
-	ahd_lockinit(ahd);
-	ahd_list_lockinit();
-
 	/*
 	 * Create a thread to perform all recovery.
 	 */
@@ -132,7 +128,7 @@
 
 	ahd_controller_info(ahd, ahd_info);
 	printf("%s\n", ahd_info);
-	ahd_lock(ahd, &s);
+	ahd_lock(ahd);
 
 	/*
 	 * Create the device queue for our SIM(s).
@@ -178,7 +174,7 @@
 fail:
 	ahd->platform_data->sim = sim;
 	ahd->platform_data->path = path;
-	ahd_unlock(ahd, &s);
+	ahd_unlock(ahd);
 	if (count != 0) {
 		/* We have to wait until after any system dumps... */
 		ahd->platform_data->eh =
@@ -200,9 +196,9 @@
 	struct	ahd_softc *ahd;
 
 	ahd = (struct ahd_softc *)arg; 
-	ahd_lock(ahd, NULL);
+	ahd_lock(ahd);
 	ahd_intr(ahd);
-	ahd_unlock(ahd, NULL);
+	ahd_unlock(ahd);
 }
 
 /*
@@ -1269,21 +1265,14 @@
 ahd_detach(device_t dev)
 {
 	struct ahd_softc *ahd;
-	u_long l;
 
-	ahd_list_lock(&l);
 	device_printf(dev, "detaching device\n");
 	ahd = device_get_softc(dev);
-	ahd = ahd_find_softc(ahd);
-	if (ahd == NULL) {
-		device_printf(dev, "aic7xxx already detached\n");
-		ahd_list_unlock(&l);
-		return (ENOENT);
-	}
+	ahd_lock(ahd);
 	TAILQ_REMOVE(&ahd_tailq, ahd, links);
-	ahd_list_unlock(&l);
 	ahd_intr_enable(ahd, FALSE);
 	bus_teardown_intr(dev, ahd->platform_data->irq, ahd->platform_data->ih);
+	ahd_unlock(ahd);
 	ahd_free(ahd);
 	return (0);
 }

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_osm.h#11 (text+ko) ====

@@ -190,14 +190,9 @@
 /**************************** Locking Primitives ******************************/
 /* Lock protecting internal data structures */
 static __inline void ahd_lockinit(struct ahd_softc *);
-static __inline void ahd_lock(struct ahd_softc *, unsigned long *flags);
-static __inline void ahd_unlock(struct ahd_softc *, unsigned long *flags);
+static __inline void ahd_lock(struct ahd_softc *);
+static __inline void ahd_unlock(struct ahd_softc *);
 
-/* Lock held during ahd_list manipulation and ahd softc frees */
-static __inline void ahd_list_lockinit(void);
-static __inline void ahd_list_lock(unsigned long *flags);
-static __inline void ahd_list_unlock(unsigned long *flags);
-
 static __inline void
 ahd_lockinit(struct ahd_softc *ahd)
 {
@@ -205,33 +200,17 @@
 }
 
 static __inline void
-ahd_lock(struct ahd_softc *ahd, unsigned long *flags)
+ahd_lock(struct ahd_softc *ahd)
 {
 	mtx_lock(&ahd->platform_data->mtx);
 }
 
 static __inline void
-ahd_unlock(struct ahd_softc *ahd, unsigned long *flags)
+ahd_unlock(struct ahd_softc *ahd)
 {
 	mtx_unlock(&ahd->platform_data->mtx);
 }
 
-/* Lock held during ahd_list manipulation and ahd softc frees */
-static __inline void
-ahd_list_lockinit(void)
-{
-}
-
-static __inline void
-ahd_list_lock(unsigned long *flags)
-{
-}
-
-static __inline void
-ahd_list_unlock(unsigned long *flags)
-{
-}
-
 /********************************** PCI ***************************************/
 int ahd_pci_map_registers(struct ahd_softc *ahd);
 int ahd_pci_map_int(struct ahd_softc *ahd);

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic79xx_pci.c#7 (text+ko) ====

@@ -314,7 +314,6 @@
 ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)
 {
 	struct scb_data *shared_scb_data;
-	u_long		 l;
 	u_int		 command;
 	uint32_t	 devconfig;
 	uint16_t	 device; 
@@ -423,12 +422,12 @@
 	if (error != 0)
 		return (error);
 
-	ahd_list_lock(&l);
+	ahd_lock(ahd);
 	/*
 	 * Link this softc in with all other ahd instances.
 	 */
 	ahd_softc_insert(ahd);
-	ahd_list_unlock(&l);
+	ahd_unlock(ahd);
 	return (0);
 }
 

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.c#8 (text+ko) ====

@@ -3948,6 +3948,7 @@
 		ahc_free(ahc);
 		ahc = NULL;
 	}
+	ahc_lockinit(ahc);
 	return (ahc);
 }
 
@@ -4029,22 +4030,6 @@
 	ahc->init_level++;
 }
 
-/*
- * Verify that the passed in softc pointer is for a
- * controller that is still configured.
- */
-struct ahc_softc *
-ahc_find_softc(struct ahc_softc *ahc)
-{
-	struct ahc_softc *list_ahc;
-
-	TAILQ_FOREACH(list_ahc, &ahc_tailq, links) {
-		if (list_ahc == ahc)
-			return (ahc);
-	}
-	return (NULL);
-}
-
 void
 ahc_set_unit(struct ahc_softc *ahc, int unit)
 {
@@ -6945,7 +6930,7 @@
 	struct ahc_softc *ahc;
 
 	ahc = scb->ahc_softc;
-	ahc_lock(ahc, NULL);
+	ahc_lock(ahc);
 	if ((scb->flags & SCB_ACTIVE) != 0) {
 		if ((scb->flags & SCB_TIMEDOUT) == 0) {
 			LIST_INSERT_HEAD(&ahc->timedout_scbs, scb,
@@ -6954,7 +6939,7 @@
 		}
 		ahc_wakeup_recovery_thread(ahc);
 	}
-	ahc_unlock(ahc, NULL);
+	ahc_unlock(ahc);
 }
 
 /*
@@ -7020,13 +7005,10 @@
 ahc_recover_commands(struct ahc_softc *ahc)
 {
 	struct	scb *scb;
-	long	s;
 	int	found;
 	int	restart_needed;
 	u_int	last_phase;
 
-	ahc_lock(ahc, &s);
-
 	/*
 	 * Pause the controller and manually flush any
 	 * commands that have just completed but that our
@@ -7046,7 +7028,6 @@
 		printf("%s: Timedout SCBs already complete. "
 		       "Interrupts may not be functioning.\n", ahc_name(ahc));
 		ahc_unpause(ahc);
-		ahc_unlock(ahc, &s);
 		return;
 	}
 
@@ -7299,7 +7280,6 @@
 		ahc_restart(ahc);
 	else
 		ahc_unpause(ahc);
-	ahc_unlock(ahc, &s);
 }
 
 /************************* Target Mode ****************************************/
@@ -7352,7 +7332,6 @@
 	struct	   ahc_tmode_lstate *lstate;
 	struct	   ccb_en_lun *cel;
 	cam_status status;
-	u_long	   s;
 	u_int	   target;
 	u_int	   lun;
 	u_int	   target_mask;
@@ -7434,14 +7413,11 @@
 	 */
 	if ((ahc->flags & AHC_TARGETROLE) == 0
 	 && ccb->ccb_h.target_id != CAM_TARGET_WILDCARD) {
-		u_long	 s;
 		ahc_flag saved_flags;
 
 		printf("Configuring Target Mode\n");
-		ahc_lock(ahc, &s);
 		if (LIST_FIRST(&ahc->pending_scbs) != NULL) {
 			ccb->ccb_h.status = CAM_BUSY;
-			ahc_unlock(ahc, &s);
 			return;
 		}
 		saved_flags = ahc->flags;
@@ -7462,12 +7438,10 @@
 			ahc->flags = saved_flags;
 			(void)ahc_loadseq(ahc);
 			ahc_restart(ahc);
-			ahc_unlock(ahc, &s);
 			ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;
 			return;
 		}
 		ahc_restart(ahc);
-		ahc_unlock(ahc, &s);
 	}
 	cel = &ccb->cel;
 	target = ccb->ccb_h.target_id;
@@ -7533,7 +7507,6 @@
 		}
 		SLIST_INIT(&lstate->accept_tios);
 		SLIST_INIT(&lstate->immed_notifies);
-		ahc_lock(ahc, &s);
 		ahc_pause(ahc);
 		if (target != CAM_TARGET_WILDCARD) {
 			tstate->enabled_luns[lun] = lstate;
@@ -7599,7 +7572,6 @@
 			ahc_outb(ahc, SCSISEQ, scsiseq);
 		}
 		ahc_unpause(ahc);
-		ahc_unlock(ahc, &s);
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		xpt_print_path(ccb->ccb_h.path);
 		printf("Lun now enabled for target mode\n");
@@ -7612,8 +7584,6 @@
 			return;
 		}
 
-		ahc_lock(ahc, &s);
-		
 		ccb->ccb_h.status = CAM_REQ_CMP;
 		LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) {
 			struct ccb_hdr *ccbh;
@@ -7623,7 +7593,6 @@
 			 && !xpt_path_comp(ccbh->path, ccb->ccb_h.path)){
 				printf("CTIO pending\n");
 				ccb->ccb_h.status = CAM_REQ_INVALID;
-				ahc_unlock(ahc, &s);
 				return;
 			}
 		}
@@ -7639,7 +7608,6 @@
 		}
 
 		if (ccb->ccb_h.status != CAM_REQ_CMP) {
-			ahc_unlock(ahc, &s);
 			return;
 		}
 
@@ -7714,7 +7682,6 @@
 			}
 		}
 		ahc_unpause(ahc);
-		ahc_unlock(ahc, &s);
 	}
 }
 

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx.h#5 (text+ko) ====

@@ -1225,7 +1225,6 @@
 int			 ahc_suspend(struct ahc_softc *ahc); 
 int			 ahc_resume(struct ahc_softc *ahc);
 void			 ahc_softc_insert(struct ahc_softc *);
-struct ahc_softc	*ahc_find_softc(struct ahc_softc *ahc);
 void			 ahc_set_unit(struct ahc_softc *, int);
 void			 ahc_set_name(struct ahc_softc *, char *);
 void			 ahc_alloc_scbs(struct ahc_softc *ahc);

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.c#15 (text+ko) ====

@@ -152,7 +152,6 @@
 	struct cam_sim *sim2;
 	struct cam_path *path;
 	struct cam_path *path2;
-	long s;
 	int count;
 
 	count = 0;
@@ -162,9 +161,6 @@
 	path2 = NULL;
 
 
-	ahc_lockinit(ahc);
-	ahc_list_lockinit();
-
 	/*
 	 * Create a thread to perform all recovery.
 	 */
@@ -173,7 +169,7 @@
 
 	ahc_controller_info(ahc, ahc_info);
 	printf("%s\n", ahc_info);
-	ahc_lock(ahc, &s);
+	ahc_lock(ahc);
 
 	/*
 	 * Attach secondary channel first if the user has
@@ -283,7 +279,7 @@
 		ahc->platform_data->sim_b = sim2;
 		ahc->platform_data->path_b = path2;
 	}
-	ahc_unlock(ahc, &s);
+	ahc_unlock(ahc);
 
 	if (count != 0) {
 		/* We have to wait until after any system dumps... */
@@ -305,9 +301,9 @@
 	struct	ahc_softc *ahc;
 
 	ahc = (struct ahc_softc *)arg; 
-	ahc_lock(ahc, NULL);
+	ahc_lock(ahc);
 	ahc_intr(ahc);
-	ahc_unlock(ahc, NULL);
+	ahc_unlock(ahc);
 }
 
 /*
@@ -1153,13 +1149,9 @@
 
 			if (hscb->cdb_len > sizeof(hscb->cdb32)
 			 || (ccb_h->flags & CAM_CDB_PHYS) != 0) {
-				u_long s;
-
 				aic_set_transaction_status(scb,
 							   CAM_REQ_INVALID);
-				ahc_lock(ahc, &s);
 				ahc_free_scb(ahc, scb);
-				ahc_unlock(ahc, &s);
 				xpt_done((union ccb *)csio);
 				return;
 			}
@@ -1441,24 +1433,14 @@
 ahc_detach(device_t dev)
 {
 	struct ahc_softc *ahc;
-	u_long l;
-	u_long s;
 
-	ahc_list_lock(&l);
 	device_printf(dev, "detaching device\n");
 	ahc = device_get_softc(dev);
-	ahc = ahc_find_softc(ahc);
-	if (ahc == NULL) {
-		device_printf(dev, "aic7xxx already detached\n");
-		ahc_list_unlock(&l);
-		return (ENOENT);
-	}
+	ahc_lock(ahc);
 	TAILQ_REMOVE(&ahc_tailq, ahc, links);
-	ahc_list_unlock(&l);
-	ahc_lock(ahc, &s);
 	ahc_intr_enable(ahc, FALSE);
 	bus_teardown_intr(dev, ahc->platform_data->irq, ahc->platform_data->ih);
-	ahc_unlock(ahc, &s);
+	ahc_unlock(ahc);
 	ahc_free(ahc);
 	return (0);
 }

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_osm.h#12 (text+ko) ====

@@ -188,14 +188,9 @@
 /**************************** Locking Primitives ******************************/
 /* Lock protecting internal data structures */
 static __inline void ahc_lockinit(struct ahc_softc *);
-static __inline void ahc_lock(struct ahc_softc *, unsigned long *flags);
-static __inline void ahc_unlock(struct ahc_softc *, unsigned long *flags);
+static __inline void ahc_lock(struct ahc_softc *);
+static __inline void ahc_unlock(struct ahc_softc *);
 
-/* Lock held during ahc_list manipulation and ahc softc frees */
-static __inline void ahc_list_lockinit(void);
-static __inline void ahc_list_lock(unsigned long *flags);
-static __inline void ahc_list_unlock(unsigned long *flags);
-
 static __inline void
 ahc_lockinit(struct ahc_softc *ahc)
 {
@@ -203,33 +198,17 @@
 }
 
 static __inline void
-ahc_lock(struct ahc_softc *ahc, unsigned long *flags)
+ahc_lock(struct ahc_softc *ahc)
 {
 	mtx_lock(&ahc->platform_data->mtx);
 }
 
 static __inline void
-ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
+ahc_unlock(struct ahc_softc *ahc)
 {
 	mtx_unlock(&ahc->platform_data->mtx);
 }
 
-/* Lock held during ahc_list manipulation and ahc softc frees */
-static __inline void
-ahc_list_lockinit(void)
-{
-}
-
-static __inline void
-ahc_list_lock(unsigned long *flags)
-{
-}
-
-static __inline void
-ahc_list_unlock(unsigned long *flags)
-{
-}
-
 /************************* Initialization/Teardown ****************************/
 int	  ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg);
 void	  ahc_platform_free(struct ahc_softc *ahc);

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic7xxx_pci.c#5 (text+ko) ====

@@ -785,7 +785,6 @@
 int
 ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry)
 {
-	u_long	 l;
 	u_int	 command;
 	u_int	 our_id;
 	u_int	 sxfrctl1;
@@ -1045,12 +1044,12 @@
 	if (error != 0)
 		return (error);
 
-	ahc_list_lock(&l);
+	ahc_lock(ahc);
 	/*
 	 * Link this softc in with all other ahc instances.
 	 */
 	ahc_softc_insert(ahc);
-	ahc_list_unlock(&l);
+	ahc_unlock(ahc);
 	return (0);
 }
 

==== //depot/projects/scottl-camlock/src/sys/dev/aic7xxx/aic_osm_lib.c#7 (text+ko) ====

@@ -66,12 +66,11 @@
 aic_platform_timeout(void *arg)
 {
 	struct	scb *scb;
-	u_long	s;
 	
 	scb = (struct scb *)arg; 
-	aic_lock(scb->aic_softc, &s);
+	aic_lock(scb->aic_softc);
 	aic_timeout(scb);
-	aic_unlock(scb->aic_softc, &s);
+	aic_unlock(scb->aic_softc);
 }
 
 int
@@ -92,11 +91,8 @@
 void
 aic_terminate_recovery_thread(struct aic_softc *aic)
 {
-	u_long s;
 
-	aic_lock(aic, &s);
 	if (aic->platform_data->recovery_thread == NULL) {
-		aic_unlock(aic, &s);
 		return;
 	}
 	aic->flags |= AIC_SHUTDOWN_RECOVERY;
@@ -106,17 +102,15 @@
 	 * for this interlock just for added safety.
 	 */
 	msleep(aic->platform_data, &aic->platform_data->mtx, PUSER, "thtrm", 0);
-	aic_unlock(aic, &s);
 }
 
 static void
 aic_recovery_thread(void *arg)
 {
 	struct aic_softc *aic;
-	u_long s;
 
 	aic = (struct aic_softc *)arg;
-	aic_lock(aic, &s);
+	aic_lock(aic);
 	for (;;) {
 		
 		if (LIST_EMPTY(&aic->timedout_scbs) != 0
@@ -126,13 +120,13 @@
 		if ((aic->flags & AIC_SHUTDOWN_RECOVERY) != 0)
 			break;
 
-		aic_unlock(aic, &s);
+		aic_unlock(aic);
 		aic_recover_commands(aic);
-		aic_lock(aic, &s);
+		aic_lock(aic);
 	}
 	aic->platform_data->recovery_thread = NULL;
 	wakeup(aic->platform_data);
-	aic_unlock(aic, &s);
+	aic_unlock(aic);
 	kthread_exit(0);
 }
 


More information about the p4-projects mailing list