From 820682b1b34ebb97434c4abc00c744870364e2be Mon Sep 17 00:00:00 2001 From: Finn Thain Date: Mon, 10 Oct 2016 00:46:53 -0400 Subject: scsi: ncr5380: Store IO ports and addresses in host private data The various 5380 drivers inconsistently store register pointers either in the Scsi_Host struct "legacy crap" area or in special, board-specific members of the NCR5380_hostdata struct. Uniform use of the latter struct makes for simpler and faster code (see the following patches) and helps to reduce use of the NCR5380_implementation_fields macro. Signed-off-by: Finn Thain Reviewed-by: Hannes Reinecke Tested-by: Ondrej Zary Tested-by: Michael Schmitz Acked-by: Russell King Signed-off-by: Martin K. Petersen --- drivers/scsi/dmx3191d.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/dmx3191d.c') diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c index 9b5a457d4bca..3b6df905a81c 100644 --- a/drivers/scsi/dmx3191d.c +++ b/drivers/scsi/dmx3191d.c @@ -34,8 +34,10 @@ * Definitions for the generic 5380 driver. */ -#define NCR5380_read(reg) inb(instance->io_port + reg) -#define NCR5380_write(reg, value) outb(value, instance->io_port + reg) +#define priv(instance) ((struct NCR5380_hostdata *)shost_priv(instance)) + +#define NCR5380_read(reg) inb(priv(instance)->base + (reg)) +#define NCR5380_write(reg, value) outb(value, priv(instance)->base + (reg)) #define NCR5380_dma_xfer_len(instance, cmd, phase) (0) #define NCR5380_dma_recv_setup(instance, dst, len) (0) @@ -71,6 +73,7 @@ static int dmx3191d_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { struct Scsi_Host *shost; + struct NCR5380_hostdata *hostdata; unsigned long io; int error = -ENODEV; @@ -88,7 +91,9 @@ static int dmx3191d_probe_one(struct pci_dev *pdev, sizeof(struct NCR5380_hostdata)); if (!shost) goto out_release_region; - shost->io_port = io; + + hostdata = shost_priv(shost); + hostdata->base = io; /* This card does not seem to raise an interrupt on pdev->irq. * Steam-powered SCSI controllers run without an IRQ anyway. @@ -125,7 +130,8 @@ out_host_put: static void dmx3191d_remove_one(struct pci_dev *pdev) { struct Scsi_Host *shost = pci_get_drvdata(pdev); - unsigned long io = shost->io_port; + struct NCR5380_hostdata *hostdata = shost_priv(shost); + unsigned long io = hostdata->base; scsi_remove_host(shost); -- cgit