diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2012-07-20 13:33:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-07 20:14:54 -0400 |
commit | a26f4dd0ebd18f061366ca0231fdb74210e16140 (patch) | |
tree | cf6dee7a71b855c9d8af2b83b38af7e26c3175a8 | |
parent | 2724f01856fafbe9f76d8e74a564b576b6f02d72 (diff) |
staging: comedi: rtd520: ioremap'ed addresses are resource_size_t
As mentioned by Ian Abbott, the pci address passed to ioremap
should be a resource_size_t not an unsigned long. Use a local
variable of that type to hold the pci_resource_start() that is
passed to ioremp().
Set the dev->iobase to a dummy non-zero value so that the "detach"
can use it as a flag to know that comedi_pci_disable() needs to
be called.
Reported-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/rtd520.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index 112fdc3e9c69..5aa8be1e7b92 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c | |||
@@ -1619,9 +1619,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
1619 | struct rtdPrivate *devpriv; | 1619 | struct rtdPrivate *devpriv; |
1620 | struct pci_dev *pcidev; | 1620 | struct pci_dev *pcidev; |
1621 | struct comedi_subdevice *s; | 1621 | struct comedi_subdevice *s; |
1622 | resource_size_t pci_base; | ||
1622 | int ret; | 1623 | int ret; |
1623 | resource_size_t physLas1; /* data area */ | ||
1624 | resource_size_t physLcfg; /* PLX9080 */ | ||
1625 | #ifdef USE_DMA | 1624 | #ifdef USE_DMA |
1626 | int index; | 1625 | int index; |
1627 | #endif | 1626 | #endif |
@@ -1655,20 +1654,15 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
1655 | printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); | 1654 | printk(KERN_INFO "Failed to enable PCI device and request regions.\n"); |
1656 | return ret; | 1655 | return ret; |
1657 | } | 1656 | } |
1658 | 1657 | dev->iobase = 1; /* the "detach" needs this */ | |
1659 | /* | 1658 | |
1660 | * Initialize base addresses | 1659 | /* Initialize the base addresses */ |
1661 | */ | 1660 | pci_base = pci_resource_start(pcidev, LAS0_PCIINDEX); |
1662 | /* Get the physical address from PCI config */ | 1661 | devpriv->las0 = ioremap_nocache(pci_base, LAS0_PCISIZE); |
1663 | dev->iobase = pci_resource_start(pcidev, LAS0_PCIINDEX); | 1662 | pci_base = pci_resource_start(pcidev, LAS1_PCIINDEX); |
1664 | physLas1 = pci_resource_start(pcidev, LAS1_PCIINDEX); | 1663 | devpriv->las1 = ioremap_nocache(pci_base, LAS1_PCISIZE); |
1665 | physLcfg = pci_resource_start(pcidev, LCFG_PCIINDEX); | 1664 | pci_base = pci_resource_start(pcidev, LCFG_PCIINDEX); |
1666 | /* Now have the kernel map this into memory */ | 1665 | devpriv->lcfg = ioremap_nocache(pci_base, LCFG_PCISIZE); |
1667 | /* ASSUME page aligned */ | ||
1668 | devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE); | ||
1669 | devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE); | ||
1670 | devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE); | ||
1671 | |||
1672 | if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) | 1666 | if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) |
1673 | return -ENOMEM; | 1667 | return -ENOMEM; |
1674 | 1668 | ||