Skip to content
Permalink
Browse files
megaraid: Stop using the SCSI pointer
This patch prepares for removal of the SCSI pointer from struct scsi_cmnd.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
  • Loading branch information
bvanassche committed Jan 21, 2022
1 parent 7d78660 commit 7f5c4ca6df22ad432a2631b6cdd374f40a249746
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
@@ -1066,22 +1066,15 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb,
static void
__mega_runpendq(adapter_t *adapter)
{
scb_t *scb;
struct list_head *pos, *next;

/* Issue any pending commands to the card */
list_for_each_safe(pos, next, &adapter->pending_list) {
struct megaraid_cmd_priv *pos, *next;

scb = list_entry(pos, scb_t, list);
/* Issue all pending commands to the card */
list_for_each_entry_safe(pos, next, &adapter->pending_list, entry) {
scb_t *scb;

if( !(scb->state & SCB_ISSUED) ) {

if( issue_scb(adapter, scb) != 0 )
return;
}
if (!(scb->state & SCB_ISSUED) && issue_scb(adapter, scb) != 0)
return;
}

return;
}


@@ -1644,14 +1637,11 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
static void
mega_rundoneq (adapter_t *adapter)
{
struct scsi_cmnd *cmd;
struct list_head *pos;
struct megaraid_cmd_priv *cmd_priv;

list_for_each(pos, &adapter->completed_list) {
list_for_each_entry(cmd_priv, &adapter->completed_list, entry) {
struct scsi_cmnd *cmd = (struct scsi_cmnd *)cmd_priv - 1;

struct scsi_pointer* spos = (struct scsi_pointer *)pos;

cmd = list_entry(spos, struct scsi_cmnd, SCp);
scsi_done(cmd);
}

@@ -1927,8 +1917,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
static int
megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor)
{
struct list_head *pos, *next;
scb_t *scb;
struct megaraid_cmd_priv *pos, *next;

dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n",
(aor == SCB_ABORT)? "ABORTING":"RESET",
@@ -1938,9 +1927,8 @@ megaraid_abort_and_reset(adapter_t *adapter, struct scsi_cmnd *cmd, int aor)
if(list_empty(&adapter->pending_list))
return FAILED;

list_for_each_safe(pos, next, &adapter->pending_list) {

scb = list_entry(pos, scb_t, list);
list_for_each_entry_safe(pos, next, &adapter->pending_list, entry) {
scb_t *scb = NULL;

if (scb->cmd == cmd) { /* Found command */

@@ -4123,6 +4111,7 @@ static struct scsi_host_template megaraid_template = {
.eh_bus_reset_handler = megaraid_reset,
.eh_host_reset_handler = megaraid_reset,
.no_write_same = 1,
.cmd_size = sizeof(struct megaraid_cmd_priv),
};

static int
@@ -756,8 +756,12 @@ struct private_bios_data {
#define CACHED_IO 0
#define DIRECT_IO 1

struct megaraid_cmd_priv {
struct list_head entry;
};

#define SCSI_LIST(scp) ((struct list_head *)(&(scp)->SCp))
#define SCSI_LIST(scp) \
(&((struct megaraid_cmd_priv *)scsi_cmd_priv(scp))->entry)

/*
* Each controller's soft state

0 comments on commit 7f5c4ca

Please sign in to comment.