Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a26f4dd0 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2724f018
Loading
Loading
Loading
Loading
+10 −16
Original line number Original line Diff line number Diff line
@@ -1619,9 +1619,8 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	struct rtdPrivate *devpriv;
	struct rtdPrivate *devpriv;
	struct pci_dev *pcidev;
	struct pci_dev *pcidev;
	struct comedi_subdevice *s;
	struct comedi_subdevice *s;
	resource_size_t pci_base;
	int ret;
	int ret;
	resource_size_t physLas1;	/* data area */
	resource_size_t physLcfg;	/* PLX9080 */
#ifdef USE_DMA
#ifdef USE_DMA
	int index;
	int index;
#endif
#endif
@@ -1655,20 +1654,15 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
		printk(KERN_INFO "Failed to enable PCI device and request regions.\n");
		printk(KERN_INFO "Failed to enable PCI device and request regions.\n");
		return ret;
		return ret;
	}
	}
	dev->iobase = 1;	/* the "detach" needs this */


	/*
	/* Initialize the base addresses */
	 * Initialize base addresses
	pci_base = pci_resource_start(pcidev, LAS0_PCIINDEX);
	 */
	devpriv->las0 = ioremap_nocache(pci_base, LAS0_PCISIZE);
	/* Get the physical address from PCI config */
	pci_base = pci_resource_start(pcidev, LAS1_PCIINDEX);
	dev->iobase = pci_resource_start(pcidev, LAS0_PCIINDEX);
	devpriv->las1 = ioremap_nocache(pci_base, LAS1_PCISIZE);
	physLas1 = pci_resource_start(pcidev, LAS1_PCIINDEX);
	pci_base = pci_resource_start(pcidev, LCFG_PCIINDEX);
	physLcfg = pci_resource_start(pcidev, LCFG_PCIINDEX);
	devpriv->lcfg = ioremap_nocache(pci_base, LCFG_PCISIZE);
	/* Now have the kernel map this into memory */
	/* ASSUME page aligned */
	devpriv->las0 = ioremap_nocache(dev->iobase, LAS0_PCISIZE);
	devpriv->las1 = ioremap_nocache(physLas1, LAS1_PCISIZE);
	devpriv->lcfg = ioremap_nocache(physLcfg, LCFG_PCISIZE);

	if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg)
	if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg)
		return -ENOMEM;
		return -ENOMEM;