Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25180
b: refs/heads/master
c: 24c7cd0
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter authored and Linus Torvalds committed Apr 2, 2006
1 parent 4acaa6f commit 685f1d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b043b673dc8a73daa233d5d92cf70b32e7351314
refs/heads/master: 24c7cd0630f76f0eb081d539c53893d9f15787e8
32 changes: 15 additions & 17 deletions trunk/drivers/ieee1394/sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,22 +496,17 @@ static struct sbp2_command_info *sbp2util_find_command_for_orb(
/*
* This function finds the sbp2_command for a given outstanding SCpnt.
* Only looks at the inuse list.
* Must be called with scsi_id->sbp2_command_orb_lock held.
*/
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt)
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(
struct scsi_id_instance_data *scsi_id, void *SCpnt)
{
struct sbp2_command_info *command;
unsigned long flags;

spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse)) {
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list) {
if (command->Current_SCpnt == SCpnt) {
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
if (!list_empty(&scsi_id->sbp2_command_orb_inuse))
list_for_each_entry(command, &scsi_id->sbp2_command_orb_inuse, list)
if (command->Current_SCpnt == SCpnt)
return command;
}
}
}
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
return NULL;
}

Expand Down Expand Up @@ -580,17 +575,15 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)

/*
* This function moves a command to the completed orb list.
* Must be called with scsi_id->sbp2_command_orb_lock held.
*/
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command)
static void sbp2util_mark_command_completed(
struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command)
{
unsigned long 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);
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);
}

/*
Expand Down Expand Up @@ -2148,7 +2141,9 @@ static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int dest
* Matched status with command, now grab scsi command pointers and check status
*/
SCpnt = command->Current_SCpnt;
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
sbp2util_mark_command_completed(scsi_id, command);
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);

if (SCpnt) {

Expand Down Expand Up @@ -2484,6 +2479,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
struct sbp2scsi_host_info *hi = scsi_id->hi;
struct sbp2_command_info *command;
unsigned long flags;

SBP2_ERR("aborting sbp2 command");
scsi_print_command(SCpnt);
Expand All @@ -2494,6 +2490,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
* Right now, just return any matching command structures
* to the free pool.
*/
spin_lock_irqsave(&scsi_id->sbp2_command_orb_lock, flags);
command = sbp2util_find_command_for_SCpnt(scsi_id, SCpnt);
if (command) {
SBP2_DEBUG("Found command to abort");
Expand All @@ -2511,6 +2508,7 @@ static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
command->Current_done(command->Current_SCpnt);
}
}
spin_unlock_irqrestore(&scsi_id->sbp2_command_orb_lock, flags);

/*
* Initiate a fetch agent reset.
Expand Down

0 comments on commit 685f1d9

Please sign in to comment.