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

staging: comedi: dnya_pci10xx: remove thisboard and devpriv macros

These macros rely on local variables having a specific name. Replace
them with local variables where used. Use the comedi_board() helper
to get the thisboard pointer.
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 8451b5ad
...@@ -104,9 +104,6 @@ struct dyna_pci10xx_private { ...@@ -104,9 +104,6 @@ struct dyna_pci10xx_private {
unsigned long BADR3; unsigned long BADR3;
}; };
#define thisboard ((const struct boardtype *)dev->board_ptr)
#define devpriv ((struct dyna_pci10xx_private *)dev->private)
/******************************************************************************/ /******************************************************************************/
/************************** READ WRITE FUNCTIONS ******************************/ /************************** READ WRITE FUNCTIONS ******************************/
/******************************************************************************/ /******************************************************************************/
...@@ -116,6 +113,8 @@ static int dyna_pci10xx_insn_read_ai(struct comedi_device *dev, ...@@ -116,6 +113,8 @@ static int dyna_pci10xx_insn_read_ai(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)
{ {
const struct boardtype *thisboard = comedi_board(dev);
struct dyna_pci10xx_private *devpriv = dev->private;
int n, counter; int n, counter;
u16 d = 0; u16 d = 0;
unsigned int chan, range; unsigned int chan, range;
...@@ -159,6 +158,8 @@ static int dyna_pci10xx_insn_write_ao(struct comedi_device *dev, ...@@ -159,6 +158,8 @@ static int dyna_pci10xx_insn_write_ao(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)
{ {
const struct boardtype *thisboard = comedi_board(dev);
struct dyna_pci10xx_private *devpriv = dev->private;
int n; int n;
unsigned int chan, range; unsigned int chan, range;
...@@ -181,6 +182,7 @@ static int dyna_pci10xx_di_insn_bits(struct comedi_device *dev, ...@@ -181,6 +182,7 @@ static int dyna_pci10xx_di_insn_bits(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 dyna_pci10xx_private *devpriv = dev->private;
u16 d = 0; u16 d = 0;
mutex_lock(&devpriv->mutex); mutex_lock(&devpriv->mutex);
...@@ -200,6 +202,8 @@ static int dyna_pci10xx_do_insn_bits(struct comedi_device *dev, ...@@ -200,6 +202,8 @@ static int dyna_pci10xx_do_insn_bits(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 dyna_pci10xx_private *devpriv = dev->private;
/* The insn data is a mask in data[0] and the new data /* The insn data is a mask in data[0] and the new data
* in data[1], each channel cooresponding to a bit. * in data[1], each channel cooresponding to a bit.
* s->state contains the previous write data * s->state contains the previous write data
...@@ -257,20 +261,22 @@ static struct pci_dev *dyna_pci10xx_find_pci_dev(struct comedi_device *dev, ...@@ -257,20 +261,22 @@ static struct pci_dev *dyna_pci10xx_find_pci_dev(struct comedi_device *dev,
static int dyna_pci10xx_attach(struct comedi_device *dev, static int dyna_pci10xx_attach(struct comedi_device *dev,
struct comedi_devconfig *it) struct comedi_devconfig *it)
{ {
const struct boardtype *thisboard;
struct dyna_pci10xx_private *devpriv;
struct pci_dev *pcidev; struct pci_dev *pcidev;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret; int ret;
if (alloc_private(dev, sizeof(struct dyna_pci10xx_private)) < 0) { ret = alloc_private(dev, sizeof(*devpriv));
printk(KERN_ERR "comedi: dyna_pci10xx: " if (ret)
"failed to allocate memory!\n"); return ret;
return -ENOMEM; devpriv = dev->private;
}
pcidev = dyna_pci10xx_find_pci_dev(dev, it); pcidev = dyna_pci10xx_find_pci_dev(dev, it);
if (!pcidev) if (!pcidev)
return -EIO; return -EIO;
comedi_set_hw_dev(dev, &pcidev->dev); comedi_set_hw_dev(dev, &pcidev->dev);
thisboard = comedi_board(dev);
dev->board_name = thisboard->name; dev->board_name = thisboard->name;
dev->irq = 0; dev->irq = 0;
...@@ -342,6 +348,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev, ...@@ -342,6 +348,7 @@ static int dyna_pci10xx_attach(struct comedi_device *dev,
static void dyna_pci10xx_detach(struct comedi_device *dev) static void dyna_pci10xx_detach(struct comedi_device *dev)
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct dyna_pci10xx_private *devpriv = dev->private;
if (devpriv) if (devpriv)
mutex_destroy(&devpriv->mutex); mutex_destroy(&devpriv->mutex);
......
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