Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k/scsi: a3000 - Do not use legacy Scsi_Host.base

Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

+41 -35
+41 -35
drivers/scsi/a3000.c
··· 17 17 #include "a3000.h" 18 18 19 19 20 + struct a3000_hostdata { 21 + struct WD33C93_hostdata wh; 22 + struct a3000_scsiregs *regs; 23 + }; 24 + 20 25 static irqreturn_t a3000_intr(int irq, void *data) 21 26 { 22 27 struct Scsi_Host *instance = data; 23 - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); 24 - unsigned int status = regs->ISTR; 28 + struct a3000_hostdata *hdata = shost_priv(instance); 29 + unsigned int status = hdata->regs->ISTR; 25 30 unsigned long flags; 26 31 27 32 if (!(status & ISTR_INT_P)) ··· 44 39 static int dma_setup(struct scsi_cmnd *cmd, int dir_in) 45 40 { 46 41 struct Scsi_Host *instance = cmd->device->host; 47 - struct WD33C93_hostdata *hdata = shost_priv(instance); 48 - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); 42 + struct a3000_hostdata *hdata = shost_priv(instance); 43 + struct WD33C93_hostdata *wh = &hdata->wh; 44 + struct a3000_scsiregs *regs = hdata->regs; 49 45 unsigned short cntr = CNTR_PDMD | CNTR_INTEN; 50 46 unsigned long addr = virt_to_bus(cmd->SCp.ptr); 51 47 ··· 57 51 * buffer 58 52 */ 59 53 if (addr & A3000_XFER_MASK) { 60 - hdata->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; 61 - hdata->dma_bounce_buffer = kmalloc(hdata->dma_bounce_len, 62 - GFP_KERNEL); 54 + wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff; 55 + wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len, 56 + GFP_KERNEL); 63 57 64 58 /* can't allocate memory; use PIO */ 65 - if (!hdata->dma_bounce_buffer) { 66 - hdata->dma_bounce_len = 0; 59 + if (!wh->dma_bounce_buffer) { 60 + wh->dma_bounce_len = 0; 67 61 return 1; 68 62 } 69 63 70 64 if (!dir_in) { 71 65 /* copy to bounce buffer for a write */ 72 - memcpy(hdata->dma_bounce_buffer, cmd->SCp.ptr, 66 + memcpy(wh->dma_bounce_buffer, cmd->SCp.ptr, 73 67 cmd->SCp.this_residual); 74 68 } 75 69 76 - addr = virt_to_bus(hdata->dma_bounce_buffer); 70 + addr = virt_to_bus(wh->dma_bounce_buffer); 77 71 } 78 72 79 73 /* setup dma direction */ ··· 81 75 cntr |= CNTR_DDIR; 82 76 83 77 /* remember direction */ 84 - hdata->dma_dir = dir_in; 78 + wh->dma_dir = dir_in; 85 79 86 80 regs->CNTR = cntr; 87 81 ··· 108 102 static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, 109 103 int status) 110 104 { 111 - struct WD33C93_hostdata *hdata = shost_priv(instance); 112 - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); 105 + struct a3000_hostdata *hdata = shost_priv(instance); 106 + struct WD33C93_hostdata *wh = &hdata->wh; 107 + struct a3000_scsiregs *regs = hdata->regs; 113 108 114 109 /* disable SCSI interrupts */ 115 110 unsigned short cntr = CNTR_PDMD; 116 111 117 - if (!hdata->dma_dir) 112 + if (!wh->dma_dir) 118 113 cntr |= CNTR_DDIR; 119 114 120 115 regs->CNTR = cntr; 121 116 mb(); /* make sure CNTR is updated before next IO */ 122 117 123 118 /* flush if we were reading */ 124 - if (hdata->dma_dir) { 119 + if (wh->dma_dir) { 125 120 regs->FLUSH = 1; 126 121 mb(); /* don't allow prefetch */ 127 122 while (!(regs->ISTR & ISTR_FE_FLG)) ··· 145 138 mb(); /* make sure CNTR is updated before next IO */ 146 139 147 140 /* copy from a bounce buffer, if necessary */ 148 - if (status && hdata->dma_bounce_buffer) { 141 + if (status && wh->dma_bounce_buffer) { 149 142 if (SCpnt) { 150 - if (hdata->dma_dir && SCpnt) 151 - memcpy(SCpnt->SCp.ptr, 152 - hdata->dma_bounce_buffer, 143 + if (wh->dma_dir && SCpnt) 144 + memcpy(SCpnt->SCp.ptr, wh->dma_bounce_buffer, 153 145 SCpnt->SCp.this_residual); 154 - kfree(hdata->dma_bounce_buffer); 155 - hdata->dma_bounce_buffer = NULL; 156 - hdata->dma_bounce_len = 0; 146 + kfree(wh->dma_bounce_buffer); 147 + wh->dma_bounce_buffer = NULL; 148 + wh->dma_bounce_len = 0; 157 149 } else { 158 - kfree(hdata->dma_bounce_buffer); 159 - hdata->dma_bounce_buffer = NULL; 160 - hdata->dma_bounce_len = 0; 150 + kfree(wh->dma_bounce_buffer); 151 + wh->dma_bounce_buffer = NULL; 152 + wh->dma_bounce_len = 0; 161 153 } 162 154 } 163 155 } ··· 200 194 int error; 201 195 struct a3000_scsiregs *regs; 202 196 wd33c93_regs wdregs; 203 - struct WD33C93_hostdata *hdata; 197 + struct a3000_hostdata *hdata; 204 198 205 199 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 206 200 if (!res) ··· 210 204 return -EBUSY; 211 205 212 206 instance = scsi_host_alloc(&amiga_a3000_scsi_template, 213 - sizeof(struct WD33C93_hostdata)); 207 + sizeof(struct a3000_hostdata)); 214 208 if (!instance) { 215 209 error = -ENOMEM; 216 210 goto fail_alloc; 217 211 } 218 212 219 - instance->base = ZTWO_VADDR(res->start); 220 213 instance->irq = IRQ_AMIGA_PORTS; 221 214 222 - regs = (struct a3000_scsiregs *)(instance->base); 215 + regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start); 223 216 regs->DAWR = DAWR_A3000; 224 217 225 218 wdregs.SASR = &regs->SASR; 226 219 wdregs.SCMD = &regs->SCMD; 227 220 228 221 hdata = shost_priv(instance); 229 - hdata->no_sync = 0xff; 230 - hdata->fast = 0; 231 - hdata->dma_mode = CTRL_DMA; 222 + hdata->wh.no_sync = 0xff; 223 + hdata->wh.fast = 0; 224 + hdata->wh.dma_mode = CTRL_DMA; 225 + hdata->regs = regs; 232 226 233 227 wd33c93_init(instance, wdregs, dma_setup, dma_stop, WD33C93_FS_12_15); 234 228 error = request_irq(IRQ_AMIGA_PORTS, a3000_intr, IRQF_SHARED, ··· 259 253 static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev) 260 254 { 261 255 struct Scsi_Host *instance = platform_get_drvdata(pdev); 262 - struct a3000_scsiregs *regs = (struct a3000_scsiregs *)(instance->base); 256 + struct a3000_hostdata *hdata = shost_priv(instance); 263 257 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 258 265 - regs->CNTR = 0; 259 + hdata->regs->CNTR = 0; 266 260 scsi_remove_host(instance); 267 261 free_irq(IRQ_AMIGA_PORTS, instance); 268 262 scsi_host_put(instance);