Commit 282f3528 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: Remove thisboard and devpriv macros

The 'thisboard' and 'devpriv' macros rely on a local variable having a
specific name and yield pointers derived from that local variable.
Replace the macros with local variables wherever they occur.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 33fba3b7
...@@ -235,14 +235,13 @@ static const int *const das08_gainlists[] = { ...@@ -235,14 +235,13 @@ static const int *const das08_gainlists[] = {
das08_pgm_gainlist, das08_pgm_gainlist,
}; };
#define devpriv ((struct das08_private_struct *)dev->private)
#define thisboard ((const struct das08_board_struct *)dev->board_ptr)
#define TIMEOUT 100000 #define TIMEOUT 100000
static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv = dev->private;
int i, n; int i, n;
int chan; int chan;
int range; int range;
...@@ -320,6 +319,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -320,6 +319,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
{ {
struct das08_private_struct *devpriv = dev->private;
int wbits; int wbits;
/* get current settings of digital output lines */ /* get current settings of digital output lines */
...@@ -358,6 +358,8 @@ static int das08jr_do_wbits(struct comedi_device *dev, ...@@ -358,6 +358,8 @@ static int das08jr_do_wbits(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 das08_private_struct *devpriv = dev->private;
/* null bits we are going to set */ /* null bits we are going to set */
devpriv->do_bits &= ~data[0]; devpriv->do_bits &= ~data[0];
/* set new bit values */ /* set new bit values */
...@@ -528,6 +530,7 @@ static int das08_counter_read(struct comedi_device *dev, ...@@ -528,6 +530,7 @@ static int das08_counter_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 das08_private_struct *devpriv = dev->private;
int chan = insn->chanspec; int chan = insn->chanspec;
data[0] = i8254_read_channel(&devpriv->i8254, chan); data[0] = i8254_read_channel(&devpriv->i8254, chan);
return 1; return 1;
...@@ -537,6 +540,7 @@ static int das08_counter_write(struct comedi_device *dev, ...@@ -537,6 +540,7 @@ static int das08_counter_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 das08_private_struct *devpriv = dev->private;
int chan = insn->chanspec; int chan = insn->chanspec;
i8254_write_channel(&devpriv->i8254, chan, data[0]); i8254_write_channel(&devpriv->i8254, chan, data[0]);
return 1; return 1;
...@@ -546,6 +550,7 @@ static int das08_counter_config(struct comedi_device *dev, ...@@ -546,6 +550,7 @@ static int das08_counter_config(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 das08_private_struct *devpriv = dev->private;
int chan = insn->chanspec; int chan = insn->chanspec;
if (insn->n != 2) if (insn->n != 2)
...@@ -823,6 +828,8 @@ EXPORT_SYMBOL_GPL(das08_cs_boards); ...@@ -823,6 +828,8 @@ EXPORT_SYMBOL_GPL(das08_cs_boards);
int das08_common_attach(struct comedi_device *dev, unsigned long iobase) int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
{ {
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv = dev->private;
struct comedi_subdevice *s; struct comedi_subdevice *s;
int ret; int ret;
...@@ -934,12 +941,15 @@ EXPORT_SYMBOL_GPL(das08_common_attach); ...@@ -934,12 +941,15 @@ EXPORT_SYMBOL_GPL(das08_common_attach);
#ifdef DO_COMEDI_DRIVER_REGISTER #ifdef DO_COMEDI_DRIVER_REGISTER
static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv;
int ret; int ret;
unsigned long iobase; unsigned long iobase;
ret = alloc_private(dev, sizeof(struct das08_private_struct)); ret = alloc_private(dev, sizeof(struct das08_private_struct));
if (ret < 0) if (ret < 0)
return ret; return ret;
devpriv = dev->private;
dev_info(dev->class_dev, "attach\n"); dev_info(dev->class_dev, "attach\n");
if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) { if (IS_ENABLED(CONFIG_COMEDI_DAS08_PCI) && thisboard->bustype == pci) {
...@@ -1016,6 +1026,9 @@ EXPORT_SYMBOL_GPL(das08_common_detach); ...@@ -1016,6 +1026,9 @@ EXPORT_SYMBOL_GPL(das08_common_detach);
#ifdef DO_COMEDI_DRIVER_REGISTER #ifdef DO_COMEDI_DRIVER_REGISTER
static void das08_detach(struct comedi_device *dev) static void das08_detach(struct comedi_device *dev)
{ {
const struct das08_board_struct *thisboard = comedi_board(dev);
struct das08_private_struct *devpriv = dev->private;
das08_common_detach(dev); das08_common_detach(dev);
if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) && if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) &&
(thisboard->bustype == isa || thisboard->bustype == pc104)) { (thisboard->bustype == isa || thisboard->bustype == pc104)) {
......
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