[PATCH 19/48] staging: comedi: pcmmio: tidy up init_asics()

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

 



Rename this function so it has namespace associated with the driver.

The board supported by this driver only has one WinSystems WS16C48 asic
on it that handles the digital i/o. Remove the unnecessary for () loop
that would reset multiple asics.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcmmio.c | 51 +++++++++++++++------------------
 1 file changed, 23 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c
index 3e3f4c9..af06062 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -370,35 +370,30 @@ static void switch_page(struct comedi_device *dev, int page)
 	outb(page << REG_PAGE_BITOFFSET, devpriv->asic_iobase + REG_PAGELOCK);
 }
 
-static void init_asics(struct comedi_device *dev)
-{				/* sets up an
-				   ASIC chip to defaults */
+static void pcmmio_reset(struct comedi_device *dev)
+{
 	struct pcmmio_private *devpriv = dev->private;
-	int asic;
-
-	for (asic = 0; asic < 1; ++asic) {
-		int port, page;
-		unsigned long baseaddr = devpriv->asic_iobase;
-
-		switch_page(dev, 0);	/* switch back to page 0 */
-
-		/* first, clear all the DIO port bits */
-		for (port = 0; port < PORTS_PER_ASIC; ++port)
-			outb(0, baseaddr + REG_PORT0 + port);
-
-		/* Next, clear all the paged registers for each page */
-		for (page = 1; page < NUM_PAGES; ++page) {
-			int reg;
-			/* now clear all the paged registers */
-			switch_page(dev, page);
-			for (reg = FIRST_PAGED_REG;
-			     reg < FIRST_PAGED_REG + NUM_PAGED_REGS; ++reg)
-				outb(0, baseaddr + reg);
-		}
-
-		/* switch back to default page 0 */
-		switch_page(dev, 0);
+	unsigned long baseaddr = devpriv->asic_iobase;
+	int port, page;
+
+	switch_page(dev, 0);	/* switch back to page 0 */
+
+	/* first, clear all the DIO port bits */
+	for (port = 0; port < PORTS_PER_ASIC; ++port)
+		outb(0, baseaddr + REG_PORT0 + port);
+
+	/* Next, clear all the paged registers for each page */
+	for (page = 1; page < NUM_PAGES; ++page) {
+		int reg;
+		/* now clear all the paged registers */
+		switch_page(dev, page);
+		for (reg = FIRST_PAGED_REG;
+		     reg < FIRST_PAGED_REG + NUM_PAGED_REGS; ++reg)
+			outb(0, baseaddr + reg);
 	}
+
+	/* switch back to default page 0 */
+	switch_page(dev, 0);
 }
 
 static void pcmmio_stop_intr(struct comedi_device *dev,
@@ -1073,7 +1068,7 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 	}
 
-	init_asics(dev);	/* clear out all the registers, basically */
+	pcmmio_reset(dev);
 
 	if (it->options[1]) {
 		ret = request_irq(it->options[1], interrupt_pcmmio, 0,
-- 
1.8.4.4

_______________________________________________
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