[PATCH 06/15] staging: comedi: mite: remove mite_struct member 'daq_phys_addr'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 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 a795842..6f31796 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 95d3c13..3948299 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 231e37d..4028b6f 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.6.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux