lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 18 Jul 2012 18:44:43 -0700 From: H Hartley Sweeten <hartleys@...ionengravers.com> To: Linux Kernel <linux-kernel@...r.kernel.org> CC: <devel@...verdev.osuosl.org>, <abbotti@....co.uk>, <gregkh@...uxfoundation.org> Subject: [PATCH 44/90] staging: comedi: cb_pcidda: store the pci_dev in the comedi_device Use the hw_dev pointer in the comedi_device struct to hold the pci_dev instead of carrying it in the private data. Save the pci bar in dev->iobase so the detach is consistent with the other comedi pci drivers. Signed-off-by: H Hartley Sweeten <hsweeten@...ionengravers.com> Cc: Ian Abbott <abbotti@....co.uk> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org> --- drivers/staging/comedi/drivers/cb_pcidda.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index 3567f4a..12660a3 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -216,9 +216,6 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = { struct cb_pcidda_private { int data; - /* would be useful for a PCI device */ - struct pci_dev *pci_dev; - unsigned long digitalio; unsigned long dac; @@ -306,7 +303,7 @@ static int cb_pcidda_attach(struct comedi_device *dev, pcidev = cb_pcidda_find_pci_dev(dev, it); if (!pcidev) return -EIO; - devpriv->pci_dev = pcidev; + comedi_set_hw_dev(dev, &pcidev->dev); /* * Enable PCI device and request regions. @@ -320,9 +317,9 @@ static int cb_pcidda_attach(struct comedi_device *dev, /* * Allocate the I/O ports. */ - devpriv->digitalio = - pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); - devpriv->dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); + devpriv->digitalio = pci_resource_start(pcidev, DIGITALIO_BADRINDEX); + devpriv->dac = pci_resource_start(pcidev, DAC_BADRINDEX); + dev->iobase = devpriv->dac; /* * Warn about the status of the driver. @@ -377,12 +374,12 @@ static int cb_pcidda_attach(struct comedi_device *dev, static void cb_pcidda_detach(struct comedi_device *dev) { - if (devpriv) { - if (devpriv->pci_dev) { - if (devpriv->dac) - comedi_pci_disable(devpriv->pci_dev); - pci_dev_put(devpriv->pci_dev); - } + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + pci_dev_put(pcidev); } if (dev->subdevices) { subdev_8255_cleanup(dev, dev->subdevices + 1); -- 1.7.11 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists