From ef81f55b07c2efe80d0ea80527426ef319a4a5e7 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 20 Apr 2016 10:36:34 -0700 Subject: [PATCH] staging: comedi: mite: remove mite_struct member 'daq_phys_addr' This member of mite_struct is only used to map the mite I/O window. For aesthetics, remove it and use a local variable instead. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/mite.c | 7 ++++--- drivers/staging/comedi/drivers/mite.h | 1 - drivers/staging/comedi/drivers/ni_pcimio.c | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index a795842f7f2a..6f31796f5bbf 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -93,6 +93,7 @@ static unsigned int mite_fifo_size(struct mite_struct *mite, int mite_setup2(struct comedi_device *dev, struct mite_struct *mite, bool use_win1) { + resource_size_t daq_phys_addr; unsigned long length; int i; u32 csigr_bits; @@ -113,19 +114,19 @@ int mite_setup2(struct comedi_device *dev, "Failed to remap daq io memory address\n"); return -ENOMEM; } - mite->daq_phys_addr = pci_resource_start(mite->pcidev, 1); + daq_phys_addr = pci_resource_start(mite->pcidev, 1); length = pci_resource_len(mite->pcidev, 1); if (use_win1) { writel(0, mite->mite_io_addr + MITE_IODWBSR); dev_info(dev->class_dev, "using I/O Window Base Size register 1\n"); - writel(mite->daq_phys_addr | WENAB | + writel(daq_phys_addr | WENAB | MITE_IODWBSR_1_WSIZE_bits(length), mite->mite_io_addr + MITE_IODWBSR_1); writel(0, mite->mite_io_addr + MITE_IODWCR_1); } else { - writel(mite->daq_phys_addr | WENAB, + writel(daq_phys_addr | WENAB, mite->mite_io_addr + MITE_IODWBSR); } /* diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 95d3c1369913..394829957ed9 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -55,7 +55,6 @@ struct mite_channel { struct mite_struct { struct pci_dev *pcidev; void __iomem *mite_io_addr; - resource_size_t daq_phys_addr; struct mite_channel channels[MAX_MITE_DMA_CHANNELS]; short channel_allocated[MAX_MITE_DMA_CHANNELS]; int num_channels; diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 231e37d6b7c6..4028b6f51abb 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -1061,6 +1061,7 @@ static int pcimio_dio_change(struct comedi_device *dev, static void m_series_init_eeprom_buffer(struct comedi_device *dev) { struct ni_private *devpriv = dev->private; + resource_size_t daq_phys_addr; static const int Start_Cal_EEPROM = 0x400; static const unsigned window_size = 10; static const int serial_number_eeprom_offset = 0x4; @@ -1070,11 +1071,14 @@ static void m_series_init_eeprom_buffer(struct comedi_device *dev) unsigned old_iodwcr1_bits; int i; + /* IO Window 1 needs to be temporarily mapped to read the eeprom */ + daq_phys_addr = pci_resource_start(devpriv->mite->pcidev, 1); + old_iodwbsr_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR); old_iodwbsr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWBSR_1); old_iodwcr1_bits = readl(devpriv->mite->mite_io_addr + MITE_IODWCR_1); writel(0x0, devpriv->mite->mite_io_addr + MITE_IODWBSR); - writel(((0x80 | window_size) | devpriv->mite->daq_phys_addr), + writel(((0x80 | window_size) | daq_phys_addr), devpriv->mite->mite_io_addr + MITE_IODWBSR_1); writel(0x1 | old_iodwcr1_bits, devpriv->mite->mite_io_addr + MITE_IODWCR_1); -- 2.20.1