From: H Hartley Sweeten Date: Mon, 29 Oct 2012 17:01:46 +0000 (-0700) Subject: staging: comedi: rtd520: cleanup pci bar ioremap X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fd711905579fccbbd4b020fd054dfcc4021f15b6;p=openwrt%2Fstaging%2Fblogic.git staging: comedi: rtd520: cleanup pci bar ioremap Use the size returned by pci_resource_len() when ioremap'ing the pci bars instead of assuming a size. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index fc0b1337a471..e33a233d42c1 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -147,18 +147,6 @@ Configuration options: Board specific stuff ======================================================================*/ -/* - The board has three memory windows: las0, las1, and lcfg (the PCI chip) - Las1 has the data and can be burst DMAed 32bits at a time. -*/ -#define LCFG_PCIINDEX 0 -/* PCI region 1 is a 256 byte IO space mapping. Use??? */ -#define LAS0_PCIINDEX 2 /* PCI memory resources */ -#define LAS1_PCIINDEX 3 -#define LCFG_PCISIZE 0x100 -#define LAS0_PCISIZE 0x200 -#define LAS1_PCISIZE 0x10 - #define RTD_CLOCK_RATE 8000000 /* 8Mhz onboard clock */ #define RTD_CLOCK_BASE 125 /* clock period in ns */ @@ -1591,7 +1579,6 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct rtdPrivate *devpriv; struct pci_dev *pcidev; struct comedi_subdevice *s; - resource_size_t pci_base; int ret; #ifdef USE_DMA int index; @@ -1626,13 +1613,12 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->iobase = 1; /* the "detach" needs this */ - /* Initialize the base addresses */ - pci_base = pci_resource_start(pcidev, LAS0_PCIINDEX); - devpriv->las0 = ioremap_nocache(pci_base, LAS0_PCISIZE); - pci_base = pci_resource_start(pcidev, LAS1_PCIINDEX); - devpriv->las1 = ioremap_nocache(pci_base, LAS1_PCISIZE); - pci_base = pci_resource_start(pcidev, LCFG_PCIINDEX); - devpriv->lcfg = ioremap_nocache(pci_base, LCFG_PCISIZE); + devpriv->las0 = ioremap_nocache(pci_resource_start(pcidev, 2), + pci_resource_len(pcidev, 2)); + devpriv->las1 = ioremap_nocache(pci_resource_start(pcidev, 3), + pci_resource_len(pcidev, 3)); + devpriv->lcfg = ioremap_nocache(pci_resource_start(pcidev, 0), + pci_resource_len(pcidev, 0)); if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) return -ENOMEM;