summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-04-18 12:13:58 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2019-04-18 20:43:10 -0400
commit144ec97493af34efdb77c5aba146e9c7de8d0a06 (patch)
tree2dd446e15b58d7d7a185206fdaf6aac58e2a9a89
parent0228034d8e5915b98c33db35a98f5e909e848ae9 (diff)
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: 4167b2ad5182 ("PCI: Remove NULL device handling from PCI DMA API") Reported-by: Matthew Whitehead <tedheadster@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Matthew Whitehead <tedheadster@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/aic7xxx/aic7770_osm.c1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx.h1
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c10
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c1
4 files changed, 7 insertions, 6 deletions
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c
index 3d401d02c019..bdd177e3d762 100644
--- a/drivers/scsi/aic7xxx/aic7770_osm.c
+++ b/drivers/scsi/aic7xxx/aic7770_osm.c
@@ -91,6 +91,7 @@ aic7770_probe(struct device *dev)
91 ahc = ahc_alloc(&aic7xxx_driver_template, name); 91 ahc = ahc_alloc(&aic7xxx_driver_template, name);
92 if (ahc == NULL) 92 if (ahc == NULL)
93 return (ENOMEM); 93 return (ENOMEM);
94 ahc->dev = dev;
94 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, 95 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,
95 eisaBase); 96 eisaBase);
96 if (error != 0) { 97 if (error != 0) {
diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h
index 5614921b4041..88b90f9806c9 100644
--- a/drivers/scsi/aic7xxx/aic7xxx.h
+++ b/drivers/scsi/aic7xxx/aic7xxx.h
@@ -943,6 +943,7 @@ struct ahc_softc {
943 * Platform specific device information. 943 * Platform specific device information.
944 */ 944 */
945 ahc_dev_softc_t dev_softc; 945 ahc_dev_softc_t dev_softc;
946 struct device *dev;
946 947
947 /* 948 /*
948 * Bus specific device information. 949 * Bus specific device information.
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 3c9c17450bb3..d5c4a0d23706 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -860,8 +860,8 @@ int
860ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, 860ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr,
861 int flags, bus_dmamap_t *mapp) 861 int flags, bus_dmamap_t *mapp)
862{ 862{
863 *vaddr = pci_alloc_consistent(ahc->dev_softc, 863 /* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */
864 dmat->maxsize, mapp); 864 *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC);
865 if (*vaddr == NULL) 865 if (*vaddr == NULL)
866 return ENOMEM; 866 return ENOMEM;
867 return 0; 867 return 0;
@@ -871,8 +871,7 @@ void
871ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, 871ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat,
872 void* vaddr, bus_dmamap_t map) 872 void* vaddr, bus_dmamap_t map)
873{ 873{
874 pci_free_consistent(ahc->dev_softc, dmat->maxsize, 874 dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map);
875 vaddr, map);
876} 875}
877 876
878int 877int
@@ -1123,8 +1122,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa
1123 1122
1124 host->transportt = ahc_linux_transport_template; 1123 host->transportt = ahc_linux_transport_template;
1125 1124
1126 retval = scsi_add_host(host, 1125 retval = scsi_add_host(host, ahc->dev);
1127 (ahc->dev_softc ? &ahc->dev_softc->dev : NULL));
1128 if (retval) { 1126 if (retval) {
1129 printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); 1127 printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n");
1130 scsi_host_put(host); 1128 scsi_host_put(host);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 0fc14dac7070..717d8d1082ce 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -250,6 +250,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
250 } 250 }
251 } 251 }
252 ahc->dev_softc = pci; 252 ahc->dev_softc = pci;
253 ahc->dev = &pci->dev;
253 error = ahc_pci_config(ahc, entry); 254 error = ahc_pci_config(ahc, entry);
254 if (error != 0) { 255 if (error != 0) {
255 ahc_free(ahc); 256 ahc_free(ahc);