Index: asr.c =================================================================== --- asr.c (revision 234389) +++ asr.c (working copy) @@ -378,11 +378,12 @@ u_int16_t ha_Msgs_Count; /* Links into other parents and HBAs */ - struct Asr_softc * ha_next; /* HBA list */ + STAILQ_ENTRY(Asr_softc) ha_next; /* HBA list */ struct cdev *ha_devt; } Asr_softc_t; -static Asr_softc_t *Asr_softc_list; +static STAILQ_HEAD(, Asr_softc) Asr_softc_list = + STAILQ_HEAD_INITIALIZER(Asr_softc_list); /* * Prototypes of the routines we have in this object. @@ -1959,7 +1960,7 @@ { PI2O_EXEC_SYS_TAB_SET_MESSAGE Message_Ptr; PI2O_SET_SYSTAB_HEADER SystemTable; - Asr_softc_t * ha; + Asr_softc_t * ha, *next; PI2O_SGE_SIMPLE_ELEMENT sg; int retVal; @@ -1967,7 +1968,7 @@ sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_WAITOK | M_ZERO)) == NULL) { return (ENOMEM); } - for (ha = Asr_softc_list; ha; ha = ha->ha_next) { + STAILQ_FOREACH(ha, &Asr_softc_list, ha_next) { ++SystemTable->NumberEntries; } if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)malloc ( @@ -1998,9 +1999,9 @@ &(Message_Ptr->StdMessageFrame)) & 0xF0) >> 2)); SG(sg, 0, I2O_SGL_FLAGS_DIR, SystemTable, sizeof(I2O_SET_SYSTAB_HEADER)); ++sg; - for (ha = Asr_softc_list; ha; ha = ha->ha_next) { + STAILQ_FOREACH_SAFE(ha, &Asr_softc_list, ha_next, next) { SG(sg, 0, - ((ha->ha_next) + ((next) ? (I2O_SGL_FLAGS_DIR) : (I2O_SGL_FLAGS_DIR | I2O_SGL_FLAGS_END_OF_BUFFER)), &(ha->ha_SystemTable), sizeof(ha->ha_SystemTable)); @@ -2396,7 +2397,7 @@ { PI2O_EXEC_STATUS_GET_REPLY status; PI2O_LCT_ENTRY Device; - Asr_softc_t *sc, **ha; + Asr_softc_t *sc; struct scsi_inquiry_data *iq; int bus, size, unit; int error; @@ -2405,7 +2406,7 @@ unit = device_get_unit(dev); sc->ha_dev = dev; - if (Asr_softc_list == NULL) { + if (STAILQ_EMPTY(&Asr_softc_list)) { /* * Fixup the OS revision as saved in the dptsig for the * engine (dptioctl.h) to pick up. @@ -2417,8 +2418,7 @@ */ LIST_INIT(&(sc->ha_ccb)); /* Link us into the HA list */ - for (ha = &Asr_softc_list; *ha; ha = &((*ha)->ha_next)); - *(ha) = sc; + STAILQ_INSERT_TAIL(&Asr_softc_list, sc, ha_next); /* * This is the real McCoy!