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

staging: comedi: amplc_dio200: add helpers to get board layout

Add inline helper function `dio200_board_layout(board)` to get a pointer
to the board layout data for a board.  Add inline helper function
`dio200_dev_layout(dev)` to get a pointer to the board layout data for a
comedi device (this function is currently unused but will be used by a
later change).
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4821bdfc
...@@ -442,6 +442,18 @@ struct dio200_subdev_intr { ...@@ -442,6 +442,18 @@ struct dio200_subdev_intr {
int continuous; int continuous;
}; };
static inline const struct dio200_layout *
dio200_board_layout(const struct dio200_board *board)
{
return &dio200_layouts[board->layout];
}
static inline const struct dio200_layout *
dio200_dev_layout(struct comedi_device *dev)
{
return dio200_board_layout(comedi_board(dev));
}
static inline bool is_pci_board(const struct dio200_board *board) static inline bool is_pci_board(const struct dio200_board *board)
{ {
return DO_PCI && board->bustype == pci_bustype; return DO_PCI && board->bustype == pci_bustype;
...@@ -1195,7 +1207,7 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase, ...@@ -1195,7 +1207,7 @@ static int dio200_common_attach(struct comedi_device *dev, unsigned long iobase,
{ {
const struct dio200_board *thisboard = comedi_board(dev); const struct dio200_board *thisboard = comedi_board(dev);
struct dio200_private *devpriv = dev->private; struct dio200_private *devpriv = dev->private;
const struct dio200_layout *layout = &dio200_layouts[thisboard->layout]; const struct dio200_layout *layout = dio200_board_layout(thisboard);
struct comedi_subdevice *s; struct comedi_subdevice *s;
int sdx; int sdx;
unsigned int n; unsigned int n;
...@@ -1353,7 +1365,7 @@ static void dio200_detach(struct comedi_device *dev) ...@@ -1353,7 +1365,7 @@ static void dio200_detach(struct comedi_device *dev)
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
if (dev->subdevices) { if (dev->subdevices) {
layout = &dio200_layouts[thisboard->layout]; layout = dio200_board_layout(thisboard);
for (n = 0; n < dev->n_subdevices; n++) { for (n = 0; n < dev->n_subdevices; n++) {
struct comedi_subdevice *s = &dev->subdevices[n]; struct comedi_subdevice *s = &dev->subdevices[n];
switch (layout->sdtype[n]) { switch (layout->sdtype[n]) {
......
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