diff options
author | Matthew Wilcox <matthew@wil.cx> | 2007-10-05 15:55:09 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-23 15:12:36 -0400 |
commit | 4d85b471593d03e141f9160a58574b9204363267 (patch) | |
tree | 322457b73d4b5872ddb5c0651d8820933f0a68c4 /drivers/scsi/sym53c8xx_2/sym_glue.c | |
parent | a44131b35ec1a46ed75014d818cb9d5706117b49 (diff) |
[SCSI] sym53c8xx: Simplify DAC DMA handling
By introducing the use_dac(), set_dac() and DMA_DAC_MASK macros, we can
eliminate a lot of ifdefs from the code. We now rely on the compiler to
optimise away a few things that we'd formerly relied on the preprocessor
to do. This makes sym_setup_bus_dma_mask() small enough to inline into
its only caller.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2/sym_glue.c')
-rw-r--r-- | drivers/scsi/sym53c8xx_2/sym_glue.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index c1d9f6989664..55012970912b 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c | |||
@@ -1265,31 +1265,6 @@ static void sym_free_resources(struct sym_hcb *np, struct pci_dev *pdev) | |||
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | /* | 1267 | /* |
1268 | * Ask/tell the system about DMA addressing. | ||
1269 | */ | ||
1270 | static int sym_setup_bus_dma_mask(struct sym_hcb *np) | ||
1271 | { | ||
1272 | #if SYM_CONF_DMA_ADDRESSING_MODE > 0 | ||
1273 | #if SYM_CONF_DMA_ADDRESSING_MODE == 1 | ||
1274 | #define DMA_DAC_MASK DMA_40BIT_MASK | ||
1275 | #elif SYM_CONF_DMA_ADDRESSING_MODE == 2 | ||
1276 | #define DMA_DAC_MASK DMA_64BIT_MASK | ||
1277 | #endif | ||
1278 | if ((np->features & FE_DAC) && | ||
1279 | !pci_set_dma_mask(np->s.device, DMA_DAC_MASK)) { | ||
1280 | np->use_dac = 1; | ||
1281 | return 0; | ||
1282 | } | ||
1283 | #endif | ||
1284 | |||
1285 | if (!pci_set_dma_mask(np->s.device, DMA_32BIT_MASK)) | ||
1286 | return 0; | ||
1287 | |||
1288 | printf_warning("%s: No suitable DMA available\n", sym_name(np)); | ||
1289 | return -1; | ||
1290 | } | ||
1291 | |||
1292 | /* | ||
1293 | * Host attach and initialisations. | 1268 | * Host attach and initialisations. |
1294 | * | 1269 | * |
1295 | * Allocate host data and ncb structure. | 1270 | * Allocate host data and ncb structure. |
@@ -1362,8 +1337,13 @@ static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt, | |||
1362 | strlcpy(np->s.chip_name, dev->chip.name, sizeof(np->s.chip_name)); | 1337 | strlcpy(np->s.chip_name, dev->chip.name, sizeof(np->s.chip_name)); |
1363 | sprintf(np->s.inst_name, "sym%d", np->s.unit); | 1338 | sprintf(np->s.inst_name, "sym%d", np->s.unit); |
1364 | 1339 | ||
1365 | if (sym_setup_bus_dma_mask(np)) | 1340 | if ((SYM_CONF_DMA_ADDRESSING_MODE > 0) && (np->features & FE_DAC) && |
1341 | !pci_set_dma_mask(np->s.device, DMA_DAC_MASK)) { | ||
1342 | set_dac(np); | ||
1343 | } else if (pci_set_dma_mask(np->s.device, DMA_32BIT_MASK)) { | ||
1344 | printf_warning("%s: No suitable DMA available\n", sym_name(np)); | ||
1366 | goto attach_failed; | 1345 | goto attach_failed; |
1346 | } | ||
1367 | 1347 | ||
1368 | /* | 1348 | /* |
1369 | * Try to map the controller chip to | 1349 | * Try to map the controller chip to |