staging: comedi: mite: remove mite_struct member 'daq_phys_addr'
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 20 Apr 2016 17:36:34 +0000 (10:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Apr 2016 05:18:51 +0000 (22:18 -0700)
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@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/mite.c
drivers/staging/comedi/drivers/mite.h
drivers/staging/comedi/drivers/ni_pcimio.c

index a795842f7f2a773b855c37ecbd3adb3f9d73fbc3..6f31796f5bbf666b5eb920df1b8da9f86a44403d 100644 (file)
@@ -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);
        }
        /*
index 95d3c1369913790a8a7a48202c3fd716ca156d86..394829957ed9528fda61daacbeb764152e3344a3 100644 (file)
@@ -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;
index 231e37d6b7c61f9eb32c70a7dbc1d9ad81a4f192..4028b6f51abb6cb32d94e866b206667e6570a1e6 100644 (file)
@@ -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);