staging: comedi: amplc_pci230: Add attach_pci() hook
commitba54fa6893aa72159c046c6099f7644df745feea
authorIan Abbott <abbotti@mev.co.uk>
Fri, 1 Jun 2012 16:31:41 +0000 (1 17:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2012 03:50:49 +0000 (4 20:50 -0700)
tree5c8403a370014d02210a931c124ba6356ae8c9f7
parent967bfbc2c90e456bdfc0ef045dd1e81221461c06
staging: comedi: amplc_pci230: Add attach_pci() hook

Implement the attach_pci() hook as function pci230_attach_pci().  This
is called by comedi_pci_auto_config() in preference to the old attach()
hook (implemented by pci230_attach() and still required for "manual"
configuration of comedi devices).  The advantage of the attach_pci()
hook is that it avoids searching for the PCI device.

Refactor pci230_attach() and factor out code common to pci230_attach()
and pci230_attach_pci() into new functions pci230_match_pci_board(),
pci230_find_pci_board(), pci230_find_pci(), pci230_alloc_private() and
pci230_attach_common().

Finally, move pci230_attach() and pci230_detach() along with all the new
functions towards the bottom of the file as it makes the patch much
cleaner (though longer) and I plan to move things around soon to get
rid of the remaining forward references.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/amplc_pci230.c