[Linux1394-cvslog] rev 773 - branches/linux-2.4
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2003-02-06 17:16:48
|
Author: bencollins Date: 2003-02-06 12:16:11 -0500 (Thu, 06 Feb 2003) New Revision: 773 Modified: branches/linux-2.4/sbp2.c Log: Patch from Sancho Dauskard removing sbp2 spinlock wrappers Modified: branches/linux-2.4/sbp2.c ============================================================================== --- branches/linux-2.4/sbp2.c (original) +++ branches/linux-2.4/sbp2.c 2003-02-06 12:16:12.000000000 -0500 @@ -516,22 +516,10 @@ #define SBP2_ERR(fmt, args...) HPSB_ERR("sbp2: "fmt, ## args) /* - * Spinlock debugging stuff. + * Globals */ -#define SBP2_USE_REAL_SPINLOCKS -#ifdef SBP2_USE_REAL_SPINLOCKS -#define sbp2_spin_lock(lock, flags) spin_lock_irqsave(lock, flags) -#define sbp2_spin_unlock(lock, flags) spin_unlock_irqrestore(lock, flags); static spinlock_t sbp2_host_info_lock = SPIN_LOCK_UNLOCKED; -#else -#define sbp2_spin_lock(lock, flags) do {save_flags(flags); cli();} while (0) -#define sbp2_spin_unlock(lock, flags) do {restore_flags(flags);} while (0) -#endif - -/* - * Globals - */ static Scsi_Host_Template scsi_driver_template; @@ -727,7 +715,7 @@ /* * Go through free list releasing packets */ - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); while (!list_empty(&hi->sbp2_req_free)) { lh = hi->sbp2_req_free.next; @@ -744,7 +732,7 @@ } kfree(hi->request_packet); - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return; } @@ -766,7 +754,7 @@ struct hpsb_packet *packet; unsigned long flags; - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); if (!list_empty(&hi->sbp2_req_free)) { /* @@ -817,7 +805,7 @@ } else { SBP2_ERR("sbp2util_allocate_request_packet - no packets available!"); } - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return(request_packet); } @@ -834,12 +822,12 @@ /* * Free the tlabel, and return the packet to the free pool. */ - sbp2_spin_lock(&hi->sbp2_request_packet_lock, flags); + spin_lock_irqsave(&hi->sbp2_request_packet_lock, flags); free_tlabel(hi->host, LOCAL_BUS | request_packet->packet->node_id, request_packet->packet->tlabel); list_del(&request_packet->list); list_add_tail(&request_packet->list, &hi->sbp2_req_free); - sbp2_spin_unlock(&hi->sbp2_request_packet_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_request_packet_lock, flags); return; } @@ -855,12 +843,12 @@ unsigned long flags; struct sbp2_command_info *command; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); for (i = 0; i < scsi_id->sbp2_total_command_orbs; i++) { command = (struct sbp2_command_info *) kmalloc(sizeof(struct sbp2_command_info), GFP_KERNEL); if (!command) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(-ENOMEM); } memset(command, '\0', sizeof(struct sbp2_command_info)); @@ -877,7 +865,7 @@ INIT_LIST_HEAD(&command->list); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return 0; } @@ -891,7 +879,7 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { list_for_each_safe(lh, next, &scsi_id->sbp2_command_orb_completed) { command = list_entry(lh, struct sbp2_command_info, list); @@ -909,7 +897,7 @@ kfree(command); } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return; } @@ -924,17 +912,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->command_orb_dma == orb) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); SBP2_ORB_DEBUG("could not match command orb %x", (unsigned int)orb); @@ -951,17 +939,17 @@ struct sbp2_command_info *command; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) { list_for_each(lh, &scsi_id->sbp2_command_orb_inuse) { command = list_entry(lh, struct sbp2_command_info, list); if (command->Current_SCpnt == SCpnt) { - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } } } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return(NULL); } @@ -978,7 +966,7 @@ struct sbp2_command_info *command = NULL; unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); if (!list_empty(&scsi_id->sbp2_command_orb_completed)) { lh = scsi_id->sbp2_command_orb_completed.next; list_del(lh); @@ -989,7 +977,7 @@ } else { SBP2_ERR("sbp2util_allocate_command_orb - No orbs available!"); } - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); return (command); } @@ -1034,11 +1022,11 @@ { unsigned long flags; - sbp2_spin_lock(&scsi_id->sbp2_command_orb_lock, flags); + spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags); list_del(&command->list); sbp2util_free_command_dma(command); list_add_tail(&command->list, &scsi_id->sbp2_command_orb_completed); - sbp2_spin_unlock(&scsi_id->sbp2_command_orb_lock, flags); + spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags); } @@ -1161,9 +1149,9 @@ /* Complete any pending commands with busy (so they get * retried) and remove them from our queue */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } /* @@ -1202,9 +1190,9 @@ return; } - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); list_add_tail(&hi->list, &sbp2_host_info_list); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); /* Register our host with the SCSI stack. */ hi->scsi_host = scsi_register (&scsi_driver_template, sizeof(void *)); @@ -1263,7 +1251,7 @@ SBP2_DEBUG("sbp2_remove_host"); - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); if (hi != NULL) { @@ -1274,7 +1262,7 @@ else SBP2_ERR("attempt to remove unknown host %p", host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); } /* @@ -2714,16 +2702,16 @@ return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&sbp2_host_info_lock, flags); + spin_lock_irqsave(&sbp2_host_info_lock, flags); hi = sbp2_find_host_info(host); - sbp2_spin_unlock(&sbp2_host_info_lock, flags); + spin_unlock_irqrestore(&sbp2_host_info_lock, flags); if (!hi) { SBP2_ERR("host info is NULL - this is bad!"); return(RCODE_ADDRESS_ERROR); } - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); /* * Find our scsi_id structure by looking at the status fifo address written to by @@ -2734,7 +2722,7 @@ if (!scsi_id) { SBP2_ERR("scsi_id is NULL - device is gone?"); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(RCODE_ADDRESS_ERROR); } @@ -2821,7 +2809,7 @@ } } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); if (SCpnt) { @@ -2917,12 +2905,12 @@ /* * Try and send our SCSI command */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); if (sbp2_send_command(hi, scsi_id, SCpnt, done)) { SBP2_ERR("Error sending SCSI command"); sbp2scsi_complete_command(hi, scsi_id, SBP2_SCSI_STATUS_SELECTION_TIMEOUT, SCpnt, done); } - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); return(0); } @@ -3096,7 +3084,7 @@ * Right now, just return any matching command structures * to the free pool. */ - sbp2_spin_lock(&hi->sbp2_command_lock, flags); + spin_lock_irqsave(&hi->sbp2_command_lock, flags); command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt); if (command) { SBP2_DEBUG("Found command to abort"); @@ -3121,7 +3109,7 @@ */ sbp2_agent_reset(hi, scsi_id, SBP2_SEND_NO_WAIT); sbp2scsi_complete_all_commands(hi, scsi_id, DID_BUS_BUSY); - sbp2_spin_unlock(&hi->sbp2_command_lock, flags); + spin_unlock_irqrestore(&hi->sbp2_command_lock, flags); } return(SUCCESS); |