From: Chase Southwood <chase.southwood@gmail.com>
To: gregkh@linuxfoundation.org
Cc: abbotti@mev.co.uk, hsweeten@visionengravers.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Chase Southwood <chase.southwood@gmail.com>
Subject: [PATCH 3/4] staging: comedi: addi_apci_1564: absorb apci1564_reset()
Date: Sat, 3 May 2014 02:57:01 -0500 [thread overview]
Message-ID: <1399103821-15915-1-git-send-email-chase.southwood@gmail.com> (raw)
In-Reply-To: <1399103661-14853-1-git-send-email-chase.southwood@gmail.com>
This is the only reset fuction used by this driver. We can remove it from
the boardinfo and absorb the code from hwdrv_apci1564.c into the driver.
Signed-off-by: Chase Southwood <chase.southwood@gmail.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
---
.../comedi/drivers/addi-data/hwdrv_apci1564.c | 32 -------------------
drivers/staging/comedi/drivers/addi_apci_1564.c | 36 ++++++++++++++++++----
2 files changed, 30 insertions(+), 38 deletions(-)
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
index 7976a22a..b3c3f60 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c
@@ -578,35 +578,3 @@ static void apci1564_interrupt(int irq, void *d)
}
return;
}
-
-static int apci1564_reset(struct comedi_device *dev)
-{
- struct addi_private *devpriv = dev->private;
-
- ui_Type = 0;
-
- /* Disable the input interrupts and reset status register */
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG);
- inl(devpriv->i_IobaseAmcc + APCI1564_DI_INT_STATUS_REG);
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE1_REG);
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG);
-
- /* Reset the output channels and disable interrupts */
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
-
- /* Reset the watchdog registers */
- addi_watchdog_reset(devpriv->i_IobaseAmcc + APCI1564_WDOG_REG);
-
- /* Reset the timer registers */
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_CTRL_REG);
- outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_RELOAD_REG);
-
- /* Reset the counter registers */
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER2));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER3));
- outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER4));
-
- return 0;
-}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c
index 31b687c..254889a 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1564.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1564.c
@@ -16,7 +16,6 @@ static const struct addi_board apci1564_boardtypes[] = {
.i_DoMaxdata = 0xffffffff,
.i_Timer = 1,
.interrupt = apci1564_interrupt,
- .reset = apci1564_reset,
.timer_config = apci1564_timer_config,
.timer_write = apci1564_timer_write,
.timer_read = apci1564_timer_read,
@@ -32,11 +31,35 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
return IRQ_RETVAL(1);
}
-static int i_ADDI_Reset(struct comedi_device *dev)
+static int apci1564_reset(struct comedi_device *dev)
{
- const struct addi_board *this_board = comedi_board(dev);
+ struct addi_private *devpriv = dev->private;
+
+ ui_Type = 0;
+
+ /* Disable the input interrupts and reset status register */
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_IRQ_REG);
+ inl(devpriv->i_IobaseAmcc + APCI1564_DI_INT_STATUS_REG);
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE1_REG);
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DI_INT_MODE2_REG);
+
+ /* Reset the output channels and disable interrupts */
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_REG);
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_DO_INT_CTRL_REG);
+
+ /* Reset the watchdog registers */
+ addi_watchdog_reset(devpriv->i_IobaseAmcc + APCI1564_WDOG_REG);
+
+ /* Reset the timer registers */
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_CTRL_REG);
+ outl(0x0, devpriv->i_IobaseAmcc + APCI1564_TIMER_RELOAD_REG);
+
+ /* Reset the counter registers */
+ outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER1));
+ outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER2));
+ outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER3));
+ outl(0x0, dev->iobase + APCI1564_TCW_CTRL_REG(APCI1564_COUNTER4));
- this_board->reset(dev);
return 0;
}
@@ -62,6 +85,8 @@ static int apci1564_auto_attach(struct comedi_device *dev,
dev->iobase = pci_resource_start(pcidev, 1);
devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
+ apci1564_reset(dev);
+
if (pcidev->irq > 0) {
ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED,
dev->board_name, dev);
@@ -114,7 +139,6 @@ static int apci1564_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED;
}
- i_ADDI_Reset(dev);
return 0;
}
@@ -124,7 +148,7 @@ static void apci1564_detach(struct comedi_device *dev)
if (devpriv) {
if (dev->iobase)
- i_ADDI_Reset(dev);
+ apci1564_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
}
--
1.9.0
next prev parent reply other threads:[~2014-05-03 7:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-03 7:54 [PATCH 0/4] staging: comedi: addi_apci_1564: Further cleanups Chase Southwood
2014-05-03 7:55 ` [PATCH 1/4] staging: comedi: addi_apci_1564: board has 32 digital outputs Chase Southwood
2014-05-03 7:56 ` [PATCH 2/4] staging: comedi: addi_apci_1564: don't allocate unused subdevices Chase Southwood
2014-05-03 7:57 ` Chase Southwood [this message]
2014-05-03 7:57 ` [PATCH 4/4] staging: comedi: addi_apci_1564: call apci1564_interrupt() directly Chase Southwood
2014-05-05 16:46 ` [PATCH 0/4] staging: comedi: addi_apci_1564: Further cleanups Hartley Sweeten
2014-05-06 9:19 ` Ian Abbott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399103821-15915-1-git-send-email-chase.southwood@gmail.com \
--to=chase.southwood@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).