Skip to content

Commit

Permalink
staging: comedi: ni_mio_common: remove devpriv macro
Browse files Browse the repository at this point in the history
The ni_mio_common.c file is #include'd by the ni_atmio, ni_mio_cs,
and ni_pcimio drivers. Those drivers all have a devpriv macro of
this type:

This macro relies on a local variable having a specific name.
Remove its use in all the files by replacing it with a local
variable.

Some of the functions in ni_mio_common.c don't always use the
devpriv variable due to differences in how the low-level i/o
is handled by the driver. Tag the variable in those functions
with __maybe_unused to avoid compile warnings.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Oct 22, 2012
1 parent 843690b commit 0e05c55
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 14 deletions.
11 changes: 7 additions & 4 deletions drivers/staging/comedi/drivers/ni_atmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ struct ni_private {

};

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

/* How we access registers */

#define ni_writel(a, b) (outl((a), (b)+dev->iobase))
Expand All @@ -303,6 +301,7 @@ struct ni_private {

static void ni_atmio_win_out(struct comedi_device *dev, uint16_t data, int addr)
{
struct ni_private *devpriv = dev->private;
unsigned long flags;

spin_lock_irqsave(&devpriv->window_lock, flags);
Expand All @@ -317,6 +316,7 @@ static void ni_atmio_win_out(struct comedi_device *dev, uint16_t data, int addr)

static uint16_t ni_atmio_win_in(struct comedi_device *dev, int addr)
{
struct ni_private *devpriv = dev->private;
unsigned long flags;
uint16_t ret;

Expand Down Expand Up @@ -406,16 +406,17 @@ static int ni_getboardtype(struct comedi_device *dev)
static int ni_atmio_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct ni_private *devpriv;
struct pnp_dev *isapnp_dev;
int ret;
unsigned long iobase;
int board;
unsigned int irq;

/* allocate private area */
ret = ni_alloc_private(dev);
if (ret < 0)
if (ret)
return ret;
devpriv = dev->private;

devpriv->stc_writew = &ni_atmio_win_out;
devpriv->stc_readw = &ni_atmio_win_in;
Expand Down Expand Up @@ -499,6 +500,8 @@ static int ni_atmio_attach(struct comedi_device *dev,

static void ni_atmio_detach(struct comedi_device *dev)
{
struct ni_private *devpriv = dev->private;

mio_common_detach(dev);
if (dev->iobase)
release_region(dev->iobase, NI_SIZE);
Expand Down
Loading

0 comments on commit 0e05c55

Please sign in to comment.