Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 317081
b: refs/heads/master
c: a28b599
h: refs/heads/master
i:
  317079: 34e980b
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jun 5, 2012
1 parent ac6c046 commit 4c3fde2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5016e242b3ca919e3be7fa98dbb2b35e61c1efe
refs/heads/master: a28b59957d3ad01481c2ea87aca50cfdb85417f2
38 changes: 19 additions & 19 deletions trunk/drivers/staging/comedi/drivers/pcmuio.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,6 @@ struct pcmuio_board {
const int num_ports;
};

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

/* this structure is for data unique to this subdevice. */
struct pcmuio_subdev_private {
/* mapping of halfwords (bytes) in port/chanarray to iobase */
Expand Down Expand Up @@ -354,7 +349,9 @@ static int pcmuio_dio_insn_config(struct comedi_device *dev,

static void switch_page(struct comedi_device *dev, int asic, int page)
{
if (asic < 0 || asic >= thisboard->num_asics)
const struct pcmuio_board *board = comedi_board(dev);

if (asic < 0 || asic >= board->num_asics)
return; /* paranoia */
if (page < 0 || page >= NUM_PAGES)
return; /* more paranoia */
Expand All @@ -370,9 +367,10 @@ static void switch_page(struct comedi_device *dev, int asic, int page)
static void init_asics(struct comedi_device *dev)
{ /* sets up an
ASIC chip to defaults */
const struct pcmuio_board *board = comedi_board(dev);
int asic;

for (asic = 0; asic < thisboard->num_asics; ++asic) {
for (asic = 0; asic < board->num_asics; ++asic) {
int port, page;
unsigned long baseaddr = dev->iobase + asic * ASIC_IOSIZE;

Expand Down Expand Up @@ -407,7 +405,9 @@ static void init_asics(struct comedi_device *dev)
#ifdef notused
static void lock_port(struct comedi_device *dev, int asic, int port)
{
if (asic < 0 || asic >= thisboard->num_asics)
const struct pcmuio_board *board = comedi_board(dev);

if (asic < 0 || asic >= board->num_asics)
return; /* paranoia */
if (port < 0 || port >= PORTS_PER_ASIC)
return; /* more paranoia */
Expand All @@ -420,7 +420,9 @@ static void lock_port(struct comedi_device *dev, int asic, int port)

static void unlock_port(struct comedi_device *dev, int asic, int port)
{
if (asic < 0 || asic >= thisboard->num_asics)
const struct pcmuio_board *board = comedi_board(dev);

if (asic < 0 || asic >= board->num_asics)
return; /* paranoia */
if (port < 0 || port >= PORTS_PER_ASIC)
return; /* more paranoia */
Expand Down Expand Up @@ -747,6 +749,7 @@ pcmuio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,

static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
const struct pcmuio_board *board = comedi_board(dev);
struct comedi_subdevice *s;
int sdev_no, chans_left, n_subdevs, port, asic, thisasic_chanct = 0;
unsigned long iobase;
Expand All @@ -762,17 +765,13 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
dev->iobase = iobase;

if (!iobase || !request_region(iobase,
thisboard->num_asics * ASIC_IOSIZE,
board->num_asics * ASIC_IOSIZE,
dev->driver->driver_name)) {
dev_err(dev->hw_dev, "I/O port conflict\n");
return -EIO;
}

/*
* Initialize dev->board_name. Note that we can use the "thisboard"
* macro now, since we just initialized it in the last line.
*/
dev->board_name = thisboard->name;
dev->board_name = board->name;

/*
* Allocate the private structure area. alloc_private() is a
Expand All @@ -792,7 +791,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
spin_lock_init(&devpriv->asics[asic].spinlock);
}

chans_left = CHANS_PER_ASIC * thisboard->num_asics;
chans_left = CHANS_PER_ASIC * board->num_asics;
n_subdevs = CALC_N_SUBDEVS(chans_left);
devpriv->sprivs =
kcalloc(n_subdevs, sizeof(struct pcmuio_subdev_private),
Expand Down Expand Up @@ -881,7 +880,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
for (asic = 0; irq[0] && asic < MAX_ASICS; ++asic) {
if (irq[asic]
&& request_irq(irq[asic], interrupt_pcmuio,
IRQF_SHARED, thisboard->name, dev)) {
IRQF_SHARED, board->name, dev)) {
int i;
/* unroll the allocated irqs.. */
for (i = asic - 1; i >= 0; --i) {
Expand All @@ -898,7 +897,7 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)

if (irq[0]) {
dev_dbg(dev->hw_dev, "irq: %u\n", irq[0]);
if (irq[1] && thisboard->num_asics == 2)
if (irq[1] && board->num_asics == 2)
dev_dbg(dev->hw_dev, "second ASIC irq: %u\n", irq[1]);
} else {
dev_dbg(dev->hw_dev, "(IRQ mode disabled)\n");
Expand All @@ -910,10 +909,11 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)

static void pcmuio_detach(struct comedi_device *dev)
{
const struct pcmuio_board *board = comedi_board(dev);
int i;

if (dev->iobase)
release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics);
release_region(dev->iobase, ASIC_IOSIZE * board->num_asics);
for (i = 0; i < MAX_ASICS; ++i) {
if (devpriv->asics[i].irq)
free_irq(devpriv->asics[i].irq, dev);
Expand Down

0 comments on commit 4c3fde2

Please sign in to comment.