From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 7CDD18F79F for ; Thu, 27 Jun 2013 16:10:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 74DD7A02D7 for ; Thu, 27 Jun 2013 16:10:05 +0000 (UTC) Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id d1bwId+GAtpG for ; Thu, 27 Jun 2013 16:09:56 +0000 (UTC) Received: from mail.mev.co.uk (mail.mev.co.uk [62.49.15.74]) by hemlock.osuosl.org (Postfix) with ESMTP id AA6EAA02E3 for ; Thu, 27 Jun 2013 16:09:06 +0000 (UTC) From: Ian Abbott Subject: [PATCH v2] staging: comedi: ni_labpc: change VIRT_TO_BUS dependency Date: Thu, 27 Jun 2013 17:08:47 +0100 Message-Id: <1372349327-32705-1-git-send-email-abbotti@mev.co.uk> In-Reply-To: <51920B8E.4020101@mev.co.uk> References: <51920B8E.4020101@mev.co.uk> List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: driverdev-devel-bounces@linuxdriverproject.org To: driverdev-devel@linuxdriverproject.org Cc: Greg Kroah-Hartman , Ian Abbott , Bernd Porr , H Hartley Sweeten The "ni_labpc" module acts as a low-level comedi driver for various National Instruments Lab-PC ISA cards if `CONFIG_NI_LABPC_ISA` is enabled, and also as a common module depended on by the "ni_labpc_cs" and "ni_labpc_pci" modules. For ISA cards, it optionally supports the use of an ISA DMA channel if `CONFIG_ISA_DMA_API` is enabled, using conditionally compiled code. This conditionally compiled code also relies on `virt_to_bus()`, which only exists if `CONFIG_VIRT_TO_BUS` is enabled. Therefore, support for ISA DMA should only be compiled in if both `CONFIG_ISA_DMA_API` and `CONFIG_VIRT_TO_BUS` are defined. The `CONFIG_NI_LABPC_ISA` option currently depends on `VIRT_TO_BUS` at configure time and checks `CONFIG_ISA_DMA_API` at compile time. It seems better to check both options at compile time. Conditionally define a new macro `NI_LABPC_ISA_DMA` iff both `CONFIG_ISA_DMA_API` and `CONFIG_VIRT_TO_BUS` are defined, and change the conditional compilation tests to use the new macro instead of `CONFIG_ISA_DMA_API`. Also, in the "Kconfig", remove the `VIRT_TO_BUS` dependency from the `COMEDI_NI_LABPC_ISA` option since the dependency is now checked at compile time. Signed-off-by: Ian Abbott --- v2: Rebased and changed the subject and description a bit. I think my original reason for the patch is still valid even after Hartley's change to the use of virt_to_bus() in this module. --- drivers/staging/comedi/Kconfig | 1 - drivers/staging/comedi/drivers/ni_labpc.c | 18 +++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8c8a551..e234fe9 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -473,7 +473,6 @@ config COMEDI_NI_ATMIO16D config COMEDI_NI_LABPC_ISA tristate "NI Lab-PC and compatibles ISA support" select COMEDI_NI_LABPC - depends on VIRT_TO_BUS ---help--- Enable support for National Instruments Lab-PC and compatibles Lab-PC-1200, Lab-PC-1200AI, Lab-PC+. diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index f161e70..8989155 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -71,6 +71,10 @@ #include "comedi_fc.h" #include "ni_labpc.h" +#if defined(CONFIG_ISA_DMA_API) && defined(CONFIG_VIRT_TO_BUS) +#define NI_LABPC_ISA_DMA +#endif + /* * Register map (all registers are 8-bit) */ @@ -451,7 +455,7 @@ static int labpc_ai_insn_read(struct comedi_device *dev, return insn->n; } -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA /* utility function that suggests a dma transfer size in bytes */ static unsigned int labpc_suggest_transfer_size(const struct comedi_cmd *cmd) { @@ -869,7 +873,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return ret; } -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA /* figure out what method we will use to transfer data */ if (devpriv->dma_chan && /* need a dma channel allocated */ /* @@ -952,7 +956,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) labpc_clear_adc_fifo(dev); -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA /* set up dma transfer */ if (xfer == isa_dma_transfer) { unsigned long irq_flags; @@ -1026,7 +1030,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA static void labpc_drain_dma(struct comedi_device *dev) { struct labpc_private *devpriv = dev->private; @@ -1130,7 +1134,7 @@ static int labpc_drain_fifo(struct comedi_device *dev) * when acquisition is terminated by stop_src == TRIG_EXT). */ static void labpc_drain_dregs(struct comedi_device *dev) { -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA struct labpc_private *devpriv = dev->private; if (devpriv->current_transfer == isa_dma_transfer) @@ -1180,7 +1184,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d) return IRQ_HANDLED; } -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA if (devpriv->current_transfer == isa_dma_transfer) { /* * if a dma terminal count of external stop trigger @@ -1710,7 +1714,7 @@ static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; -#ifdef CONFIG_ISA_DMA_API +#ifdef NI_LABPC_ISA_DMA if (dev->irq && (dma_chan == 1 || dma_chan == 3)) { devpriv->dma_buffer = kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA); -- 1.8.2.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel