staging: comedi: das08: Use struct comedi_device hw_dev for PCI
Remove the pointer to the PCI device from the private data `struct das08_private_struct`. Use `comedi_set_hw_dev()` to save a pointer to the PCI device (actually, its embedded `struct device`) and `comedi_to_pci_dev()` to retrieve it. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c396147048
commit
40a3ee02f8
2 changed files with 4 additions and 7 deletions
|
@ -778,7 +778,6 @@ das08_find_pci_board(struct pci_dev *pdev)
|
|||
static int __devinit __maybe_unused
|
||||
das08_attach_pci(struct comedi_device *dev, struct pci_dev *pdev)
|
||||
{
|
||||
struct das08_private_struct *devpriv;
|
||||
unsigned long iobase;
|
||||
int ret;
|
||||
|
||||
|
@ -793,8 +792,7 @@ das08_attach_pci(struct comedi_device *dev, struct pci_dev *pdev)
|
|||
dev_err(dev->class_dev, "BUG! cannot determine board type!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
devpriv = dev->private;
|
||||
devpriv->pdev = pdev;
|
||||
comedi_set_hw_dev(dev, &pdev->dev);
|
||||
/* enable PCI device and reserve I/O spaces */
|
||||
if (comedi_pci_enable(pdev, dev->driver->driver_name)) {
|
||||
dev_err(dev->class_dev,
|
||||
|
@ -847,16 +845,16 @@ EXPORT_SYMBOL_GPL(das08_common_detach);
|
|||
static void __maybe_unused das08_detach(struct comedi_device *dev)
|
||||
{
|
||||
const struct das08_board_struct *thisboard = comedi_board(dev);
|
||||
struct das08_private_struct *devpriv = dev->private;
|
||||
|
||||
das08_common_detach(dev);
|
||||
if (is_isa_board(thisboard)) {
|
||||
if (dev->iobase)
|
||||
release_region(dev->iobase, thisboard->iosize);
|
||||
} else if (is_pci_board(thisboard)) {
|
||||
if (devpriv && devpriv->pdev) {
|
||||
struct pci_dev *pdev = comedi_to_pci_dev(dev);
|
||||
if (pdev) {
|
||||
if (dev->iobase)
|
||||
comedi_pci_disable(devpriv->pdev);
|
||||
comedi_pci_disable(pdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ struct das08_private_struct {
|
|||
unsigned int do_mux_bits; /* bits for do/mux register on boards without separate do register */
|
||||
unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */
|
||||
const unsigned int *pg_gainlist;
|
||||
struct pci_dev *pdev; /* struct for pci-das08 */
|
||||
unsigned int ao_readback[2]; /* assume 2 AO channels */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue