Commit b07839c0 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcmuio: cleanup remaining #define's

Remove all the unused #define's and add namespace to the ones that
are used.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1fdd0fc5
...@@ -108,21 +108,8 @@ ...@@ -108,21 +108,8 @@
#define PCMUIO_PAGE_INT_ID 3 #define PCMUIO_PAGE_INT_ID 3
#define PCMUIO_PAGE_REG(x) (0x08 + (x)) #define PCMUIO_PAGE_REG(x) (0x08 + (x))
#define CHANS_PER_PORT 8 #define PCMUIO_ASIC_IOSIZE 0x10
#define PORTS_PER_ASIC 6 #define PCMUIO_MAX_ASICS 2
/* number of channels per comedi subdevice */
#define MAX_CHANS_PER_SUBDEV 24
#define PORTS_PER_SUBDEV (MAX_CHANS_PER_SUBDEV / CHANS_PER_PORT)
#define CHANS_PER_ASIC (CHANS_PER_PORT * PORTS_PER_ASIC)
#define INTR_CHANS_PER_ASIC 24
#define INTR_PORTS_PER_SUBDEV (INTR_CHANS_PER_ASIC / CHANS_PER_PORT)
#define MAX_DIO_CHANS (PORTS_PER_ASIC * 2 * CHANS_PER_PORT)
#define MAX_ASICS (MAX_DIO_CHANS / CHANS_PER_ASIC)
/* IO Memory sizes */
#define ASIC_IOSIZE 0x10
#define PCMUIO48_IOSIZE ASIC_IOSIZE
#define PCMUIO96_IOSIZE (ASIC_IOSIZE * 2)
struct pcmuio_board { struct pcmuio_board {
const char *name; const char *name;
...@@ -160,14 +147,14 @@ struct pcmuio_private { ...@@ -160,14 +147,14 @@ struct pcmuio_private {
struct { struct {
unsigned int irq; unsigned int irq;
spinlock_t spinlock; spinlock_t spinlock;
} asics[MAX_ASICS]; } asics[PCMUIO_MAX_ASICS];
struct pcmuio_subdev_private *sprivs; struct pcmuio_subdev_private *sprivs;
}; };
static void pcmuio_write(struct comedi_device *dev, unsigned int val, static void pcmuio_write(struct comedi_device *dev, unsigned int val,
int asic, int page, int port) int asic, int page, int port)
{ {
unsigned long iobase = dev->iobase + (asic * ASIC_IOSIZE); unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
if (page == 0) { if (page == 0) {
/* Port registers are valid for any page */ /* Port registers are valid for any page */
...@@ -185,7 +172,7 @@ static void pcmuio_write(struct comedi_device *dev, unsigned int val, ...@@ -185,7 +172,7 @@ static void pcmuio_write(struct comedi_device *dev, unsigned int val,
static unsigned int pcmuio_read(struct comedi_device *dev, static unsigned int pcmuio_read(struct comedi_device *dev,
int asic, int page, int port) int asic, int page, int port)
{ {
unsigned long iobase = dev->iobase + (asic * ASIC_IOSIZE); unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
unsigned int val; unsigned int val;
if (page == 0) { if (page == 0) {
...@@ -368,7 +355,7 @@ static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic) ...@@ -368,7 +355,7 @@ static int pcmuio_handle_asic_interrupt(struct comedi_device *dev, int asic)
{ {
struct pcmuio_private *devpriv = dev->private; struct pcmuio_private *devpriv = dev->private;
struct pcmuio_subdev_private *subpriv; struct pcmuio_subdev_private *subpriv;
unsigned long iobase = dev->iobase + (asic * ASIC_IOSIZE); unsigned long iobase = dev->iobase + (asic * PCMUIO_ASIC_IOSIZE);
unsigned int triggered = 0; unsigned int triggered = 0;
int got1 = 0; int got1 = 0;
unsigned long flags; unsigned long flags;
...@@ -413,7 +400,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d) ...@@ -413,7 +400,7 @@ static irqreturn_t interrupt_pcmuio(int irq, void *d)
int got1 = 0; int got1 = 0;
int asic; int asic;
for (asic = 0; asic < MAX_ASICS; ++asic) { for (asic = 0; asic < PCMUIO_MAX_ASICS; ++asic) {
if (irq == devpriv->asics[asic].irq) { if (irq == devpriv->asics[asic].irq) {
/* it is an interrupt for ASIC #asic */ /* it is an interrupt for ASIC #asic */
if (pcmuio_handle_asic_interrupt(dev, asic)) if (pcmuio_handle_asic_interrupt(dev, asic))
...@@ -611,14 +598,14 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -611,14 +598,14 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
struct pcmuio_private *devpriv; struct pcmuio_private *devpriv;
struct pcmuio_subdev_private *subpriv; struct pcmuio_subdev_private *subpriv;
int sdev_no, n_subdevs, asic; int sdev_no, n_subdevs, asic;
unsigned int irq[MAX_ASICS]; unsigned int irq[PCMUIO_MAX_ASICS];
int ret; int ret;
irq[0] = it->options[1]; irq[0] = it->options[1];
irq[1] = it->options[2]; irq[1] = it->options[2];
ret = comedi_request_region(dev, it->options[0], ret = comedi_request_region(dev, it->options[0],
board->num_asics * ASIC_IOSIZE); board->num_asics * PCMUIO_ASIC_IOSIZE);
if (ret) if (ret)
return ret; return ret;
...@@ -627,7 +614,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -627,7 +614,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -ENOMEM; return -ENOMEM;
dev->private = devpriv; dev->private = devpriv;
for (asic = 0; asic < MAX_ASICS; ++asic) for (asic = 0; asic < PCMUIO_MAX_ASICS; ++asic)
spin_lock_init(&devpriv->asics[asic].spinlock); spin_lock_init(&devpriv->asics[asic].spinlock);
n_subdevs = board->num_asics * 2; n_subdevs = board->num_asics * 2;
...@@ -672,7 +659,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -672,7 +659,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
init_asics(dev); /* clear out all the registers, basically */ init_asics(dev); /* clear out all the registers, basically */
for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) { for (asic = 0; irq[0] && asic < PCMUIO_MAX_ASICS; ++asic) {
if (irq[asic] if (irq[asic]
&& request_irq(irq[asic], interrupt_pcmuio, && request_irq(irq[asic], interrupt_pcmuio,
IRQF_SHARED, board->name, dev)) { IRQF_SHARED, board->name, dev)) {
...@@ -705,7 +692,7 @@ static void pcmuio_detach(struct comedi_device *dev) ...@@ -705,7 +692,7 @@ static void pcmuio_detach(struct comedi_device *dev)
struct pcmuio_private *devpriv = dev->private; struct pcmuio_private *devpriv = dev->private;
int i; int i;
for (i = 0; i < MAX_ASICS; ++i) { for (i = 0; i < PCMUIO_MAX_ASICS; ++i) {
if (devpriv->asics[i].irq) if (devpriv->asics[i].irq)
free_irq(devpriv->asics[i].irq, dev); free_irq(devpriv->asics[i].irq, dev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment