Skip to content

Commit 75f5a0c

Browse files
fthainmartinkpetersen
authored andcommitted
scsi: sym53c500_cs: Stop using struct scsi_pointer
This driver doesn't use SCp.ptr to save a SCSI command data pointer which means "scsi pointer" is a complete misnomer here. Only a few members of struct scsi_pointer are needed so move those to private command data. Link: https://lore.kernel.org/r/accf71e293ba3aed6d18c8baeb405de8dfe7c935.1649235939.git.fthain@linux-m68k.org Cc: Bart Van Assche <bvanassche@acm.org> Cc: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Finn Thain <fthain@linux-m68k.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 4049f7a commit 75f5a0c

File tree

1 file changed

+25
-27
lines changed

1 file changed

+25
-27
lines changed

drivers/scsi/pcmcia/sym53c500_cs.c

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ struct sym53c500_data {
192192
int fast_pio;
193193
};
194194

195-
static struct scsi_pointer *sym53c500_scsi_pointer(struct scsi_cmnd *cmd)
196-
{
197-
return scsi_cmd_priv(cmd);
198-
}
195+
struct sym53c500_cmd_priv {
196+
int status;
197+
int message;
198+
int phase;
199+
};
199200

200201
enum Phase {
201202
idle,
@@ -356,7 +357,7 @@ SYM53C500_intr(int irq, void *dev_id)
356357
struct sym53c500_data *data =
357358
(struct sym53c500_data *)dev->hostdata;
358359
struct scsi_cmnd *curSC = data->current_SC;
359-
struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(curSC);
360+
struct sym53c500_cmd_priv *scp = scsi_cmd_priv(curSC);
360361
int fast_pio = data->fast_pio;
361362

362363
spin_lock_irqsave(dev->host_lock, flags);
@@ -403,12 +404,11 @@ SYM53C500_intr(int irq, void *dev_id)
403404

404405
if (int_reg & 0x20) { /* Disconnect */
405406
DEB(printk("SYM53C500: disconnect intr received\n"));
406-
if (scsi_pointer->phase != message_in) { /* Unexpected disconnect */
407+
if (scp->phase != message_in) { /* Unexpected disconnect */
407408
curSC->result = DID_NO_CONNECT << 16;
408409
} else { /* Command complete, return status and message */
409-
curSC->result = (scsi_pointer->Status & 0xff) |
410-
((scsi_pointer->Message & 0xff) << 8) |
411-
(DID_OK << 16);
410+
curSC->result = (scp->status & 0xff) |
411+
((scp->message & 0xff) << 8) | (DID_OK << 16);
412412
}
413413
goto idle_out;
414414
}
@@ -419,7 +419,7 @@ SYM53C500_intr(int irq, void *dev_id)
419419
struct scatterlist *sg;
420420
int i;
421421

422-
scsi_pointer->phase = data_out;
422+
scp->phase = data_out;
423423
VDEB(printk("SYM53C500: Data-Out phase\n"));
424424
outb(FLUSH_FIFO, port_base + CMD_REG);
425425
LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
@@ -438,7 +438,7 @@ SYM53C500_intr(int irq, void *dev_id)
438438
struct scatterlist *sg;
439439
int i;
440440

441-
scsi_pointer->phase = data_in;
441+
scp->phase = data_in;
442442
VDEB(printk("SYM53C500: Data-In phase\n"));
443443
outb(FLUSH_FIFO, port_base + CMD_REG);
444444
LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
@@ -453,12 +453,12 @@ SYM53C500_intr(int irq, void *dev_id)
453453
break;
454454

455455
case 0x02: /* COMMAND */
456-
scsi_pointer->phase = command_ph;
456+
scp->phase = command_ph;
457457
printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n");
458458
break;
459459

460460
case 0x03: /* STATUS */
461-
scsi_pointer->phase = status_ph;
461+
scp->phase = status_ph;
462462
VDEB(printk("SYM53C500: Status phase\n"));
463463
outb(FLUSH_FIFO, port_base + CMD_REG);
464464
outb(INIT_CMD_COMPLETE, port_base + CMD_REG);
@@ -471,24 +471,22 @@ SYM53C500_intr(int irq, void *dev_id)
471471

472472
case 0x06: /* MESSAGE-OUT */
473473
DEB(printk("SYM53C500: Message-Out phase\n"));
474-
scsi_pointer->phase = message_out;
474+
scp->phase = message_out;
475475
outb(SET_ATN, port_base + CMD_REG); /* Reject the message */
476476
outb(MSG_ACCEPT, port_base + CMD_REG);
477477
break;
478478

479479
case 0x07: /* MESSAGE-IN */
480480
VDEB(printk("SYM53C500: Message-In phase\n"));
481-
scsi_pointer->phase = message_in;
481+
scp->phase = message_in;
482482

483-
scsi_pointer->Status = inb(port_base + SCSI_FIFO);
484-
scsi_pointer->Message = inb(port_base + SCSI_FIFO);
483+
scp->status = inb(port_base + SCSI_FIFO);
484+
scp->message = inb(port_base + SCSI_FIFO);
485485

486486
VDEB(printk("SCSI FIFO size=%d\n", inb(port_base + FIFO_FLAGS) & 0x1f));
487-
DEB(printk("Status = %02x Message = %02x\n",
488-
scsi_pointer->Status, scsi_pointer->Message));
487+
DEB(printk("Status = %02x Message = %02x\n", scp->status, scp->message));
489488

490-
if (scsi_pointer->Message == SAVE_POINTERS ||
491-
scsi_pointer->Message == DISCONNECT) {
489+
if (scp->message == SAVE_POINTERS || scp->message == DISCONNECT) {
492490
outb(SET_ATN, port_base + CMD_REG); /* Reject message */
493491
DEB(printk("Discarding SAVE_POINTERS message\n"));
494492
}
@@ -500,7 +498,7 @@ SYM53C500_intr(int irq, void *dev_id)
500498
return IRQ_HANDLED;
501499

502500
idle_out:
503-
scsi_pointer->phase = idle;
501+
scp->phase = idle;
504502
scsi_done(curSC);
505503
goto out;
506504
}
@@ -548,7 +546,7 @@ SYM53C500_info(struct Scsi_Host *SChost)
548546

549547
static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)
550548
{
551-
struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(SCpnt);
549+
struct sym53c500_cmd_priv *scp = scsi_cmd_priv(SCpnt);
552550
int i;
553551
int port_base = SCpnt->device->host->io_port;
554552
struct sym53c500_data *data =
@@ -565,9 +563,9 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt)
565563
VDEB(printk("\n"));
566564

567565
data->current_SC = SCpnt;
568-
scsi_pointer->phase = command_ph;
569-
scsi_pointer->Status = 0;
570-
scsi_pointer->Message = 0;
566+
scp->phase = command_ph;
567+
scp->status = 0;
568+
scp->message = 0;
571569

572570
/* We are locked here already by the mid layer */
573571
REG0(port_base);
@@ -682,7 +680,7 @@ static struct scsi_host_template sym53c500_driver_template = {
682680
.this_id = 7,
683681
.sg_tablesize = 32,
684682
.shost_groups = SYM53C500_shost_groups,
685-
.cmd_size = sizeof(struct scsi_pointer),
683+
.cmd_size = sizeof(struct sym53c500_cmd_priv),
686684
};
687685

688686
static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data)

0 commit comments

Comments
 (0)