* [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants
@ 2005-03-06 22:27 domen
2005-03-07 10:14 ` Jes Sorensen
0 siblings, 1 reply; 5+ messages in thread
From: domen @ 2005-03-06 22:27 UTC (permalink / raw)
To: James.Bottomley; +Cc: linux-scsi, domen, tklauser
Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h
when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
See http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details
[Merged multiple patches, I can send split ones if desired -domen]
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
kj-domen/drivers/scsi/BusLogic.c | 6 +++---
kj-domen/drivers/scsi/a100u2w.c | 2 +-
kj-domen/drivers/scsi/aacraid/aachba.c | 8 ++++----
kj-domen/drivers/scsi/aacraid/linit.c | 6 +++---
kj-domen/drivers/scsi/aic7xxx/aic79xx_osm.c | 2 +-
kj-domen/drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 +-
kj-domen/drivers/scsi/atp870u.c | 2 +-
kj-domen/drivers/scsi/dpt_i2o.c | 4 ++--
kj-domen/drivers/scsi/eata.c | 2 +-
kj-domen/drivers/scsi/gdth.c | 6 +++---
kj-domen/drivers/scsi/initio.c | 2 +-
kj-domen/drivers/scsi/ips.c | 4 ++--
kj-domen/drivers/scsi/megaraid.c | 6 +++---
kj-domen/drivers/scsi/megaraid/megaraid_mbox.c | 4 ++--
kj-domen/drivers/scsi/nsp32.c | 2 +-
kj-domen/drivers/scsi/qla1280.c | 4 ++--
kj-domen/drivers/scsi/qlogicfc.c | 4 ++--
17 files changed, 33 insertions(+), 33 deletions(-)
diff -puN drivers/scsi/BusLogic.c~dma_mask-drivers_scsi drivers/scsi/BusLogic.c
--- kj/drivers/scsi/BusLogic.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/BusLogic.c 2005-03-05 16:13:22.000000000 +0100
@@ -676,7 +676,7 @@ static int __init BusLogic_InitializeMul
if (pci_enable_device(PCI_Device))
continue;
- if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff))
+ if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK))
continue;
Bus = PCI_Device->bus->number;
@@ -831,7 +831,7 @@ static int __init BusLogic_InitializeMul
if (pci_enable_device(PCI_Device))
continue;
- if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff))
+ if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK))
continue;
Bus = PCI_Device->bus->number;
@@ -885,7 +885,7 @@ static int __init BusLogic_InitializeFla
if (pci_enable_device(PCI_Device))
continue;
- if (pci_set_dma_mask(PCI_Device, (u64) 0xffffffff))
+ if (pci_set_dma_mask(PCI_Device, DMA_32BIT_MASK))
continue;
Bus = PCI_Device->bus->number;
diff -puN drivers/scsi/a100u2w.c~dma_mask-drivers_scsi drivers/scsi/a100u2w.c
--- kj/drivers/scsi/a100u2w.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/a100u2w.c 2005-03-05 16:13:22.000000000 +0100
@@ -1052,7 +1052,7 @@ static int __devinit inia100_probe_one(s
if (pci_enable_device(pdev))
goto out;
- if (pci_set_dma_mask(pdev, 0xffffffffULL)) {
+ if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "Unable to set 32bit DMA "
"on inia100 adapter, ignoring.\n");
goto out_disable_device;
diff -puN drivers/scsi/aacraid/aachba.c~dma_mask-drivers_scsi drivers/scsi/aacraid/aachba.c
--- kj/drivers/scsi/aacraid/aachba.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/aacraid/aachba.c 2005-03-05 16:13:22.000000000 +0100
@@ -687,12 +687,12 @@ int aac_get_adapter_info(struct aac_dev*
dev->dac_support = (dacmode!=0);
}
if(dev->dac_support != 0) {
- if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL) &&
- !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFFFFFFFFFULL)) {
+ if (!pci_set_dma_mask(dev->pdev, DMA_64BIT_MASK) &&
+ !pci_set_consistent_dma_mask(dev->pdev, DMA_64BIT_MASK)) {
printk(KERN_INFO"%s%d: 64 Bit DAC enabled\n",
dev->name, dev->id);
- } else if (!pci_set_dma_mask(dev->pdev, 0xFFFFFFFFULL) &&
- !pci_set_consistent_dma_mask(dev->pdev, 0xFFFFFFFFULL)) {
+ } else if (!pci_set_dma_mask(dev->pdev, DMA_32BIT_MASK) &&
+ !pci_set_consistent_dma_mask(dev->pdev, DMA_32BIT_MASK)) {
printk(KERN_INFO"%s%d: DMA mask set failed, 64 Bit DAC disabled\n",
dev->name, dev->id);
dev->dac_support = 0;
diff -puN drivers/scsi/aacraid/linit.c~dma_mask-drivers_scsi drivers/scsi/aacraid/linit.c
--- kj/drivers/scsi/aacraid/linit.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/aacraid/linit.c 2005-03-05 16:13:22.000000000 +0100
@@ -545,8 +545,8 @@ static int __devinit aac_probe_one(struc
if (pci_enable_device(pdev))
goto out;
- if (pci_set_dma_mask(pdev, 0xFFFFFFFFULL) ||
- pci_set_consistent_dma_mask(pdev, 0xFFFFFFFFULL))
+ if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) ||
+ pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))
goto out;
/*
* If the quirk31 bit is set, the adapter needs adapter
@@ -589,7 +589,7 @@ static int __devinit aac_probe_one(struc
* address space.
*/
if (aac_drivers[index].quirks & AAC_QUIRK_31BIT)
- if (pci_set_dma_mask(pdev, 0xFFFFFFFFULL))
+ if (pci_set_dma_mask(pdev, DMA_32BIT_MASK))
goto out_free_fibs;
aac_get_adapter_info(aac);
diff -puN drivers/scsi/aic7xxx/aic79xx_osm.c~dma_mask-drivers_scsi drivers/scsi/aic7xxx/aic79xx_osm.c
--- kj/drivers/scsi/aic7xxx/aic79xx_osm.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/aic7xxx/aic79xx_osm.c 2005-03-05 16:13:22.000000000 +0100
@@ -1706,7 +1706,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd,
* our dma mask when doing allocations.
*/
if (ahd->dev_softc != NULL)
- if (pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) {
+ if (pci_set_dma_mask(ahd->dev_softc, DMA_32BIT_MASK)) {
printk(KERN_WARNING "aic79xx: No suitable DMA available.\n");
kfree(map);
return (ENODEV);
diff -puN drivers/scsi/aic7xxx/aic7xxx_osm.c~dma_mask-drivers_scsi drivers/scsi/aic7xxx/aic7xxx_osm.c
--- kj/drivers/scsi/aic7xxx/aic7xxx_osm.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/aic7xxx/aic7xxx_osm.c 2005-03-05 16:13:22.000000000 +0100
@@ -1361,7 +1361,7 @@ ahc_dmamem_alloc(struct ahc_softc *ahc,
* our dma mask when doing allocations.
*/
if (ahc->dev_softc != NULL)
- if (pci_set_dma_mask(ahc->dev_softc, 0xFFFFFFFF)) {
+ if (pci_set_dma_mask(ahc->dev_softc, DMA_32BIT_MASK)) {
printk(KERN_WARNING "aic7xxx: No suitable DMA available.\n");
kfree(map);
return (ENODEV);
diff -puN drivers/scsi/atp870u.c~dma_mask-drivers_scsi drivers/scsi/atp870u.c
--- kj/drivers/scsi/atp870u.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/atp870u.c 2005-03-05 16:13:22.000000000 +0100
@@ -2287,7 +2287,7 @@ static int atp870u_probe(struct pci_dev
if (pci_enable_device(dev))
return -EIO;
- if (pci_set_dma_mask(dev, 0xFFFFFFFFUL)) {
+ if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
printk(KERN_ERR "atp870u: 32bit DMA mask required but not available.\n");
return -EIO;
}
diff -puN drivers/scsi/dpt_i2o.c~dma_mask-drivers_scsi drivers/scsi/dpt_i2o.c
--- kj/drivers/scsi/dpt_i2o.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/dpt_i2o.c 2005-03-05 16:13:22.000000000 +0100
@@ -881,8 +881,8 @@ static int adpt_install_hba(struct scsi_
return -EINVAL;
}
pci_set_master(pDev);
- if (pci_set_dma_mask(pDev, 0xffffffffffffffffULL) &&
- pci_set_dma_mask(pDev, 0xffffffffULL))
+ if (pci_set_dma_mask(pDev, DMA_64BIT_MASK) &&
+ pci_set_dma_mask(pDev, DMA_32BIT_MASK))
return -EINVAL;
base_addr0_phys = pci_resource_start(pDev,0);
diff -puN drivers/scsi/eata.c~dma_mask-drivers_scsi drivers/scsi/eata.c
--- kj/drivers/scsi/eata.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/eata.c 2005-03-05 16:13:22.000000000 +0100
@@ -1430,7 +1430,7 @@ static int port_detect(unsigned long por
if (ha->pdev) {
pci_set_master(ha->pdev);
- if (pci_set_dma_mask(ha->pdev, 0xffffffff))
+ if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK))
printk("%s: warning, pci_set_dma_mask failed.\n",
ha->board_name);
}
diff -puN drivers/scsi/gdth.c~dma_mask-drivers_scsi drivers/scsi/gdth.c
--- kj/drivers/scsi/gdth.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/gdth.c 2005-03-05 16:13:22.000000000 +0100
@@ -4529,15 +4529,15 @@ int __init gdth_detect(Scsi_Host_Templat
if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT)||
/* 64-bit DMA only supported from FW >= x.43 */
(!ha->dma64_support)) {
- if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) {
+ if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "GDT-PCI %d: Unable to set 32-bit DMA\n", hanum);
err = TRUE;
}
} else {
shp->max_cmd_len = 16;
- if (!pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffffffffffffULL)) {
+ if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) {
printk("GDT-PCI %d: 64-bit DMA enabled\n", hanum);
- } else if (pci_set_dma_mask(pcistr[ctr].pdev, 0xffffffff)) {
+ } else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "GDT-PCI %d: Unable to set 64/32-bit DMA\n", hanum);
err = TRUE;
}
diff -puN drivers/scsi/initio.c~dma_mask-drivers_scsi drivers/scsi/initio.c
--- kj/drivers/scsi/initio.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/initio.c 2005-03-05 16:13:22.000000000 +0100
@@ -2793,7 +2793,7 @@ static int tul_NewReturnNumberOfAdapters
if (((dRegValue & 0xFF00) >> 8) == 0xFF)
dRegValue = 0;
wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8));
- if (pci_set_dma_mask(pDev, 0xffffffff)) {
+ if (pci_set_dma_mask(pDev, DMA_32BIT_MASK)) {
printk(KERN_WARNING
"i91u: Could not set 32 bit DMA mask\n");
continue;
diff -puN drivers/scsi/ips.c~dma_mask-drivers_scsi drivers/scsi/ips.c
--- kj/drivers/scsi/ips.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/ips.c 2005-03-05 16:13:22.000000000 +0100
@@ -7290,10 +7290,10 @@ ips_init_phase1(struct pci_dev *pci_dev,
* are guaranteed to be < 4G.
*/
if (IPS_ENABLE_DMA64 && IPS_HAS_ENH_SGLIST(ha) &&
- !pci_set_dma_mask(ha->pcidev, 0xffffffffffffffffULL)) {
+ !pci_set_dma_mask(ha->pcidev, DMA_64BIT_MASK)) {
(ha)->flags |= IPS_HA_ENH_SG;
} else {
- if (pci_set_dma_mask(ha->pcidev, 0xffffffffULL) != 0) {
+ if (pci_set_dma_mask(ha->pcidev, DMA_32BIT_MASK) != 0) {
printk(KERN_WARNING "Unable to set DMA Mask\n");
return ips_abort_init(ha, index);
}
diff -puN drivers/scsi/megaraid.c~dma_mask-drivers_scsi drivers/scsi/megaraid.c
--- kj/drivers/scsi/megaraid.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/megaraid.c 2005-03-05 16:13:22.000000000 +0100
@@ -2060,7 +2060,7 @@ make_local_pdev(adapter_t *adapter, stru
memcpy(*pdev, adapter->dev, sizeof(struct pci_dev));
- if( pci_set_dma_mask(*pdev, 0xffffffff) != 0 ) {
+ if( pci_set_dma_mask(*pdev, DMA_32BIT_MASK) != 0 ) {
kfree(*pdev);
return -1;
}
@@ -4854,10 +4854,10 @@ megaraid_probe_one(struct pci_dev *pdev,
/* Set the Mode of addressing to 64 bit if we can */
if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) {
- pci_set_dma_mask(pdev, 0xffffffffffffffffULL);
+ pci_set_dma_mask(pdev, DMA_64BIT_MASK);
adapter->has_64bit_addr = 1;
} else {
- pci_set_dma_mask(pdev, 0xffffffff);
+ pci_set_dma_mask(pdev, DMA_32BIT_MASK);
adapter->has_64bit_addr = 0;
}
diff -puN drivers/scsi/megaraid/megaraid_mbox.c~dma_mask-drivers_scsi drivers/scsi/megaraid/megaraid_mbox.c
--- kj/drivers/scsi/megaraid/megaraid_mbox.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/megaraid/megaraid_mbox.c 2005-03-05 16:13:22.000000000 +0100
@@ -619,7 +619,7 @@ megaraid_probe_one(struct pci_dev *pdev,
// Setup the default DMA mask. This would be changed later on
// depending on hardware capabilities
- if (pci_set_dma_mask(adapter->pdev, 0xFFFFFFFF) != 0) {
+ if (pci_set_dma_mask(adapter->pdev, DMA_32BIT_MASK) != 0) {
con_log(CL_ANN, (KERN_WARNING
"megaraid: pci_set_dma_mask failed:%d\n", __LINE__));
@@ -1031,7 +1031,7 @@ megaraid_init_mbox(adapter_t *adapter)
// Set the DMA mask to 64-bit. All supported controllers as capable of
// DMA in this range
- if (pci_set_dma_mask(adapter->pdev, 0xFFFFFFFFFFFFFFFFULL) != 0) {
+ if (pci_set_dma_mask(adapter->pdev, DMA_64BIT_MASK) != 0) {
con_log(CL_ANN, (KERN_WARNING
"megaraid: could not set DMA mask for 64-bit.\n"));
diff -puN drivers/scsi/nsp32.c~dma_mask-drivers_scsi drivers/scsi/nsp32.c
--- kj/drivers/scsi/nsp32.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/nsp32.c 2005-03-05 16:13:22.000000000 +0100
@@ -2779,7 +2779,7 @@ static int nsp32_detect(Scsi_Host_Templa
/*
* setup DMA
*/
- if (pci_set_dma_mask(PCIDEV, 0xffffffffUL) != 0) {
+ if (pci_set_dma_mask(PCIDEV, DMA_32BIT_MASK) != 0) {
nsp32_msg (KERN_ERR, "failed to set PCI DMA mask");
goto scsi_unregister;
}
diff -puN drivers/scsi/qla1280.c~dma_mask-drivers_scsi drivers/scsi/qla1280.c
--- kj/drivers/scsi/qla1280.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/qla1280.c 2005-03-05 16:13:22.000000000 +0100
@@ -4741,7 +4741,7 @@ qla1280_probe_one(struct pci_dev *pdev,
#ifdef QLA_64BIT_PTR
if (pci_set_dma_mask(ha->pdev, (dma_addr_t) ~ 0ULL)) {
- if (pci_set_dma_mask(ha->pdev, 0xffffffff)) {
+ if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "scsi(%li): Unable to set a "
" suitable DMA mask - aboring\n", ha->host_no);
error = -ENODEV;
@@ -4751,7 +4751,7 @@ qla1280_probe_one(struct pci_dev *pdev,
dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n",
ha->host_no);
#else
- if (pci_set_dma_mask(ha->pdev, 0xffffffff)) {
+ if (pci_set_dma_mask(ha->pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "scsi(%li): Unable to set a "
" suitable DMA mask - aboring\n", ha->host_no);
error = -ENODEV;
diff -puN drivers/scsi/qlogicfc.c~dma_mask-drivers_scsi drivers/scsi/qlogicfc.c
--- kj/drivers/scsi/qlogicfc.c~dma_mask-drivers_scsi 2005-03-05 16:13:22.000000000 +0100
+++ kj-domen/drivers/scsi/qlogicfc.c 2005-03-05 16:13:22.000000000 +0100
@@ -719,8 +719,8 @@ int isp2x00_detect(Scsi_Host_Template *
continue;
/* Try to configure DMA attributes. */
- if (pci_set_dma_mask(pdev, 0xffffffffffffffffULL) &&
- pci_set_dma_mask(pdev, 0xffffffffULL))
+ if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
+ pci_set_dma_mask(pdev, DMA_32BIT_MASK))
continue;
host = scsi_register(tmpt, sizeof(struct isp2x00_hostdata));
_
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants
2005-03-06 22:27 [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants domen
@ 2005-03-07 10:14 ` Jes Sorensen
2005-03-07 12:37 ` Matthew Wilcox
0 siblings, 1 reply; 5+ messages in thread
From: Jes Sorensen @ 2005-03-07 10:14 UTC (permalink / raw)
To: domen; +Cc: James.Bottomley, linux-scsi, tklauser
>>>>> "domen" == domen <domen@coderock.org> writes:
domen> Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when
domen> calling pci_set_dma_mask() or pci_set_consistent_dma_mask() See
domen> http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for
domen> details
Why?
It's ugly and really serves no purpose except for obfuscation.
Rejected for qla1280
Jes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants
2005-03-07 10:14 ` Jes Sorensen
@ 2005-03-07 12:37 ` Matthew Wilcox
2005-03-07 14:27 ` Jes Sorensen
0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2005-03-07 12:37 UTC (permalink / raw)
To: Jes Sorensen; +Cc: domen, James.Bottomley, linux-scsi, tklauser
On Mon, Mar 07, 2005 at 05:14:16AM -0500, Jes Sorensen wrote:
> >>>>> "domen" == domen <domen@coderock.org> writes:
>
> domen> Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when
> domen> calling pci_set_dma_mask() or pci_set_consistent_dma_mask() See
> domen> http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for
> domen> details
>
> Why?
>
> It's ugly and really serves no purpose except for obfuscation.
We've had drivers with typos. Missing one f suddenly causes all your
memory to come from ZONE_DMA. Having an extra f causes your driver to
work ... most of the time on machines with >4GB ram. Sure, your driver
doesn't, but when looking over a lot of drivers, it's easier if everyone's
using the same macros.
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants
2005-03-07 12:37 ` Matthew Wilcox
@ 2005-03-07 14:27 ` Jes Sorensen
2005-03-07 14:36 ` Matthew Wilcox
0 siblings, 1 reply; 5+ messages in thread
From: Jes Sorensen @ 2005-03-07 14:27 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: domen, James.Bottomley, linux-scsi, tklauser
>>>>> "Matthew" == Matthew Wilcox <matthew@wil.cx> writes:
Matthew> On Mon, Mar 07, 2005 at 05:14:16AM -0500, Jes Sorensen wrote:
>> >>>>> "domen" == domen <domen@coderock.org> writes:
>>
domen> Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when
domen> calling pci_set_dma_mask() or pci_set_consistent_dma_mask() See
domen> http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for
domen> details
>> It's ugly and really serves no purpose except for obfuscation.
Matthew> We've had drivers with typos. Missing one f suddenly causes
Matthew> all your memory to come from ZONE_DMA. Having an extra f
Matthew> causes your driver to work ... most of the time on machines
Matthew> with >4GB ram. Sure, your driver doesn't, but when looking
Matthew> over a lot of drivers, it's easier if everyone's using the
Matthew> same macros.
If these were the only two masks ever used I'd agree with you. However
there's several other in use and more will probably be added, so we're
going to end up with drivers sometimes using constants and other times
hex values causing an even bigger mess ;-(
Cheers,
Jes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants
2005-03-07 14:27 ` Jes Sorensen
@ 2005-03-07 14:36 ` Matthew Wilcox
0 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2005-03-07 14:36 UTC (permalink / raw)
To: Jes Sorensen; +Cc: Matthew Wilcox, domen, James.Bottomley, linux-scsi, tklauser
On Mon, Mar 07, 2005 at 09:27:17AM -0500, Jes Sorensen wrote:
> Matthew> We've had drivers with typos. Missing one f suddenly causes
> Matthew> all your memory to come from ZONE_DMA. Having an extra f
> Matthew> causes your driver to work ... most of the time on machines
> Matthew> with >4GB ram. Sure, your driver doesn't, but when looking
> Matthew> over a lot of drivers, it's easier if everyone's using the
> Matthew> same macros.
>
> If these were the only two masks ever used I'd agree with you. However
> there's several other in use and more will probably be added, so we're
> going to end up with drivers sometimes using constants and other times
> hex values causing an even bigger mess ;-(
No, that's a *good thing*. It let's you know the driver's doing something
non-standard. Here's what sym2 looks like these days:
#if SYM_CONF_DMA_ADDRESSING_MODE > 0
#if SYM_CONF_DMA_ADDRESSING_MODE == 1
#define DMA_DAC_MASK 0x000000ffffffffffULL /* 40-bit */
#elif SYM_CONF_DMA_ADDRESSING_MODE == 2
#define DMA_DAC_MASK DMA_64BIT_MASK
#endif
if ((np->features & FE_DAC) &&
!pci_set_dma_mask(np->s.device, DMA_DAC_MASK)) {
np->use_dac = 1;
return 0;
}
#endif
if (!pci_set_dma_mask(np->s.device, DMA_32BIT_MASK))
return 0;
printf_warning("%s: No suitable DMA available\n", sym_name(np));
return -1;
I suspect that should be a dev_err rather than a printf_warning, but
my point stands; this is a *much* easier way of doing things. You can
see exactly where we're doing standard things and where we're doing
weird things.
--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-07 14:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-06 22:27 [patch 10/11] drivers/scsi/: Use the DMA_{64,32}BIT_MASK constants domen
2005-03-07 10:14 ` Jes Sorensen
2005-03-07 12:37 ` Matthew Wilcox
2005-03-07 14:27 ` Jes Sorensen
2005-03-07 14:36 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox