diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2010-04-04 11:00:39 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-05-02 16:01:55 -0400 |
commit | afdbbc16134ae2eea612b51cab7545938d266dce (patch) | |
tree | f47df23b8164a0c5b918380caaba3e25a2eaddae | |
parent | ce195662bbc063c29294c11a57aa2db182a837ea (diff) |
[SCSI] a3000: Use shost_priv() and kill ugly HDATA() macro
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/a3000.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index 31434f7c368..bc6eb69f5fd 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -23,7 +23,6 @@ #define DMA(ptr) ((a3000_scsiregs *)((ptr)->base)) -#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) static struct Scsi_Host *a3000_host = NULL; @@ -48,6 +47,7 @@ static irqreturn_t a3000_intr(int irq, void *dummy) static int dma_setup(struct scsi_cmnd *cmd, int dir_in) { + struct WD33C93_hostdata *hdata = shost_priv(a3000_host); unsigned short cntr = CNTR_PDMD | CNTR_INTEN; unsigned long addr = virt_to_bus(cmd->SCp.ptr); @@ -58,24 +58,23 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) * buffer */ if (addr & A3000_XFER_MASK) { - HDATA(a3000_host)->dma_bounce_len = - (cmd->SCp.this_residual + 511) & ~0x1ff; - HDATA(a3000_host)->dma_bounce_buffer = - kmalloc(HDATA(a3000_host)->dma_bounce_len, GFP_KERNEL); + hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; + hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, + GFP_KERNEL); /* can't allocate memory; use PIO */ - if (!HDATA(a3000_host)->dma_bounce_buffer) { - HDATA(a3000_host)->dma_bounce_len = 0; + if (!hdata->dma_bounce_buffer) { + hdata->dma_bounce_len = 0; return 1; } if (!dir_in) { /* copy to bounce buffer for a write */ - memcpy(HDATA(a3000_host)->dma_bounce_buffer, - cmd->SCp.ptr, cmd->SCp.this_residual); + memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, + cmd->SCp.this_residual); } - addr = virt_to_bus(HDATA(a3000_host)->dma_bounce_buffer); + addr = virt_to_bus(hdata->dma_bounce_buffer); } /* setup dma direction */ @@ -83,7 +82,7 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) cntr |= CNTR_DDIR; /* remember direction */ - HDATA(a3000_host)->dma_dir = dir_in; + hdata->dma_dir = dir_in; DMA(a3000_host)->CNTR = cntr; @@ -110,17 +109,19 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, int status) { + struct WD33C93_hostdata *hdata = shost_priv(instance); + /* disable SCSI interrupts */ unsigned short cntr = CNTR_PDMD; - if (!HDATA(instance)->dma_dir) + if (!hdata->dma_dir) cntr |= CNTR_DDIR; DMA(instance)->CNTR = cntr; mb(); /* make sure CNTR is updated before next IO */ /* flush if we were reading */ - if (HDATA(instance)->dma_dir) { + if (hdata->dma_dir) { DMA(instance)->FLUSH = 1; mb(); /* don't allow prefetch */ while (!(DMA(instance)->ISTR & ISTR_FE_FLG)) @@ -143,19 +144,19 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, mb(); /* make sure CNTR is updated before next IO */ /* copy from a bounce buffer, if necessary */ - if (status && HDATA(instance)->dma_bounce_buffer) { + if (status && hdata->dma_bounce_buffer) { if (SCpnt) { - if (HDATA(instance)->dma_dir && SCpnt) + if (hdata->dma_dir && SCpnt) memcpy(SCpnt->SCp.ptr, - HDATA(instance)->dma_bounce_buffer, + hdata->dma_bounce_buffer, SCpnt->SCp.this_residual); - kfree(HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } else { - kfree(HDATA(instance)->dma_bounce_buffer); - HDATA(instance)->dma_bounce_buffer = NULL; - HDATA(instance)->dma_bounce_len = 0; + kfree(hdata->dma_bounce_buffer); + hdata->dma_bounce_buffer = NULL; + hdata->dma_bounce_len = 0; } } } @@ -163,6 +164,7 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, static int __init a3000_detect(struct scsi_host_template *tpnt) { wd33c93_regs regs; + struct WD33C93_hostdata *hdata; if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(A3000_SCSI)) return 0; @@ -181,9 +183,10 @@ static int __init a3000_detect(struct scsi_host_template *tpnt) DMA(a3000_host)->DAWR = DAWR_A3000; regs.SASR = &(DMA(a3000_host)->SASR); regs.SCMD = &(DMA(a3000_host)->SCMD); - HDATA(a3000_host)->no_sync = 0xff; - HDATA(a3000_host)->fast = 0; - HDATA(a3000_host)->dma_mode = CTRL_DMA; + hdata = shost_priv(a3000_host); + hdata->no_sync = 0xff; + hdata->fast = 0; + hdata->dma_mode = CTRL_DMA; wd33c93_init(a3000_host, regs, dma_setup, dma_stop, WD33C93_FS_12_15); if (request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, "A3000 SCSI", a3000_intr)) |