From ad84f9bc2b53c27111f40d14d226a7f7635faa30 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 3 Dec 2014 11:25:35 -0700 Subject: [PATCH] staging: comedi: addi_apci_1500: tidy up PCI Bar 1 register map For aesthetics, convert the enum for the PCI Bar 1 register map to defines and move them to the main driver source file. Rename the registers. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1500.c | 35 +++++++------------ .../staging/comedi/drivers/addi_apci_1500.c | 8 +++++ 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 26b46c5350ae..d5d959c31043 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -50,16 +50,6 @@ #define STOP 1 #define TRIGGER 2 -/* - * Zillog I/O enumeration - */ -enum { - APCI1500_Z8536_PORT_C, - APCI1500_Z8536_PORT_B, - APCI1500_Z8536_PORT_A, - APCI1500_Z8536_CONTROL_REGISTER -}; - /* * Z8536 CIO Internal Address */ @@ -136,8 +126,8 @@ static unsigned int z8536_read(struct comedi_device *dev, unsigned int reg) unsigned int val; spin_lock_irqsave(&dev->spinlock, flags); - outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - val = inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); + outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG); + val = inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG); spin_unlock_irqrestore(&dev->spinlock, flags); return val; @@ -150,8 +140,8 @@ static void z8536_write(struct comedi_device *dev, unsigned long flags; spin_lock_irqsave(&dev->spinlock, flags); - outb(reg, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - outb(val, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); + outb(reg, devpriv->iobase + APCI1500_Z8536_CTRL_REG); + outb(val, devpriv->iobase + APCI1500_Z8536_CTRL_REG); spin_unlock_irqrestore(&dev->spinlock, flags); } @@ -165,12 +155,12 @@ static void z8536_reset(struct comedi_device *dev) * sequence will reset it and put it in State 0. */ spin_lock_irqsave(&dev->spinlock, flags); - inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - inb(devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - outb(1, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); - outb(0, devpriv->iobase + APCI1500_Z8536_CONTROL_REGISTER); + inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG); + outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG); + inb(devpriv->iobase + APCI1500_Z8536_CTRL_REG); + outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG); + outb(1, devpriv->iobase + APCI1500_Z8536_CTRL_REG); + outb(0, devpriv->iobase + APCI1500_Z8536_CTRL_REG); spin_unlock_irqrestore(&dev->spinlock, flags); z8536_write(dev, 0xf4, APCI1500_RW_MASTER_CONFIGURATION_CONTROL); @@ -1551,9 +1541,8 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) z8536_write(dev, i_RegValue, APCI1500_RW_PORT_B_COMMAND_AND_STATUS); /* Reads port B */ - i_RegValue = - inb((unsigned int) devpriv->iobase + - APCI1500_Z8536_PORT_B); + i_RegValue = inb(devpriv->iobase + + APCI1500_Z8536_PORTB_REG); i_RegValue = i_RegValue & 0xC0; /* Tests if this is an external error */ diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 30b132c3d092..52df4959848a 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -7,6 +7,14 @@ #include "comedi_fc.h" #include "amcc_s5933.h" +/* + * PCI Bar 1 Register map (devpriv->iobase) + */ +#define APCI1500_Z8536_PORTC_REG 0x00 +#define APCI1500_Z8536_PORTB_REG 0x01 +#define APCI1500_Z8536_PORTA_REG 0x02 +#define APCI1500_Z8536_CTRL_REG 0x03 + struct apci1500_private { int iobase; int i_IobaseAmcc; -- 2.20.1