Commit ca4d4aa6 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_atmio: fix build errors

The following commits introduced a couple build errors in this driver
due to the removal of some macros in ni_stc.h.

commit: f5a1d92b "staging: comedi: ni_stc.h: remove n_ni_boards macro"
commit: 6293e357 "staging: comedi: ni_stc.h: remove boardtype macro"

The n_ni_boards macro is an open coded version of ARRAY_SIZE.

The boardtype macro is removed in favor of using the comedi_board()
helper and accessing the boardinfo with a pointer.

Fix both issues.
Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f4309c0f
...@@ -350,7 +350,7 @@ static int ni_isapnp_find_board(struct pnp_dev **dev) ...@@ -350,7 +350,7 @@ static int ni_isapnp_find_board(struct pnp_dev **dev)
struct pnp_dev *isapnp_dev = NULL; struct pnp_dev *isapnp_dev = NULL;
int i; int i;
for (i = 0; i < n_ni_boards; i++) { for (i = 0; i < ARRAY_SIZE(ni_boards); i++) {
isapnp_dev = pnp_find_dev(NULL, isapnp_dev = pnp_find_dev(NULL,
ISAPNP_VENDOR('N', 'I', 'C'), ISAPNP_VENDOR('N', 'I', 'C'),
ISAPNP_FUNCTION(ni_boards[i]. ISAPNP_FUNCTION(ni_boards[i].
...@@ -377,7 +377,7 @@ static int ni_isapnp_find_board(struct pnp_dev **dev) ...@@ -377,7 +377,7 @@ static int ni_isapnp_find_board(struct pnp_dev **dev)
} }
break; break;
} }
if (i == n_ni_boards) if (i == ARRAY_SIZE(ni_boards))
return -ENODEV; return -ENODEV;
*dev = isapnp_dev; *dev = isapnp_dev;
return 0; return 0;
...@@ -388,7 +388,7 @@ static int ni_getboardtype(struct comedi_device *dev) ...@@ -388,7 +388,7 @@ static int ni_getboardtype(struct comedi_device *dev)
int device_id = ni_read_eeprom(dev, 511); int device_id = ni_read_eeprom(dev, 511);
int i; int i;
for (i = 0; i < n_ni_boards; i++) { for (i = 0; i < ARRAY_SIZE(ni_boards); i++) {
if (ni_boards[i].device_id == device_id) if (ni_boards[i].device_id == device_id)
return i; return i;
...@@ -406,6 +406,7 @@ static int ni_getboardtype(struct comedi_device *dev) ...@@ -406,6 +406,7 @@ static int ni_getboardtype(struct comedi_device *dev)
static int ni_atmio_attach(struct comedi_device *dev, static int ni_atmio_attach(struct comedi_device *dev,
struct comedi_devconfig *it) struct comedi_devconfig *it)
{ {
const struct ni_board_struct *boardtype;
struct ni_private *devpriv; struct ni_private *devpriv;
struct pnp_dev *isapnp_dev; struct pnp_dev *isapnp_dev;
int ret; int ret;
...@@ -466,9 +467,10 @@ static int ni_atmio_attach(struct comedi_device *dev, ...@@ -466,9 +467,10 @@ static int ni_atmio_attach(struct comedi_device *dev,
return -EIO; return -EIO;
dev->board_ptr = ni_boards + board; dev->board_ptr = ni_boards + board;
boardtype = comedi_board(dev)
printk(" %s", boardtype.name); printk(" %s", boardtype->name);
dev->board_name = boardtype.name; dev->board_name = boardtype->name;
/* irq stuff */ /* irq stuff */
......
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