mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging/comedi: Add VIRT_TO_BUS dependency to 'fix' build failure
@ 2013-05-12 22:00 Peter Huewe
  2013-05-13  9:45 ` Ian Abbott
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Huewe @ 2013-05-12 22:00 UTC (permalink / raw)
  To: Ian Abbott
  Cc: Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten, devel,
	linux-kernel, Geert Uytterhoeven, Peter Huewe

If the platform does not provide virt_to_bus the ni_labpc.c driver fails to
compile.
In order not to break these builds we have to add a depends on
CONFIG_VIRT_TO_BUS to the affected drivers.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/comedi/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 7871579..76ccb90 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -1024,6 +1024,7 @@ config COMEDI_NI_LABPC_PCI
 	tristate "NI Lab-PC PCI-1200 support"
 	select COMEDI_NI_LABPC
 	select COMEDI_MITE
+	depends on VIRT_TO_BUS
 	---help---
 	  Enable support for National Instruments Lab-PC PCI-1200.
 
@@ -1151,6 +1152,7 @@ config COMEDI_NI_DAQ_DIO24_CS
 config COMEDI_NI_LABPC_CS
 	tristate "NI DAQCard-1200 PCMCIA support"
 	select COMEDI_NI_LABPC
+	depends on VIRT_TO_BUS
 	---help---
 	  Enable support for the National Instruments PCMCIA DAQCard-1200
 
@@ -1267,6 +1269,7 @@ config COMEDI_NI_LABPC
 	tristate
 	select COMEDI_8255
 	select COMEDI_FC
+	depends on VIRT_TO_BUS
 
 config COMEDI_NI_TIO
 	tristate
-- 
1.8.1.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging/comedi: Add VIRT_TO_BUS dependency to 'fix' build failure
  2013-05-12 22:00 [PATCH] staging/comedi: Add VIRT_TO_BUS dependency to 'fix' build failure Peter Huewe
@ 2013-05-13  9:45 ` Ian Abbott
  2013-05-13 11:02   ` [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency Ian Abbott
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Abbott @ 2013-05-13  9:45 UTC (permalink / raw)
  To: Peter Huewe
  Cc: Ian Abbott, Mori Hess, Greg Kroah-Hartman, H Hartley Sweeten,
	devel, linux-kernel, Geert Uytterhoeven

On 2013-05-12 23:00, Peter Huewe wrote:
> If the platform does not provide virt_to_bus the ni_labpc.c driver fails to
> compile.
> In order not to break these builds we have to add a depends on
> CONFIG_VIRT_TO_BUS to the affected drivers.
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

I'll submit an alternate patch that won't break compilation of 
ni_labpc.c and doesn't depend on CONFIG_VIRT_TO_BUS.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency
  2013-05-13  9:45 ` Ian Abbott
@ 2013-05-13 11:02   ` Ian Abbott
  2013-05-13 21:28     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Abbott @ 2013-05-13 11:02 UTC (permalink / raw)
  To: devel
  Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten,
	Frank Mori Hess, Peter Huewe, Geert Uytterhoeven, linux-kernel

The "ni_labpc" module acts as a low-level comedi driver for various
Nattional 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,
otherwise the "ni_labpc" module fails to compile on kernels that enable
`CONFIG_ISA_DMA_API` but not `CONFIG_VIRT_TO_BUS`.

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 <abbotti@mev.co.uk>
---
 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 7871579..c55a79d 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -487,7 +487,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 3d978f3..5078be7 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -75,6 +75,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)
  */
@@ -465,7 +469,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)
 {
@@ -883,7 +887,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 */
 		/*
@@ -966,7 +970,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;
@@ -1041,7 +1045,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;
@@ -1145,7 +1149,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)
@@ -1195,7 +1199,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
@@ -1731,7 +1735,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.1.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency
  2013-05-13 11:02   ` [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency Ian Abbott
@ 2013-05-13 21:28     ` Greg Kroah-Hartman
  2013-05-14 10:01       ` Ian Abbott
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2013-05-13 21:28 UTC (permalink / raw)
  To: Ian Abbott
  Cc: devel, Frank Mori Hess, linux-kernel, Geert Uytterhoeven,
	H Hartley Sweeten

On Mon, May 13, 2013 at 12:02:15PM +0100, Ian Abbott wrote:
> The "ni_labpc" module acts as a low-level comedi driver for various
> Nattional 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,
> otherwise the "ni_labpc" module fails to compile on kernels that enable
> `CONFIG_ISA_DMA_API` but not `CONFIG_VIRT_TO_BUS`.
> 
> 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 <abbotti@mev.co.uk>
> ---
>  drivers/staging/comedi/Kconfig            |  1 -
>  drivers/staging/comedi/drivers/ni_labpc.c | 18 +++++++++++-------
>  2 files changed, 11 insertions(+), 8 deletions(-)

Ick, no, I'll take Hartley's patch he sent a week or so ago that fixes
this properly for all architectures.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency
  2013-05-13 21:28     ` Greg Kroah-Hartman
@ 2013-05-14 10:01       ` Ian Abbott
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Abbott @ 2013-05-14 10:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ian Abbott, devel, Frank Mori Hess, linux-kernel,
	Geert Uytterhoeven, H Hartley Sweeten

On 2013-05-13 22:28, Greg Kroah-Hartman wrote:
> On Mon, May 13, 2013 at 12:02:15PM +0100, Ian Abbott wrote:
>> The "ni_labpc" module acts as a low-level comedi driver for various
>> Nattional 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,
>> otherwise the "ni_labpc" module fails to compile on kernels that enable
>> `CONFIG_ISA_DMA_API` but not `CONFIG_VIRT_TO_BUS`.
>>
>> 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 <abbotti@mev.co.uk>
>> ---
>>   drivers/staging/comedi/Kconfig            |  1 -
>>   drivers/staging/comedi/drivers/ni_labpc.c | 18 +++++++++++-------
>>   2 files changed, 11 insertions(+), 8 deletions(-)
>
> Ick, no, I'll take Hartley's patch he sent a week or so ago that fixes
> this properly for all architectures.

Okay, I completely forgot about that patch!  I think the Kconfig part of 
my patch is still valid though, so I'll repost that part.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-14 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-12 22:00 [PATCH] staging/comedi: Add VIRT_TO_BUS dependency to 'fix' build failure Peter Huewe
2013-05-13  9:45 ` Ian Abbott
2013-05-13 11:02   ` [PATCH] staging: comedi: ni_labpc: fix VIRT_TO_BUS dependency Ian Abbott
2013-05-13 21:28     ` Greg Kroah-Hartman
2013-05-14 10:01       ` Ian Abbott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome