Commit 41541704 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: amplc_pci224: 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.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 89ed0731
...@@ -378,7 +378,6 @@ static const struct pci224_board pci224_boards[] = { ...@@ -378,7 +378,6 @@ static const struct pci224_board pci224_boards[] = {
several hardware drivers keep similar information in this structure, several hardware drivers keep similar information in this structure,
feel free to suggest moving the variable to the struct comedi_device struct. */ feel free to suggest moving the variable to the struct comedi_device struct. */
struct pci224_private { struct pci224_private {
struct pci_dev *pci_dev; /* PCI device */
const unsigned short *hwrange; const unsigned short *hwrange;
unsigned long iobase1; unsigned long iobase1;
unsigned long state; unsigned long state;
...@@ -1297,7 +1296,7 @@ static struct pci_dev *pci224_find_pci_dev(struct comedi_device *dev, ...@@ -1297,7 +1296,7 @@ static struct pci_dev *pci224_find_pci_dev(struct comedi_device *dev,
static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
{ {
struct pci224_private *devpriv = dev->private; struct pci_dev *pcidev = comedi_to_pci_dev(dev);
char tmpbuf[30]; char tmpbuf[30];
if (irq) if (irq)
...@@ -1306,7 +1305,7 @@ static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) ...@@ -1306,7 +1305,7 @@ static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
else else
snprintf(tmpbuf, sizeof(tmpbuf), "no irq"); snprintf(tmpbuf, sizeof(tmpbuf), "no irq");
dev_info(dev->class_dev, "%s (pci %s) (%s) attached\n", dev_info(dev->class_dev, "%s (pci %s) (%s) attached\n",
dev->board_name, pci_name(devpriv->pci_dev), tmpbuf); dev->board_name, pci_name(pcidev), tmpbuf);
} }
/* /*
...@@ -1322,7 +1321,8 @@ static int pci224_attach_common(struct comedi_device *dev, ...@@ -1322,7 +1321,8 @@ static int pci224_attach_common(struct comedi_device *dev,
unsigned n; unsigned n;
int ret; int ret;
devpriv->pci_dev = pci_dev; comedi_set_hw_dev(dev, &pci_dev->dev);
ret = comedi_pci_enable(pci_dev, DRIVER_NAME); ret = comedi_pci_enable(pci_dev, DRIVER_NAME);
if (ret < 0) { if (ret < 0) {
dev_err(dev->class_dev, dev_err(dev->class_dev,
...@@ -1509,6 +1509,7 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev) ...@@ -1509,6 +1509,7 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
static void pci224_detach(struct comedi_device *dev) static void pci224_detach(struct comedi_device *dev)
{ {
struct pci224_private *devpriv = dev->private; struct pci224_private *devpriv = dev->private;
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (dev->irq) if (dev->irq)
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
...@@ -1523,11 +1524,11 @@ static void pci224_detach(struct comedi_device *dev) ...@@ -1523,11 +1524,11 @@ static void pci224_detach(struct comedi_device *dev)
kfree(devpriv->ao_readback); kfree(devpriv->ao_readback);
kfree(devpriv->ao_scan_vals); kfree(devpriv->ao_scan_vals);
kfree(devpriv->ao_scan_order); kfree(devpriv->ao_scan_order);
if (devpriv->pci_dev) { }
if (dev->iobase) if (pcidev) {
comedi_pci_disable(devpriv->pci_dev); if (dev->iobase)
pci_dev_put(devpriv->pci_dev); comedi_pci_disable(pcidev);
} pci_dev_put(pcidev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment