Skip to content

Commit

Permalink
staging: comedi: amplc_pci224: Remove thisboard and devpriv macros
Browse files Browse the repository at this point in the history
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: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Jun 5, 2012
1 parent 01ea83b commit 9dc5a82
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions drivers/staging/comedi/drivers/amplc_pci224.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,6 @@ static const struct pci224_board pci224_boards[] = {
},
};

/*
* Useful for shorthand access to the particular board structure
*/
#define thisboard ((struct pci224_board *)dev->board_ptr)

/* this structure is for data unique to this hardware driver. If
several hardware drivers keep similar information in this structure,
feel free to suggest moving the variable to the struct comedi_device struct. */
Expand All @@ -405,15 +400,15 @@ struct pci224_private {
unsigned char intsce;
};

#define devpriv ((struct pci224_private *)dev->private)

/*
* Called from the 'insn_write' function to perform a single write.
*/
static void
pci224_ao_set_data(struct comedi_device *dev, int chan, int range,
unsigned int data)
{
const struct pci224_board *thisboard = comedi_board(dev);
struct pci224_private *devpriv = dev->private;
unsigned short mangled;

/* Store unmangled data for readback. */
Expand Down Expand Up @@ -476,6 +471,7 @@ static int
pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
struct pci224_private *devpriv = dev->private;
int i;
int chan;

Expand Down Expand Up @@ -504,6 +500,7 @@ pci224_cascade_ns_to_timer(int osc_base, unsigned int *d1, unsigned int *d2,
static void pci224_ao_stop(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct pci224_private *devpriv = dev->private;
unsigned long flags;

if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state))
Expand Down Expand Up @@ -547,6 +544,7 @@ static void pci224_ao_stop(struct comedi_device *dev,
static void pci224_ao_start(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct pci224_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned long flags;

Expand Down Expand Up @@ -575,6 +573,7 @@ static void pci224_ao_start(struct comedi_device *dev,
static void pci224_ao_handle_fifo(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct pci224_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int num_scans;
unsigned int room;
Expand Down Expand Up @@ -721,6 +720,7 @@ static int
pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
struct pci224_private *devpriv = dev->private;
int err = 0;
unsigned int tmp;

Expand Down Expand Up @@ -991,6 +991,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
*/
static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
struct pci224_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
int range;
unsigned int i, j;
Expand Down Expand Up @@ -1163,6 +1164,8 @@ static void
pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
void *data, unsigned int num_bytes, unsigned int chan_index)
{
const struct pci224_board *thisboard = comedi_board(dev);
struct pci224_private *devpriv = dev->private;
struct comedi_async *async = s->async;
short *array = data;
unsigned int length = num_bytes / sizeof(*array);
Expand Down Expand Up @@ -1193,6 +1196,7 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s,
static irqreturn_t pci224_interrupt(int irq, void *d)
{
struct comedi_device *dev = d;
struct pci224_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0];
struct comedi_cmd *cmd;
unsigned char intstat, valid_intstat;
Expand Down Expand Up @@ -1258,6 +1262,7 @@ static const struct pci224_board
static struct pci_dev *
pci224_find_pci(struct comedi_device *dev, int bus, int slot)
{
const struct pci224_board *thisboard = comedi_board(dev);
struct pci_dev *pci_dev = NULL;

/* Look for matching PCI device. */
Expand All @@ -1279,6 +1284,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot)
continue;
/* Change board_ptr to matched board. */
dev->board_ptr = board_ptr;
thisboard = comedi_board(dev);
} else {
/* Match specific model name. */
if (thisboard->devid != pci_dev->device)
Expand All @@ -1302,6 +1308,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot)

static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
{
struct pci224_private *devpriv = dev->private;
char tmpbuf[30];

if (irq)
Expand All @@ -1319,6 +1326,8 @@ static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
static int pci224_attach_common(struct comedi_device *dev,
struct pci_dev *pci_dev, int *options)
{
const struct pci224_board *thisboard = comedi_board(dev);
struct pci224_private *devpriv = dev->private;
struct comedi_subdevice *s;
unsigned int irq;
unsigned n;
Expand Down Expand Up @@ -1516,6 +1525,8 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)

static void pci224_detach(struct comedi_device *dev)
{
struct pci224_private *devpriv = dev->private;

if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices) {
Expand Down

0 comments on commit 9dc5a82

Please sign in to comment.