Skip to content

Commit

Permalink
staging: comedi: dt3000: ioremap'ed addresses are resource_size_t
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Aug 8, 2012
1 parent 325a01f commit 2724f01
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/staging/comedi/drivers/dt3000.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
struct comedi_subdevice *s;
resource_size_t pci_base;
int ret = 0;

dev_dbg(dev->class_dev, "dt3000:\n");
Expand All @@ -820,9 +821,10 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
ret = comedi_pci_enable(pcidev, "dt3000");
if (ret < 0)
return ret;
dev->iobase = 1; /* the "detach" needs this */

dev->iobase = pci_resource_start(pcidev, 0);
devpriv->io_addr = ioremap(dev->iobase, DT3000_SIZE);
pci_base = pci_resource_start(pcidev, 0);
devpriv->io_addr = ioremap(pci_base, DT3000_SIZE);
if (!devpriv->io_addr)
return -ENOMEM;

Expand Down

0 comments on commit 2724f01

Please sign in to comment.