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

staging: comedi: quatech_daqp_cs: rename the private data struct

The private data in this driver is associated with the comedi_device
pointer not the pcmcia_device. For aesthetic reasons, rename the
private data struct from local_into_t to daqp_private.

Also, rename the local variables used for the private data from
local to devpriv as that is more common in the comedi drivers.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c1271742
...@@ -61,7 +61,7 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 ...@@ -61,7 +61,7 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308
/* Maximum number of separate DAQP devices we'll allow */ /* Maximum number of separate DAQP devices we'll allow */
#define MAX_DEV 4 #define MAX_DEV 4
struct local_info_t { struct daqp_private {
int stop; int stop;
enum { semaphore, buffer } interrupt_mode; enum { semaphore, buffer } interrupt_mode;
...@@ -167,26 +167,25 @@ static const struct comedi_lrange range_daqp_ai = { ...@@ -167,26 +167,25 @@ static const struct comedi_lrange range_daqp_ai = {
static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
outb(DAQP_COMMAND_STOP, dev->iobase + DAQP_COMMAND); outb(DAQP_COMMAND_STOP, dev->iobase + DAQP_COMMAND);
/* flush any linguring data in FIFO - superfluous here */ /* flush any linguring data in FIFO - superfluous here */
/* outb(DAQP_COMMAND_RSTF, dev->iobase+DAQP_COMMAND); */ /* outb(DAQP_COMMAND_RSTF, dev->iobase+DAQP_COMMAND); */
local->interrupt_mode = semaphore; devpriv->interrupt_mode = semaphore;
return 0; return 0;
} }
/* Interrupt handler /* Interrupt handler
* *
* Operates in one of two modes. If local->interrupt_mode is * Operates in one of two modes. If devpriv->interrupt_mode is
* 'semaphore', just signal the local->eos completion and return * 'semaphore', just signal the devpriv->eos completion and return
* (one-shot mode). Otherwise (continuous mode), read data in from * (one-shot mode). Otherwise (continuous mode), read data in from
* the card, transfer it to the buffer provided by the higher-level * the card, transfer it to the buffer provided by the higher-level
* comedi kernel module, and signal various comedi callback routines, * comedi kernel module, and signal various comedi callback routines,
...@@ -195,7 +194,7 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -195,7 +194,7 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
static enum irqreturn daqp_interrupt(int irq, void *dev_id) static enum irqreturn daqp_interrupt(int irq, void *dev_id)
{ {
struct comedi_device *dev = dev_id; struct comedi_device *dev = dev_id;
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
int loop_limit = 10000; int loop_limit = 10000;
int status; int status;
...@@ -203,15 +202,12 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -203,15 +202,12 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; return IRQ_NONE;
switch (local->interrupt_mode) { switch (devpriv->interrupt_mode) {
case semaphore: case semaphore:
complete(&devpriv->eos);
complete(&local->eos);
break; break;
case buffer: case buffer:
while (!((status = inb(dev->iobase + DAQP_STATUS)) while (!((status = inb(dev->iobase + DAQP_STATUS))
& DAQP_STATUS_FIFO_EMPTY)) { & DAQP_STATUS_FIFO_EMPTY)) {
...@@ -235,9 +231,9 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) ...@@ -235,9 +231,9 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
* and stop conversion if zero * and stop conversion if zero
*/ */
if (local->count > 0) { if (devpriv->count > 0) {
local->count--; devpriv->count--;
if (local->count == 0) { if (devpriv->count == 0) {
daqp_ai_cancel(dev, s); daqp_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
break; break;
...@@ -268,15 +264,14 @@ static int daqp_ai_insn_read(struct comedi_device *dev, ...@@ -268,15 +264,14 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
int i; int i;
int v; int v;
int counter = 10000; int counter = 10000;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
/* Stop any running conversion */ /* Stop any running conversion */
daqp_ai_cancel(dev, s); daqp_ai_cancel(dev, s);
...@@ -323,8 +318,8 @@ static int daqp_ai_insn_read(struct comedi_device *dev, ...@@ -323,8 +318,8 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
return -1; return -1;
} }
init_completion(&local->eos); init_completion(&devpriv->eos);
local->interrupt_mode = semaphore; devpriv->interrupt_mode = semaphore;
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
...@@ -334,7 +329,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev, ...@@ -334,7 +329,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
/* Wait for interrupt service routine to unblock completion */ /* Wait for interrupt service routine to unblock completion */
/* Maybe could use a timeout here, but it's interruptible */ /* Maybe could use a timeout here, but it's interruptible */
if (wait_for_completion_interruptible(&local->eos)) if (wait_for_completion_interruptible(&devpriv->eos))
return -EINTR; return -EINTR;
data[i] = inb(dev->iobase + DAQP_FIFO); data[i] = inb(dev->iobase + DAQP_FIFO);
...@@ -459,7 +454,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, ...@@ -459,7 +454,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev,
static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
int counter; int counter;
int scanlist_start_on_every_entry; int scanlist_start_on_every_entry;
...@@ -468,10 +463,9 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -468,10 +463,9 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
int i; int i;
int v; int v;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
/* Stop any running conversion */ /* Stop any running conversion */
daqp_ai_cancel(dev, s); daqp_ai_cancel(dev, s);
...@@ -593,16 +587,16 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -593,16 +587,16 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
/* Save away the number of conversions we should perform, and /* Save away the number of conversions we should perform, and
* compute the FIFO threshold (in bytes, not samples - that's * compute the FIFO threshold (in bytes, not samples - that's
* why we multiple local->count by 2 = sizeof(sample)) * why we multiple devpriv->count by 2 = sizeof(sample))
*/ */
if (cmd->stop_src == TRIG_COUNT) { if (cmd->stop_src == TRIG_COUNT) {
local->count = cmd->stop_arg * cmd->scan_end_arg; devpriv->count = cmd->stop_arg * cmd->scan_end_arg;
threshold = 2 * local->count; threshold = 2 * devpriv->count;
while (threshold > DAQP_FIFO_SIZE * 3 / 4) while (threshold > DAQP_FIFO_SIZE * 3 / 4)
threshold /= 2; threshold /= 2;
} else { } else {
local->count = -1; devpriv->count = -1;
threshold = DAQP_FIFO_SIZE / 2; threshold = DAQP_FIFO_SIZE / 2;
} }
...@@ -644,7 +638,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -644,7 +638,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return -1; return -1;
} }
local->interrupt_mode = buffer; devpriv->interrupt_mode = buffer;
/* Start conversion */ /* Start conversion */
outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA, outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA,
...@@ -659,11 +653,11 @@ static int daqp_ao_insn_write(struct comedi_device *dev, ...@@ -659,11 +653,11 @@ static int daqp_ao_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
int d; int d;
unsigned int chan; unsigned int chan;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
chan = CR_CHAN(insn->chanspec); chan = CR_CHAN(insn->chanspec);
...@@ -686,9 +680,9 @@ static int daqp_di_insn_read(struct comedi_device *dev, ...@@ -686,9 +680,9 @@ static int daqp_di_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
data[0] = inb(dev->iobase + DAQP_DIGITAL_IO); data[0] = inb(dev->iobase + DAQP_DIGITAL_IO);
...@@ -702,9 +696,9 @@ static int daqp_do_insn_write(struct comedi_device *dev, ...@@ -702,9 +696,9 @@ static int daqp_do_insn_write(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct local_info_t *local = dev->private; struct daqp_private *devpriv = dev->private;
if (local->stop) if (devpriv->stop)
return -EIO; return -EIO;
outw(data[0] & 0xf, dev->iobase + DAQP_DIGITAL_IO); outw(data[0] & 0xf, dev->iobase + DAQP_DIGITAL_IO);
...@@ -716,17 +710,16 @@ static int daqp_auto_attach(struct comedi_device *dev, ...@@ -716,17 +710,16 @@ static int daqp_auto_attach(struct comedi_device *dev,
unsigned long context) unsigned long context)
{ {
struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); struct pcmcia_device *link = comedi_to_pcmcia_dev(dev);
struct local_info_t *local; struct daqp_private *devpriv;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret; int ret;
dev->board_name = dev->driver->driver_name; dev->board_name = dev->driver->driver_name;
/* Allocate space for private device-specific data */ devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
local = kzalloc(sizeof(*local), GFP_KERNEL); if (!devpriv)
if (!local)
return -ENOMEM; return -ENOMEM;
dev->private = local; dev->private = devpriv;
link->config_flags |= CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; link->config_flags |= CONF_AUTO_SET_IO | CONF_ENABLE_IRQ;
ret = comedi_pcmcia_enable(dev); ret = comedi_pcmcia_enable(dev);
...@@ -790,11 +783,11 @@ static struct comedi_driver driver_daqp = { ...@@ -790,11 +783,11 @@ static struct comedi_driver driver_daqp = {
static int daqp_cs_suspend(struct pcmcia_device *link) static int daqp_cs_suspend(struct pcmcia_device *link)
{ {
struct comedi_device *dev = link->priv; struct comedi_device *dev = link->priv;
struct local_info_t *local = dev ? dev->private : NULL; struct daqp_private *devpriv = dev ? dev->private : NULL;
/* Mark the device as stopped, to block IO until later */ /* Mark the device as stopped, to block IO until later */
if (local) if (devpriv)
local->stop = 1; devpriv->stop = 1;
return 0; return 0;
} }
...@@ -802,10 +795,10 @@ static int daqp_cs_suspend(struct pcmcia_device *link) ...@@ -802,10 +795,10 @@ static int daqp_cs_suspend(struct pcmcia_device *link)
static int daqp_cs_resume(struct pcmcia_device *link) static int daqp_cs_resume(struct pcmcia_device *link)
{ {
struct comedi_device *dev = link->priv; struct comedi_device *dev = link->priv;
struct local_info_t *local = dev ? dev->private : NULL; struct daqp_private *devpriv = dev ? dev->private : NULL;
if (local) if (devpriv)
local->stop = 0; devpriv->stop = 0;
return 0; return 0;
} }
......
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