Commit bb17b787 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by James Bottomley

[SCSI] gvp11: Reindentation

Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 09bc85b0
...@@ -19,12 +19,13 @@ ...@@ -19,12 +19,13 @@
#include "wd33c93.h" #include "wd33c93.h"
#include "gvp11.h" #include "gvp11.h"
#include<linux/stat.h> #include <linux/stat.h>
#define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base)) #define DMA(ptr) ((gvp11_scsiregs *)((ptr)->base))
#define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata)) #define HDATA(ptr) ((struct WD33C93_hostdata *)((ptr)->hostdata))
static irqreturn_t gvp11_intr (int irq, void *_instance) static irqreturn_t gvp11_intr(int irq, void *_instance)
{ {
unsigned long flags; unsigned long flags;
unsigned int status; unsigned int status;
...@@ -42,7 +43,7 @@ static irqreturn_t gvp11_intr (int irq, void *_instance) ...@@ -42,7 +43,7 @@ static irqreturn_t gvp11_intr (int irq, void *_instance)
static int gvp11_xfer_mask = 0; static int gvp11_xfer_mask = 0;
void gvp11_setup (char *str, int *ints) void gvp11_setup(char *str, int *ints)
{ {
gvp11_xfer_mask = ints[1]; gvp11_xfer_mask = ints[1];
} }
...@@ -55,15 +56,16 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -55,15 +56,16 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
static int scsi_alloc_out_of_range = 0; static int scsi_alloc_out_of_range = 0;
/* use bounce buffer if the physical address is bad */ /* use bounce buffer if the physical address is bad */
if (addr & HDATA(cmd->device->host)->dma_xfer_mask) if (addr & HDATA(cmd->device->host)->dma_xfer_mask) {
{ HDATA(cmd->device->host)->dma_bounce_len =
HDATA(cmd->device->host)->dma_bounce_len = (cmd->SCp.this_residual + 511) (cmd->SCp.this_residual + 511) & ~0x1ff;
& ~0x1ff;
if( !scsi_alloc_out_of_range ) { if (!scsi_alloc_out_of_range) {
HDATA(cmd->device->host)->dma_bounce_buffer = HDATA(cmd->device->host)->dma_bounce_buffer =
kmalloc (HDATA(cmd->device->host)->dma_bounce_len, GFP_KERNEL); kmalloc(HDATA(cmd->device->host)->dma_bounce_len,
HDATA(cmd->device->host)->dma_buffer_pool = BUF_SCSI_ALLOCED; GFP_KERNEL);
HDATA(cmd->device->host)->dma_buffer_pool =
BUF_SCSI_ALLOCED;
} }
if (scsi_alloc_out_of_range || if (scsi_alloc_out_of_range ||
...@@ -72,13 +74,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -72,13 +74,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len,
"GVP II SCSI Bounce Buffer"); "GVP II SCSI Bounce Buffer");
if(!HDATA(cmd->device->host)->dma_bounce_buffer) if (!HDATA(cmd->device->host)->dma_bounce_buffer) {
{
HDATA(cmd->device->host)->dma_bounce_len = 0; HDATA(cmd->device->host)->dma_bounce_len = 0;
return 1; return 1;
} }
HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; HDATA(cmd->device->host)->dma_buffer_pool =
BUF_CHIP_ALLOCED;
} }
/* check if the address of the bounce buffer is OK */ /* check if the address of the bounce buffer is OK */
...@@ -86,30 +88,31 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -86,30 +88,31 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
if (addr & HDATA(cmd->device->host)->dma_xfer_mask) { if (addr & HDATA(cmd->device->host)->dma_xfer_mask) {
/* fall back to Chip RAM if address out of range */ /* fall back to Chip RAM if address out of range */
if( HDATA(cmd->device->host)->dma_buffer_pool == BUF_SCSI_ALLOCED) { if (HDATA(cmd->device->host)->dma_buffer_pool ==
kfree (HDATA(cmd->device->host)->dma_bounce_buffer); BUF_SCSI_ALLOCED) {
kfree(HDATA(cmd->device->host)->dma_bounce_buffer);
scsi_alloc_out_of_range = 1; scsi_alloc_out_of_range = 1;
} else { } else {
amiga_chip_free (HDATA(cmd->device->host)->dma_bounce_buffer); amiga_chip_free(HDATA(cmd->device->host)->dma_bounce_buffer);
} }
HDATA(cmd->device->host)->dma_bounce_buffer = HDATA(cmd->device->host)->dma_bounce_buffer =
amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len, amiga_chip_alloc(HDATA(cmd->device->host)->dma_bounce_len,
"GVP II SCSI Bounce Buffer"); "GVP II SCSI Bounce Buffer");
if(!HDATA(cmd->device->host)->dma_bounce_buffer) if (!HDATA(cmd->device->host)->dma_bounce_buffer) {
{
HDATA(cmd->device->host)->dma_bounce_len = 0; HDATA(cmd->device->host)->dma_bounce_len = 0;
return 1; return 1;
} }
addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer); addr = virt_to_bus(HDATA(cmd->device->host)->dma_bounce_buffer);
HDATA(cmd->device->host)->dma_buffer_pool = BUF_CHIP_ALLOCED; HDATA(cmd->device->host)->dma_buffer_pool =
BUF_CHIP_ALLOCED;
} }
if (!dir_in) { if (!dir_in) {
/* copy to bounce buffer for a write */ /* copy to bounce buffer for a write */
memcpy (HDATA(cmd->device->host)->dma_bounce_buffer, memcpy(HDATA(cmd->device->host)->dma_bounce_buffer,
cmd->SCp.ptr, cmd->SCp.this_residual); cmd->SCp.ptr, cmd->SCp.this_residual);
} }
} }
...@@ -124,12 +127,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in) ...@@ -124,12 +127,13 @@ static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
/* setup DMA *physical* address */ /* setup DMA *physical* address */
DMA(cmd->device->host)->ACR = addr; DMA(cmd->device->host)->ACR = addr;
if (dir_in) if (dir_in) {
/* invalidate any cache */ /* invalidate any cache */
cache_clear (addr, cmd->SCp.this_residual); cache_clear(addr, cmd->SCp.this_residual);
else } else {
/* push any dirty cache */ /* push any dirty cache */
cache_push (addr, cmd->SCp.this_residual); cache_push(addr, cmd->SCp.this_residual);
}
if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0)) if ((bank_mask = (~HDATA(cmd->device->host)->dma_xfer_mask >> 18) & 0x01c0))
DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18); DMA(cmd->device->host)->BANK = bank_mask & (addr >> 18);
...@@ -152,12 +156,12 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt, ...@@ -152,12 +156,12 @@ static void dma_stop(struct Scsi_Host *instance, struct scsi_cmnd *SCpnt,
/* copy from a bounce buffer, if necessary */ /* copy from a bounce buffer, if necessary */
if (status && HDATA(instance)->dma_bounce_buffer) { if (status && HDATA(instance)->dma_bounce_buffer) {
if (HDATA(instance)->dma_dir && SCpnt) if (HDATA(instance)->dma_dir && SCpnt)
memcpy (SCpnt->SCp.ptr, memcpy(SCpnt->SCp.ptr,
HDATA(instance)->dma_bounce_buffer, HDATA(instance)->dma_bounce_buffer,
SCpnt->SCp.this_residual); SCpnt->SCp.this_residual);
if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED) if (HDATA(instance)->dma_buffer_pool == BUF_SCSI_ALLOCED)
kfree (HDATA(instance)->dma_bounce_buffer); kfree(HDATA(instance)->dma_bounce_buffer);
else else
amiga_chip_free(HDATA(instance)->dma_bounce_buffer); amiga_chip_free(HDATA(instance)->dma_bounce_buffer);
...@@ -216,7 +220,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -216,7 +220,7 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
* code as the SCSI controllers. Therefore if the board-size * code as the SCSI controllers. Therefore if the board-size
* is not 64KB we asume it is a ram board and bail out. * is not 64KB we asume it is a ram board and bail out.
*/ */
if (z->resource.end-z->resource.start != 0xffff) if (z->resource.end - z->resource.start != 0xffff)
continue; continue;
address = z->resource.start; address = z->resource.start;
...@@ -257,8 +261,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -257,8 +261,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
if (*scmd_3393 != q) /* and so should the image at 0x1f */ if (*scmd_3393 != q) /* and so should the image at 0x1f */
goto release; goto release;
/*
/* Ok, we probably have a wd33c93, but let's check a few other places * Ok, we probably have a wd33c93, but let's check a few other places
* for good measure. Make sure that this works for both 'A and 'B * for good measure. Make sure that this works for both 'A and 'B
* chip versions. * chip versions.
*/ */
...@@ -295,8 +299,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -295,8 +299,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
goto release; goto release;
#endif #endif
instance = scsi_register (tpnt, sizeof (struct WD33C93_hostdata)); instance = scsi_register(tpnt, sizeof(struct WD33C93_hostdata));
if(instance == NULL) if (instance == NULL)
goto release; goto release;
instance->base = ZTWO_VADDR(address); instance->base = ZTWO_VADDR(address);
instance->irq = IRQ_AMIGA_PORTS; instance->irq = IRQ_AMIGA_PORTS;
...@@ -307,11 +311,11 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -307,11 +311,11 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
else else
HDATA(instance)->dma_xfer_mask = default_dma_xfer_mask; HDATA(instance)->dma_xfer_mask = default_dma_xfer_mask;
DMA(instance)->secret2 = 1; DMA(instance)->secret2 = 1;
DMA(instance)->secret1 = 0; DMA(instance)->secret1 = 0;
DMA(instance)->secret3 = 15; DMA(instance)->secret3 = 15;
while (DMA(instance)->CNTR & GVP11_DMAC_BUSY) ; while (DMA(instance)->CNTR & GVP11_DMAC_BUSY)
;
DMA(instance)->CNTR = 0; DMA(instance)->CNTR = 0;
DMA(instance)->BANK = 0; DMA(instance)->BANK = 0;
...@@ -330,8 +334,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt) ...@@ -330,8 +334,8 @@ int __init gvp11_detect(struct scsi_host_template *tpnt)
(epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10 (epc & GVP_SCSICLKMASK) ? WD33C93_FS_8_10
: WD33C93_FS_12_15); : WD33C93_FS_12_15);
if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED, "GVP11 SCSI", if (request_irq(IRQ_AMIGA_PORTS, gvp11_intr, IRQF_SHARED,
instance)) "GVP11 SCSI", instance))
goto unregister; goto unregister;
DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE; DMA(instance)->CNTR = GVP11_DMAC_INT_ENABLE;
num_gvp11++; num_gvp11++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment