Skip to content

Commit 144ec97

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: aic7xxx: fix EISA support
Instead of relying on the now removed NULL argument to pci_alloc_consistent, switch to the generic DMA API, and store the struct device so that we can pass it. Fixes: 4167b2a ("PCI: Remove NULL device handling from PCI DMA API") Reported-by: Matthew Whitehead <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Matthew Whitehead <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0228034 commit 144ec97

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

drivers/scsi/aic7xxx/aic7770_osm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ aic7770_probe(struct device *dev)
9191
ahc = ahc_alloc(&aic7xxx_driver_template, name);
9292
if (ahc == NULL)
9393
return (ENOMEM);
94+
ahc->dev = dev;
9495
error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,
9596
eisaBase);
9697
if (error != 0) {

drivers/scsi/aic7xxx/aic7xxx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ struct ahc_softc {
943943
* Platform specific device information.
944944
*/
945945
ahc_dev_softc_t dev_softc;
946+
struct device *dev;
946947

947948
/*
948949
* Bus specific device information.

drivers/scsi/aic7xxx/aic7xxx_osm.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,8 @@ int
860860
ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
861861
int flags, bus_dmamap_t *mapp)
862862
{
863-
*vaddr = pci_alloc_consistent(ahc->dev_softc,
864-
dmat->maxsize, mapp);
863+
/* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */
864+
*vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC);
865865
if (*vaddr == NULL)
866866
return ENOMEM;
867867
return 0;
@@ -871,8 +871,7 @@ void
871871
ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat,
872872
void* vaddr, bus_dmamap_t map)
873873
{
874-
pci_free_consistent(ahc->dev_softc, dmat->maxsize,
875-
vaddr, map);
874+
dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map);
876875
}
877876

878877
int
@@ -1123,8 +1122,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
11231122

11241123
host->transportt = ahc_linux_transport_template;
11251124

1126-
retval = scsi_add_host(host,
1127-
(ahc->dev_softc ? &ahc->dev_softc->dev : NULL));
1125+
retval = scsi_add_host(host, ahc->dev);
11281126
if (retval) {
11291127
printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n");
11301128
scsi_host_put(host);

drivers/scsi/aic7xxx/aic7xxx_osm_pci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
250250
}
251251
}
252252
ahc->dev_softc = pci;
253+
ahc->dev = &pci->dev;
253254
error = ahc_pci_config(ahc, entry);
254255
if (error != 0) {
255256
ahc_free(ahc);

0 commit comments

Comments
 (0)