Commit 19d6ce54 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: jr3_pci: remove devpriv->pci_dev

The `pci_dev` member of `struct jr3_pci_dev_private` is used to point to
the `struct pci_dev`.  This is redundant as the `struct comedi_device`
already has a pointer to the `struct device` within the `struct pci_dev`
and there is a convenient inline function, `comedi_to_pci_dev(dev)` that
returns a pointer to the `struct pci_dev`.

Remove the redundant `pci_dev` member and use alternate ways to get at
the `struct pci_dev`.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6af0cf76
...@@ -59,8 +59,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci) ...@@ -59,8 +59,6 @@ Devices: [JR3] PCI force sensor board (jr3_pci)
#define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114 #define PCI_DEVICE_ID_JR3_4_CHANNEL 0x3114
struct jr3_pci_dev_private { struct jr3_pci_dev_private {
struct pci_dev *pci_dev;
int pci_enabled; int pci_enabled;
struct jr3_t __iomem *iobase; struct jr3_t __iomem *iobase;
int n_channels; int n_channels;
...@@ -68,7 +66,6 @@ struct jr3_pci_dev_private { ...@@ -68,7 +66,6 @@ struct jr3_pci_dev_private {
}; };
struct poll_delay_t { struct poll_delay_t {
int min; int min;
int max; int max;
}; };
...@@ -98,15 +95,15 @@ struct jr3_pci_subdev_private { ...@@ -98,15 +95,15 @@ struct jr3_pci_subdev_private {
}; };
/* Hotplug firmware loading stuff */ /* Hotplug firmware loading stuff */
static int comedi_load_firmware(struct comedi_device *dev, char *name, static int comedi_load_firmware(struct comedi_device *dev, const char *name,
int (*cb)(struct comedi_device *dev, int (*cb)(struct comedi_device *dev,
const u8 *data, size_t size)) const u8 *data, size_t size))
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
int result = 0; int result = 0;
const struct firmware *fw; const struct firmware *fw;
char *firmware_path; char *firmware_path;
static const char *prefix = "comedi/"; static const char *prefix = "comedi/";
struct jr3_pci_dev_private *devpriv = dev->private;
firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL); firmware_path = kmalloc(strlen(prefix) + strlen(name) + 1, GFP_KERNEL);
if (!firmware_path) { if (!firmware_path) {
...@@ -115,8 +112,7 @@ static int comedi_load_firmware(struct comedi_device *dev, char *name, ...@@ -115,8 +112,7 @@ static int comedi_load_firmware(struct comedi_device *dev, char *name,
firmware_path[0] = '\0'; firmware_path[0] = '\0';
strcat(firmware_path, prefix); strcat(firmware_path, prefix);
strcat(firmware_path, name); strcat(firmware_path, name);
result = request_firmware(&fw, firmware_path, result = request_firmware(&fw, firmware_path, &pcidev->dev);
&devpriv->pci_dev->dev);
if (result == 0) { if (result == 0) {
if (!cb) if (!cb)
result = -EINVAL; result = -EINVAL;
...@@ -785,7 +781,6 @@ static int __devinit jr3_pci_auto_attach(struct comedi_device *dev, ...@@ -785,7 +781,6 @@ static int __devinit jr3_pci_auto_attach(struct comedi_device *dev,
return -EINVAL; return -EINVAL;
break; break;
} }
devpriv->pci_dev = pcidev;
dev->board_name = "jr3_pci"; dev->board_name = "jr3_pci";
result = comedi_pci_enable(pcidev, "jr3_pci"); result = comedi_pci_enable(pcidev, "jr3_pci");
...@@ -899,6 +894,7 @@ static int __devinit jr3_pci_auto_attach(struct comedi_device *dev, ...@@ -899,6 +894,7 @@ static int __devinit jr3_pci_auto_attach(struct comedi_device *dev,
static void jr3_pci_detach(struct comedi_device *dev) static void jr3_pci_detach(struct comedi_device *dev)
{ {
int i; int i;
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct jr3_pci_dev_private *devpriv = dev->private; struct jr3_pci_dev_private *devpriv = dev->private;
if (devpriv) { if (devpriv) {
...@@ -911,7 +907,7 @@ static void jr3_pci_detach(struct comedi_device *dev) ...@@ -911,7 +907,7 @@ static void jr3_pci_detach(struct comedi_device *dev)
if (devpriv->iobase) if (devpriv->iobase)
iounmap(devpriv->iobase); iounmap(devpriv->iobase);
if (devpriv->pci_enabled) if (devpriv->pci_enabled)
comedi_pci_disable(devpriv->pci_dev); comedi_pci_disable(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