summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-03-05 17:23:10 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-11 17:05:22 (GMT)
commit1f388811b54f9f1b78d52237edda1eaea109e900 (patch)
tree665cd69f8ab870a9da5cb1ce4349f1607cba3554
parent3dd98ebe532beb8d6a7ed22e16b8791e455f4e13 (diff)
downloadlinux-fsl-qoriq-1f388811b54f9f1b78d52237edda1eaea109e900.tar.xz
staging: comedi: addi_common: allow driver to set the board_ptr
The addi_apci_035, addi_apci_1500, addi_apci_1564, and addi_apci_3xxx drivers still use the addi_common code. Allow those drivers to set the dev->board_ptr before calling addi_auto_attach(). 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>
-rw-r--r--drivers/staging/comedi/drivers/addi-data/addi_common.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 1051fa5..e9a4b43 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -105,16 +105,19 @@ static int addi_auto_attach(struct comedi_device *dev,
unsigned long context_unused)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- const struct addi_board *this_board;
+ const struct addi_board *this_board = comedi_board(dev);
struct addi_private *devpriv;
struct comedi_subdevice *s;
int ret, n_subdevices;
unsigned int dw_Dummy;
- this_board = addi_find_boardinfo(dev, pcidev);
- if (!this_board)
- return -ENODEV;
- dev->board_ptr = this_board;
+ if (!this_board) {
+ /* The driver did not set the board_ptr, try finding it. */
+ this_board = addi_find_boardinfo(dev, pcidev);
+ if (!this_board)
+ return -ENODEV;
+ dev->board_ptr = this_board;
+ }
dev->board_name = this_board->pc_DriverName;
devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);