From 40a3ee02f8ce9ecdc1ea085d0b59502baa8976c3 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 5 Sep 2012 11:02:40 +0100 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/das08.c | 10 ++++------ drivers/staging/comedi/drivers/das08.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index 2614961bb14f..0c69b05fceb7 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -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); } } } diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index 4231be553c0d..0314baebae39 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -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 */ }; -- 2.30.2