linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: 2.6.24-rc8-mm1 Build Failure on scsi driver
       [not found] <20080117023514.9df393cf.akpm@linux-foundation.org>
@ 2008-01-17 16:15 ` Kamalesh Babulal
  2008-01-17 19:11   ` Andrew Morton
  0 siblings, 1 reply; 17+ messages in thread
From: Kamalesh Babulal @ 2008-01-17 16:15 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-scsi, fischer, Andy Whitcroft, Balbir Singh

Hi Andrew,

The kernel build fails with following error

drivers/scsi/aha152x.o: In function `aha152x_host_reset_host':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: multiple definition of `aha152x_host_reset_host'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: first defined here
drivers/scsi/aha152x.o: In function `aha152x_release':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: multiple definition of `aha152x_release'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: first defined here
ld: Warning: size of symbol `aha152x_release' changed from 68 in drivers/scsi/pcmcia/built-in.o to 100 in drivers/scsi/aha152x.o
drivers/scsi/aha152x.o: In function `aha152x_probe_one':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:772: multiple definition of `aha152x_probe_one'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:772: first defined here
drivers/scsi/fdomain.o:(.data+0x0): multiple definition of `fdomain_driver_template'
drivers/scsi/pcmcia/built-in.o:(.data+0x5a0): first defined here
drivers/scsi/fdomain.o: In function `fdomain_16x0_bus_reset':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: multiple definition of `fdomain_16x0_bus_reset'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: first defined here
drivers/scsi/fdomain.o: In function `__fdomain_16x0_detect':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: multiple definition of `__fdomain_16x0_detect'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: first defined here
ld: Warning: size of symbol `__fdomain_16x0_detect' changed from 1206 in drivers/scsi/pcmcia/built-in.o to 1700 in drivers/scsi/fdomain.o
drivers/scsi/fdomain.o: In function `fdomain_setup':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: multiple definition of `fdomain_setup'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: first defined here
make[2]: *** [drivers/scsi/built-in.o] Error 1
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2


-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.

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

* Re: 2.6.24-rc8-mm1 Build Failure on scsi driver
  2008-01-17 16:15 ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
@ 2008-01-17 19:11   ` Andrew Morton
  2008-01-18  0:53     ` [PATCH] aha152x: fix isa/pcmcia compile problem Tejun Heo
  2008-01-18  6:37     ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
  0 siblings, 2 replies; 17+ messages in thread
From: Andrew Morton @ 2008-01-17 19:11 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: linux-kernel, linux-scsi, fischer, Andy Whitcroft, Balbir Singh,
	Samuel Ortiz, James Bottomley, Tejun Heo

On Thu, 17 Jan 2008 21:45:39 +0530 Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:

> Hi Andrew,
> 
> The kernel build fails with following error
> 
> drivers/scsi/aha152x.o: In function `aha152x_host_reset_host':
> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: multiple definition of `aha152x_host_reset_host'
> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: first defined here
> drivers/scsi/aha152x.o: In function `aha152x_release':
> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: multiple definition of `aha152x_release'
> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: first defined here
> ld: Warning: size of symbol `aha152x_release' changed from 68 in drivers/scsi/pcmcia/built-in.o to 100 in drivers/scsi/aha152x.o
> drivers/scsi/aha152x.o: In function `aha152x_probe_one':

Neat.  Seems that the scsi build system is linking together two copies of
drivers/scsi/aha152x.o.  One via drivers/scsi/aha152x.o directly and the
other via drivers/scsi/pcmcia/built-in.o.

Please send the .config.

I'm looking suspiciously at this, from git-scsi-misc:

commit 8ae732a91df051aba6820068a47b631a06599d84
Author: Tejun Heo <htejun@gmail.com>
Date:   Fri Dec 7 22:36:23 2007 +0900

    [SCSI] make pcmcia directory use obj-y|m instead of subdir-y|m
    
    subdir-y|m isn't supposed to contain modules or built-in components.
    Change subdir-$(CONFIG_PCMCIA) to obj-$(CONFIG_PCMCIA).
    
    Signed-off-by: Tejun Heo <htejun@gmail.com>
    Acked-by: Sam Ravnborg <sam@ravnborg.org>
    Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>

diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index b5441f5..93e1428 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -17,7 +17,7 @@
 CFLAGS_aha152x.o =   -DAHA152X_STAT -DAUTOCONF
 CFLAGS_gdth.o    = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS
 
-subdir-$(CONFIG_PCMCIA)		+= pcmcia
+obj-$(CONFIG_PCMCIA)		+= pcmcia/
 
 obj-$(CONFIG_SCSI)		+= scsi_mod.o
 obj-$(CONFIG_SCSI_TGT)		+= scsi_tgt.o


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

* [PATCH] aha152x: fix isa/pcmcia compile problem
  2008-01-17 19:11   ` Andrew Morton
@ 2008-01-18  0:53     ` Tejun Heo
  2008-01-18  6:29       ` Kamalesh Babulal
  2008-01-18  6:37     ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
  1 sibling, 1 reply; 17+ messages in thread
From: Tejun Heo @ 2008-01-18  0:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kamalesh Babulal, linux-kernel, linux-scsi, fischer,
	Andy Whitcroft, Balbir Singh, Samuel Ortiz, James Bottomley

aha152x.c is built twice - once for the isa driver and once for the
PCMCIA one.  Through #ifdefs, the compiled codes are slightly
different; thus, global symbols need to be given different names
depending on which flavor is being built.  This patch adds GLOBAL()
macro to aha152x.h which changes the symbol depending on PCMCIA.

This bug has always existed but has been masked by the fact the
drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
avoided the duplicate symbols during compilation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
 drivers/scsi/aha152x.c             |   12 ++++++------
 drivers/scsi/aha152x.h             |   20 +++++++++++++++++---
 drivers/scsi/pcmcia/aha152x_stub.c |   10 ++++++----
 3 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index ea8c699..0204f44 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -769,7 +769,7 @@ static irqreturn_t swintr(int irqno, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *setup)
 {
 	struct Scsi_Host *shpnt;
 
@@ -905,7 +905,7 @@ out_host_put:
 	return NULL;
 }
 
-void aha152x_release(struct Scsi_Host *shpnt)
+void GLOBAL(aha152x_release)(struct Scsi_Host *shpnt)
 {
 	if (!shpnt)
 		return;
@@ -1327,7 +1327,7 @@ static void reset_ports(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  *
  */
-int aha152x_host_reset_host(struct Scsi_Host *shpnt)
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *shpnt)
 {
 	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
 
@@ -1345,7 +1345,7 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt)
  */
 static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
 {
-	return aha152x_host_reset_host(SCpnt->device->host);
+	return GLOBAL(aha152x_host_reset_host)(SCpnt->device->host);
 }
 
 /*
@@ -3916,7 +3916,7 @@ static int __init aha152x_init(void)
 
 	for (i=0; i<setup_count; i++) {
 		if ( request_region(setup[i].io_port, IO_RANGE, "aha152x") ) {
-			struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]);
+			struct Scsi_Host *shpnt = GLOBAL(aha152x_probe_one)(&setup[i]);
 
 			if( !shpnt ) {
 				release_region(setup[i].io_port, IO_RANGE);
@@ -3946,7 +3946,7 @@ static void __exit aha152x_exit(void)
 	list_for_each_entry(hd, &aha152x_host_list, host_list) {
 		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
 
-		aha152x_release(shost);
+		GLOBAL(aha152x_release)(shost);
 	}
 }
 
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index ac4bfa4..7db6c47 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -330,8 +330,22 @@ struct aha152x_setup {
 	char *conf;
 };
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
-void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset_host(struct Scsi_Host *);
+/*
+ * This file and aha152x.c are compiled in two different ways - for
+ * the isa driver and pcmcia one.  When building the pcmcia one, the
+ * file is slightly modified, so they can't share the same object
+ * file.  The following macro alters a symbol depending on whether
+ * pcmcia driver is being built or not and should be used for any
+ * global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)	CS_##x
+#else
+#define GLOBAL(x)	x
+#endif
+
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *);
+void GLOBAL(aha152x_release)(struct Scsi_Host *);
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *);
 
 #endif /* _AHA152X_H */
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 2dd0dc9..57f83d1 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -47,13 +47,15 @@
 
 #include "scsi.h"
 #include <scsi/scsi_host.h>
-#include "aha152x.h"
 
 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
+#define PCMCIA	1
+#include "aha152x.h"
+
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
 module_param(pc_debug, int, 0644);
@@ -194,7 +196,7 @@ static int aha152x_config_cs(struct pcmcia_device *link)
     if (ext_trans)
         s.ext_trans = ext_trans;
 
-    host = aha152x_probe_one(&s);
+    host = GLOBAL(aha152x_probe_one)(&s);
     if (host == NULL) {
 	printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
 	goto cs_failed;
@@ -216,7 +218,7 @@ static void aha152x_release_cs(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;
 
-	aha152x_release(info->host);
+	GLOBAL(aha152x_release)(info->host);
 	pcmcia_disable_device(link);
 }
 
@@ -224,7 +226,7 @@ static int aha152x_resume(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;
 
-	aha152x_host_reset_host(info->host);
+	GLOBAL(aha152x_host_reset_host)(info->host);
 
 	return 0;
 }
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c

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

* Re: [PATCH] aha152x: fix isa/pcmcia compile problem
  2008-01-18  0:53     ` [PATCH] aha152x: fix isa/pcmcia compile problem Tejun Heo
@ 2008-01-18  6:29       ` Kamalesh Babulal
  0 siblings, 0 replies; 17+ messages in thread
From: Kamalesh Babulal @ 2008-01-18  6:29 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Andrew Morton, Kamalesh Babulal, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz,
	James Bottomley

On Fri, Jan 18, 2008 at 09:53:16AM +0900, Tejun Heo wrote:
> aha152x.c is built twice - once for the isa driver and once for the
> PCMCIA one.  Through #ifdefs, the compiled codes are slightly
> different; thus, global symbols need to be given different names
> depending on which flavor is being built.  This patch adds GLOBAL()
> macro to aha152x.h which changes the symbol depending on PCMCIA.
> 
> This bug has always existed but has been masked by the fact the
> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> avoided the duplicate symbols during compilation.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
>  drivers/scsi/aha152x.c             |   12 ++++++------
>  drivers/scsi/aha152x.h             |   20 +++++++++++++++++---
>  drivers/scsi/pcmcia/aha152x_stub.c |   10 ++++++----
>  3 files changed, 29 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
> index ea8c699..0204f44 100644
> --- a/drivers/scsi/aha152x.c
> +++ b/drivers/scsi/aha152x.c
> @@ -769,7 +769,7 @@ static irqreturn_t swintr(int irqno, void *dev_id)
>  	return IRQ_HANDLED;
>  }
> 
> -struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
> +struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *setup)
>  {
>  	struct Scsi_Host *shpnt;
> 
> @@ -905,7 +905,7 @@ out_host_put:
>  	return NULL;
>  }
> 
> -void aha152x_release(struct Scsi_Host *shpnt)
> +void GLOBAL(aha152x_release)(struct Scsi_Host *shpnt)
>  {
>  	if (!shpnt)
>  		return;
> @@ -1327,7 +1327,7 @@ static void reset_ports(struct Scsi_Host *shpnt)
>   * Reset the host (bus and controller)
>   *
>   */
> -int aha152x_host_reset_host(struct Scsi_Host *shpnt)
> +int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *shpnt)
>  {
>  	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
> 
> @@ -1345,7 +1345,7 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt)
>   */
>  static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
>  {
> -	return aha152x_host_reset_host(SCpnt->device->host);
> +	return GLOBAL(aha152x_host_reset_host)(SCpnt->device->host);
>  }
> 
>  /*
> @@ -3916,7 +3916,7 @@ static int __init aha152x_init(void)
> 
>  	for (i=0; i<setup_count; i++) {
>  		if ( request_region(setup[i].io_port, IO_RANGE, "aha152x") ) {
> -			struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]);
> +			struct Scsi_Host *shpnt = GLOBAL(aha152x_probe_one)(&setup[i]);
> 
>  			if( !shpnt ) {
>  				release_region(setup[i].io_port, IO_RANGE);
> @@ -3946,7 +3946,7 @@ static void __exit aha152x_exit(void)
>  	list_for_each_entry(hd, &aha152x_host_list, host_list) {
>  		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
> 
> -		aha152x_release(shost);
> +		GLOBAL(aha152x_release)(shost);
>  	}
>  }
> 
> diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
> index ac4bfa4..7db6c47 100644
> --- a/drivers/scsi/aha152x.h
> +++ b/drivers/scsi/aha152x.h
> @@ -330,8 +330,22 @@ struct aha152x_setup {
>  	char *conf;
>  };
> 
> -struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
> -void aha152x_release(struct Scsi_Host *);
> -int aha152x_host_reset_host(struct Scsi_Host *);
> +/*
> + * This file and aha152x.c are compiled in two different ways - for
> + * the isa driver and pcmcia one.  When building the pcmcia one, the
> + * file is slightly modified, so they can't share the same object
> + * file.  The following macro alters a symbol depending on whether
> + * pcmcia driver is being built or not and should be used for any
> + * global symbol.
> + */
> +#if defined(PCMCIA)
> +#define GLOBAL(x)	CS_##x
> +#else
> +#define GLOBAL(x)	x
> +#endif
> +
> +struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *);
> +void GLOBAL(aha152x_release)(struct Scsi_Host *);
> +int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *);
> 
>  #endif /* _AHA152X_H */
> diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
> index 2dd0dc9..57f83d1 100644
> --- a/drivers/scsi/pcmcia/aha152x_stub.c
> +++ b/drivers/scsi/pcmcia/aha152x_stub.c
> @@ -47,13 +47,15 @@
> 
>  #include "scsi.h"
>  #include <scsi/scsi_host.h>
> -#include "aha152x.h"
> 
>  #include <pcmcia/cs_types.h>
>  #include <pcmcia/cs.h>
>  #include <pcmcia/cistpl.h>
>  #include <pcmcia/ds.h>
> 
> +#define PCMCIA	1
> +#include "aha152x.h"
> +
>  #ifdef PCMCIA_DEBUG
>  static int pc_debug = PCMCIA_DEBUG;
>  module_param(pc_debug, int, 0644);
> @@ -194,7 +196,7 @@ static int aha152x_config_cs(struct pcmcia_device *link)
>      if (ext_trans)
>          s.ext_trans = ext_trans;
> 
> -    host = aha152x_probe_one(&s);
> +    host = GLOBAL(aha152x_probe_one)(&s);
>      if (host == NULL) {
>  	printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
>  	goto cs_failed;
> @@ -216,7 +218,7 @@ static void aha152x_release_cs(struct pcmcia_device *link)
>  {
>  	scsi_info_t *info = link->priv;
> 
> -	aha152x_release(info->host);
> +	GLOBAL(aha152x_release)(info->host);
>  	pcmcia_disable_device(link);
>  }
> 
> @@ -224,7 +226,7 @@ static int aha152x_resume(struct pcmcia_device *link)
>  {
>  	scsi_info_t *info = link->priv;
> 
> -	aha152x_host_reset_host(info->host);
> +	GLOBAL(aha152x_host_reset_host)(info->host);
> 
>  	return 0;
>  }
> diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
> --
Hi Tejun Heo,

Thanks, I have tested the patch fixes the build failure on aha152x.c.
Tested-By: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>

Thanks & Regards,
Kamalesh Babulal.

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

* Re: 2.6.24-rc8-mm1 Build Failure on scsi driver
  2008-01-17 19:11   ` Andrew Morton
  2008-01-18  0:53     ` [PATCH] aha152x: fix isa/pcmcia compile problem Tejun Heo
@ 2008-01-18  6:37     ` Kamalesh Babulal
  2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
  2008-01-18  7:27       ` 2.6.24-rc8-mm1 Build Failure on scsi driver Andrew Morton
  1 sibling, 2 replies; 17+ messages in thread
From: Kamalesh Babulal @ 2008-01-18  6:37 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-scsi, fischer, Andy Whitcroft, Balbir Singh,
	Samuel Ortiz, James Bottomley, Tejun Heo

Andrew Morton wrote:
> On Thu, 17 Jan 2008 21:45:39 +0530 Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:
> 
>> Hi Andrew,
>>
>> The kernel build fails with following error
>>
>> drivers/scsi/aha152x.o: In function `aha152x_host_reset_host':
>> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: multiple definition of `aha152x_host_reset_host'
>> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:1324: first defined here
>> drivers/scsi/aha152x.o: In function `aha152x_release':
>> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: multiple definition of `aha152x_release'
>> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/aha152x.c:908: first defined here
>> ld: Warning: size of symbol `aha152x_release' changed from 68 in drivers/scsi/pcmcia/built-in.o to 100 in drivers/scsi/aha152x.o
>> drivers/scsi/aha152x.o: In function `aha152x_probe_one':
> 
> Neat.  Seems that the scsi build system is linking together two copies of
> drivers/scsi/aha152x.o.  One via drivers/scsi/aha152x.o directly and the
> other via drivers/scsi/pcmcia/built-in.o.
> 
> Please send the .config.
> 
> I'm looking suspiciously at this, from git-scsi-misc:
> 
> commit 8ae732a91df051aba6820068a47b631a06599d84
> Author: Tejun Heo <htejun@gmail.com>
> Date:   Fri Dec 7 22:36:23 2007 +0900
> 
>     [SCSI] make pcmcia directory use obj-y|m instead of subdir-y|m
>     
>     subdir-y|m isn't supposed to contain modules or built-in components.
>     Change subdir-$(CONFIG_PCMCIA) to obj-$(CONFIG_PCMCIA).
>     
>     Signed-off-by: Tejun Heo <htejun@gmail.com>
>     Acked-by: Sam Ravnborg <sam@ravnborg.org>
>     Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> 
> diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
> index b5441f5..93e1428 100644
> --- a/drivers/scsi/Makefile
> +++ b/drivers/scsi/Makefile
> @@ -17,7 +17,7 @@
>  CFLAGS_aha152x.o =   -DAHA152X_STAT -DAUTOCONF
>  CFLAGS_gdth.o    = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS
> 
> -subdir-$(CONFIG_PCMCIA)		+= pcmcia
> +obj-$(CONFIG_PCMCIA)		+= pcmcia/
> 
>  obj-$(CONFIG_SCSI)		+= scsi_mod.o
>  obj-$(CONFIG_SCSI_TGT)		+= scsi_tgt.o

Hi Andrew,

Patch from Tejun Heo fixes the aha152x.c build failure, and following second part
of the build failure, is still occurring.

drivers/scsi/fdomain.o:(.data+0x0): multiple definition of `fdomain_driver_template'
drivers/scsi/pcmcia/built-in.o:(.data+0x5a0): first defined here
drivers/scsi/fdomain.o: In function `fdomain_16x0_bus_reset':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: multiple definition of `fdomain_16x0_bus_reset'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: first defined here
drivers/scsi/fdomain.o: In function `__fdomain_16x0_detect':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: multiple definition of `__fdomain_16x0_detect'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: first defined here
ld: Warning: size of symbol `__fdomain_16x0_detect' changed from 1206 in drivers/scsi/pcmcia/built-in.o to 1700 in drivers/scsi/fdomain.o
drivers/scsi/fdomain.o: In function `fdomain_setup':
/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: multiple definition of `fdomain_setup'
drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: first defined here
make[2]: *** [drivers/scsi/built-in.o] Error 1
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2

-- 
Thanks & Regards,
Kamalesh Babulal,
Linux Technology Center,
IBM, ISTL.

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

* [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18  6:37     ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
@ 2008-01-18  7:20       ` Tejun Heo
  2008-01-18  7:30         ` Kamalesh Babulal
                           ` (2 more replies)
  2008-01-18  7:27       ` 2.6.24-rc8-mm1 Build Failure on scsi driver Andrew Morton
  1 sibling, 3 replies; 17+ messages in thread
From: Tejun Heo @ 2008-01-18  7:20 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: Andrew Morton, linux-kernel, linux-scsi, fischer, Andy Whitcroft,
	Balbir Singh, Samuel Ortiz, James Bottomley

aha152x.c and fdomain are built twice - once for the isa driver and
once for the PCMCIA one.  Through #ifdefs, the compiled codes are
slightly different; thus, global symbols need to be given different
names depending on which flavor is being built.  This patch adds
GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
depending on PCMCIA.

This bug has always existed but has been masked by the fact the
drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
avoided the duplicate symbols during compilation.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Ah... missed that one.  Here's the updated version.

 drivers/scsi/aha152x.c             |   12 ++++++------
 drivers/scsi/aha152x.h             |   20 +++++++++++++++++---
 drivers/scsi/fdomain.c             |   20 ++++++++++----------
 drivers/scsi/fdomain.h             |   21 +++++++++++++++++----
 drivers/scsi/pcmcia/aha152x_stub.c |   10 ++++++----
 drivers/scsi/pcmcia/fdomain_stub.c |   10 ++++++----
 6 files changed, 62 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index ea8c699..0204f44 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -769,7 +769,7 @@ static irqreturn_t swintr(int irqno, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *setup)
 {
 	struct Scsi_Host *shpnt;
 
@@ -905,7 +905,7 @@ out_host_put:
 	return NULL;
 }
 
-void aha152x_release(struct Scsi_Host *shpnt)
+void GLOBAL(aha152x_release)(struct Scsi_Host *shpnt)
 {
 	if (!shpnt)
 		return;
@@ -1327,7 +1327,7 @@ static void reset_ports(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  *
  */
-int aha152x_host_reset_host(struct Scsi_Host *shpnt)
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *shpnt)
 {
 	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
 
@@ -1345,7 +1345,7 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt)
  */
 static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
 {
-	return aha152x_host_reset_host(SCpnt->device->host);
+	return GLOBAL(aha152x_host_reset_host)(SCpnt->device->host);
 }
 
 /*
@@ -3916,7 +3916,7 @@ static int __init aha152x_init(void)
 
 	for (i=0; i<setup_count; i++) {
 		if ( request_region(setup[i].io_port, IO_RANGE, "aha152x") ) {
-			struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]);
+			struct Scsi_Host *shpnt = GLOBAL(aha152x_probe_one)(&setup[i]);
 
 			if( !shpnt ) {
 				release_region(setup[i].io_port, IO_RANGE);
@@ -3946,7 +3946,7 @@ static void __exit aha152x_exit(void)
 	list_for_each_entry(hd, &aha152x_host_list, host_list) {
 		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);
 
-		aha152x_release(shost);
+		GLOBAL(aha152x_release)(shost);
 	}
 }
 
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index ac4bfa4..f441e54 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -330,8 +330,22 @@ struct aha152x_setup {
 	char *conf;
 };
 
-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
-void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset_host(struct Scsi_Host *);
+/*
+ * This file and aha152x.c are compiled in two different ways - for
+ * the isa driver and pcmcia one.  When building the pcmcia one, the
+ * file is slightly modified, so they can't share the same object
+ * file.  The following macro alters a symbol depending on whether
+ * pcmcia driver is being built or not and should be used for any
+ * global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)	CS_##x
+#else
+#define GLOBAL(x)	ISA_##x
+#endif
+
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *);
+void GLOBAL(aha152x_release)(struct Scsi_Host *);
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *);
 
 #endif /* _AHA152X_H */
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 2cd6b49..e14c59b 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -550,7 +550,7 @@ static void print_banner( struct Scsi_Host *shpnt )
    printk( "\n" );
 }
 
-int fdomain_setup(char *str)
+int GLOBAL(fdomain_setup)(char *str)
 {
 	int ints[4];
 
@@ -571,7 +571,7 @@ int fdomain_setup(char *str)
 	return 1;
 }
 
-__setup("fdomain=", fdomain_setup);
+__setup("fdomain=", GLOBAL(fdomain_setup));
 
 
 static void do_pause(unsigned amount)	/* Pause for amount*10 milliseconds */
@@ -890,7 +890,7 @@ fail:
 
 #endif
 
-struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
+struct Scsi_Host *GLOBAL(__fdomain_16x0_detect)(struct scsi_host_template *tpnt )
 {
    int              retcode;
    struct Scsi_Host *shpnt;
@@ -931,7 +931,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
       }
    }
 
-   fdomain_16x0_bus_reset(NULL);
+   GLOBAL(fdomain_16x0_bus_reset)(NULL);
 
    if (fdomain_test_loopback()) {
       printk(KERN_ERR  "scsi: <fdomain> Detection failed (loopback test failed at port base 0x%x)\n", port_base);
@@ -1004,8 +1004,8 @@ fail:
 static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
 {
 	if (fdomain)
-		fdomain_setup(fdomain);
-	return (__fdomain_16x0_detect(tpnt) != NULL);
+		GLOBAL(fdomain_setup)(fdomain);
+	return (GLOBAL(__fdomain_16x0_detect)(tpnt) != NULL);
 }
 
 static const char *fdomain_16x0_info( struct Scsi_Host *ignore )
@@ -1564,7 +1564,7 @@ static int fdomain_16x0_abort(struct scsi_cmnd *SCpnt)
    return SUCCESS;
 }
 
-int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt)
+int GLOBAL(fdomain_16x0_bus_reset)(struct scsi_cmnd *SCpnt)
 {
    unsigned long flags;
 
@@ -1746,7 +1746,7 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt)
 	return 0;
 }
 
-struct scsi_host_template fdomain_driver_template = {
+struct scsi_host_template GLOBAL(fdomain_driver_template) = {
 	.module			= THIS_MODULE,
 	.name			= "fdomain",
 	.proc_name		= "fdomain",
@@ -1754,7 +1754,7 @@ struct scsi_host_template fdomain_driver_template = {
 	.info			= fdomain_16x0_info,
 	.queuecommand		= fdomain_16x0_queue,
 	.eh_abort_handler	= fdomain_16x0_abort,
-	.eh_bus_reset_handler	= fdomain_16x0_bus_reset,
+	.eh_bus_reset_handler	= GLOBAL(fdomain_16x0_bus_reset),
 	.bios_param		= fdomain_16x0_biosparam,
 	.release		= fdomain_16x0_release,
 	.can_queue		= 1,
@@ -1774,7 +1774,7 @@ static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
 };
 MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
 #endif
-#define driver_template fdomain_driver_template
+#define driver_template GLOBAL(fdomain_driver_template)
 #include "scsi_module.c"
 
 #endif
diff --git a/drivers/scsi/fdomain.h b/drivers/scsi/fdomain.h
index 47021d9..f026cd6 100644
--- a/drivers/scsi/fdomain.h
+++ b/drivers/scsi/fdomain.h
@@ -18,7 +18,20 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-extern struct scsi_host_template fdomain_driver_template;
-extern int fdomain_setup(char *str);
-extern struct Scsi_Host *__fdomain_16x0_detect(struct  scsi_host_template *tpnt );
-extern int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt);
+/*
+ * fdomain is compiled in two different ways - for the isa driver and
+ * pcmcia one.  When building the pcmcia one, the file is slightly
+ * modified, so they can't share the same object file.  The following
+ * macro alters a symbol depending on whether pcmcia driver is being
+ * built or not and should be used for any global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)	CS_##x
+#else
+#define GLOBAL(x)	ISA_##x
+#endif
+
+extern struct scsi_host_template GLOBAL(fdomain_driver_template);
+extern int GLOBAL(fdomain_setup)(char *str);
+extern struct Scsi_Host *GLOBAL(__fdomain_16x0_detect)(struct  scsi_host_template *tpnt );
+extern int GLOBAL(fdomain_16x0_bus_reset)(struct scsi_cmnd *SCpnt);
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 2dd0dc9..57f83d1 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -47,13 +47,15 @@
 
 #include "scsi.h"
 #include <scsi/scsi_host.h>
-#include "aha152x.h"
 
 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
+#define PCMCIA	1
+#include "aha152x.h"
+
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
 module_param(pc_debug, int, 0644);
@@ -194,7 +196,7 @@ static int aha152x_config_cs(struct pcmcia_device *link)
     if (ext_trans)
         s.ext_trans = ext_trans;
 
-    host = aha152x_probe_one(&s);
+    host = GLOBAL(aha152x_probe_one)(&s);
     if (host == NULL) {
 	printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
 	goto cs_failed;
@@ -216,7 +218,7 @@ static void aha152x_release_cs(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;
 
-	aha152x_release(info->host);
+	GLOBAL(aha152x_release)(info->host);
 	pcmcia_disable_device(link);
 }
 
@@ -224,7 +226,7 @@ static int aha152x_resume(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;
 
-	aha152x_host_reset_host(info->host);
+	GLOBAL(aha152x_host_reset_host)(info->host);
 
 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 4b82b20..b075576 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -44,13 +44,15 @@
 
 #include "scsi.h"
 #include <scsi/scsi_host.h>
-#include "fdomain.h"
 
 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>
 
+#define PCMCIA	1
+#include "fdomain.h"
+
 /*====================================================================*/
 
 /* Module parameters */
@@ -161,9 +163,9 @@ static int fdomain_config(struct pcmcia_device *link)
 
     /* Set configuration options for the fdomain driver */
     sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ);
-    fdomain_setup(str);
+    GLOBAL(fdomain_setup)(str);
 
-    host = __fdomain_16x0_detect(&fdomain_driver_template);
+    host = GLOBAL(__fdomain_16x0_detect)(&GLOBAL(fdomain_driver_template));
     if (!host) {
         printk(KERN_INFO "fdomain_cs: no SCSI devices found\n");
 	goto cs_failed;
@@ -202,7 +204,7 @@ static void fdomain_release(struct pcmcia_device *link)
 
 static int fdomain_resume(struct pcmcia_device *link)
 {
-	fdomain_16x0_bus_reset(NULL);
+	GLOBAL(fdomain_16x0_bus_reset)(NULL);
 
 	return 0;
 }
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c

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

* Re: 2.6.24-rc8-mm1 Build Failure on scsi driver
  2008-01-18  6:37     ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
  2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
@ 2008-01-18  7:27       ` Andrew Morton
  1 sibling, 0 replies; 17+ messages in thread
From: Andrew Morton @ 2008-01-18  7:27 UTC (permalink / raw)
  To: Kamalesh Babulal
  Cc: linux-kernel, linux-scsi, fischer, Andy Whitcroft, Balbir Singh,
	Samuel Ortiz, James Bottomley, Tejun Heo

On Fri, 18 Jan 2008 12:07:27 +0530 Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:

> Hi Andrew,
> 
> Patch from Tejun Heo fixes the aha152x.c build failure, and following second part
> of the build failure, is still occurring.
> 
> drivers/scsi/fdomain.o:(.data+0x0): multiple definition of `fdomain_driver_template'
> drivers/scsi/pcmcia/built-in.o:(.data+0x5a0): first defined here
> drivers/scsi/fdomain.o: In function `fdomain_16x0_bus_reset':
> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: multiple definition of `fdomain_16x0_bus_reset'
> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:1568: first defined here
> drivers/scsi/fdomain.o: In function `__fdomain_16x0_detect':
> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: multiple definition of `__fdomain_16x0_detect'
> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:894: first defined here
> ld: Warning: size of symbol `__fdomain_16x0_detect' changed from 1206 in drivers/scsi/pcmcia/built-in.o to 1700 in drivers/scsi/fdomain.o
> drivers/scsi/fdomain.o: In function `fdomain_setup':
> /home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: multiple definition of `fdomain_setup'
> drivers/scsi/pcmcia/built-in.o:/home/kamalesh/scrap/linux-2.6.24-rc8/drivers/scsi/fdomain.c:554: first defined here

Tejun has more fixing to do, I suspect ;)

I assume a basic allyesconfig will weed out most remaining problems of this
sort.  Problem is, it needs to be done for all architectures (and even that
might not suffice).  So old-fashioned code inspection is also needed.

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
@ 2008-01-18  7:30         ` Kamalesh Babulal
  2008-01-18 14:58         ` James Bottomley
  2008-01-21  9:56         ` Christoph Hellwig
  2 siblings, 0 replies; 17+ messages in thread
From: Kamalesh Babulal @ 2008-01-18  7:30 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz,
	James Bottomley

On Fri, Jan 18, 2008 at 04:20:40PM +0900, Tejun Heo wrote:
> aha152x.c and fdomain are built twice - once for the isa driver and
> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> slightly different; thus, global symbols need to be given different
> names depending on which flavor is being built.  This patch adds
> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> depending on PCMCIA.
> 
> This bug has always existed but has been masked by the fact the
> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> avoided the duplicate symbols during compilation.
> 
Hi Tejun Heo,

Thanks, I have tested the patch, it fixes both build failures.

Tested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Ah... missed that one.  Here's the updated version.

 drivers/scsi/aha152x.c             |   12 ++++++------
 drivers/scsi/aha152x.h             |   20 +++++++++++++++++---
 drivers/scsi/fdomain.c             |   20 ++++++++++----------
 drivers/scsi/fdomain.h             |   21 +++++++++++++++++----
 drivers/scsi/pcmcia/aha152x_stub.c |   10 ++++++----
 drivers/scsi/pcmcia/fdomain_stub.c |   10 ++++++----
 6 files changed, 62 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index ea8c699..0204f44 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -769,7 +769,7 @@ static irqreturn_t swintr(int irqno, void *dev_id)
 	return IRQ_HANDLED;
 }

-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *setup)
 {
 	struct Scsi_Host *shpnt;

@@ -905,7 +905,7 @@ out_host_put:
 	return NULL;
 }

-void aha152x_release(struct Scsi_Host *shpnt)
+void GLOBAL(aha152x_release)(struct Scsi_Host *shpnt)
 {
 	if (!shpnt)
 		return;
@@ -1327,7 +1327,7 @@ static void reset_ports(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  *
  */
-int aha152x_host_reset_host(struct Scsi_Host *shpnt)
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *shpnt)
 {
 	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);

@@ -1345,7 +1345,7 @@ int aha152x_host_reset_host(struct Scsi_Host *shpnt)
  */
 static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
 {
-	return aha152x_host_reset_host(SCpnt->device->host);
+	return GLOBAL(aha152x_host_reset_host)(SCpnt->device->host);
 }

 /*
@@ -3916,7 +3916,7 @@ static int __init aha152x_init(void)

 	for (i=0; i<setup_count; i++) {
 		if ( request_region(setup[i].io_port, IO_RANGE, "aha152x") ) {
-			struct Scsi_Host *shpnt = aha152x_probe_one(&setup[i]);
+			struct Scsi_Host *shpnt = GLOBAL(aha152x_probe_one)(&setup[i]);

 			if( !shpnt ) {
 				release_region(setup[i].io_port, IO_RANGE);
@@ -3946,7 +3946,7 @@ static void __exit aha152x_exit(void)
 	list_for_each_entry(hd, &aha152x_host_list, host_list) {
 		struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata);

-		aha152x_release(shost);
+		GLOBAL(aha152x_release)(shost);
 	}
 }

diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index ac4bfa4..f441e54 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -330,8 +330,22 @@ struct aha152x_setup {
 	char *conf;
 };

-struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
-void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset_host(struct Scsi_Host *);
+/*
+ * This file and aha152x.c are compiled in two different ways - for
+ * the isa driver and pcmcia one.  When building the pcmcia one, the
+ * file is slightly modified, so they can't share the same object
+ * file.  The following macro alters a symbol depending on whether
+ * pcmcia driver is being built or not and should be used for any
+ * global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)	CS_##x
+#else
+#define GLOBAL(x)	ISA_##x
+#endif
+
+struct Scsi_Host *GLOBAL(aha152x_probe_one)(struct aha152x_setup *);
+void GLOBAL(aha152x_release)(struct Scsi_Host *);
+int GLOBAL(aha152x_host_reset_host)(struct Scsi_Host *);

 #endif /* _AHA152X_H */
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 2cd6b49..e14c59b 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -550,7 +550,7 @@ static void print_banner( struct Scsi_Host *shpnt )
    printk( "\n" );
 }

-int fdomain_setup(char *str)
+int GLOBAL(fdomain_setup)(char *str)
 {
 	int ints[4];

@@ -571,7 +571,7 @@ int fdomain_setup(char *str)
 	return 1;
 }

-__setup("fdomain=", fdomain_setup);
+__setup("fdomain=", GLOBAL(fdomain_setup));


 static void do_pause(unsigned amount)	/* Pause for amount*10 milliseconds */
@@ -890,7 +890,7 @@ fail:

 #endif

-struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
+struct Scsi_Host *GLOBAL(__fdomain_16x0_detect)(struct scsi_host_template *tpnt )
 {
    int              retcode;
    struct Scsi_Host *shpnt;
@@ -931,7 +931,7 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt )
       }
    }

-   fdomain_16x0_bus_reset(NULL);
+   GLOBAL(fdomain_16x0_bus_reset)(NULL);

    if (fdomain_test_loopback()) {
       printk(KERN_ERR  "scsi: <fdomainDetection failed (loopback test failed at port base 0x%x)\n", port_base);
@@ -1004,8 +1004,8 @@ fail:
 static int fdomain_16x0_detect(struct scsi_host_template *tpnt)
 {
 	if (fdomain)
-		fdomain_setup(fdomain);
-	return (__fdomain_16x0_detect(tpnt) != NULL);
+		GLOBAL(fdomain_setup)(fdomain);
+	return (GLOBAL(__fdomain_16x0_detect)(tpnt) != NULL);
 }

 static const char *fdomain_16x0_info( struct Scsi_Host *ignore )
@@ -1564,7 +1564,7 @@ static int fdomain_16x0_abort(struct scsi_cmnd *SCpnt)
    return SUCCESS;
 }

-int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt)
+int GLOBAL(fdomain_16x0_bus_reset)(struct scsi_cmnd *SCpnt)
 {
    unsigned long flags;

@@ -1746,7 +1746,7 @@ static int fdomain_16x0_release(struct Scsi_Host *shpnt)
 	return 0;
 }

-struct scsi_host_template fdomain_driver_template = {
+struct scsi_host_template GLOBAL(fdomain_driver_template) = {
 	.module			= THIS_MODULE,
 	.name			= "fdomain",
 	.proc_name		= "fdomain",
@@ -1754,7 +1754,7 @@ struct scsi_host_template fdomain_driver_template = {
 	.info			= fdomain_16x0_info,
 	.queuecommand		= fdomain_16x0_queue,
 	.eh_abort_handler	= fdomain_16x0_abort,
-	.eh_bus_reset_handler	= fdomain_16x0_bus_reset,
+	.eh_bus_reset_handler	= GLOBAL(fdomain_16x0_bus_reset),
 	.bios_param		= fdomain_16x0_biosparam,
 	.release		= fdomain_16x0_release,
 	.can_queue		= 1,
@@ -1774,7 +1774,7 @@ static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
 };
 MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
 #endif
-#define driver_template fdomain_driver_template
+#define driver_template GLOBAL(fdomain_driver_template)
 #include "scsi_module.c"

 #endif
diff --git a/drivers/scsi/fdomain.h b/drivers/scsi/fdomain.h
index 47021d9..f026cd6 100644
--- a/drivers/scsi/fdomain.h
+++ b/drivers/scsi/fdomain.h
@@ -18,7 +18,20 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */

-extern struct scsi_host_template fdomain_driver_template;
-extern int fdomain_setup(char *str);
-extern struct Scsi_Host *__fdomain_16x0_detect(struct  scsi_host_template *tpnt );
-extern int fdomain_16x0_bus_reset(struct scsi_cmnd *SCpnt);
+/*
+ * fdomain is compiled in two different ways - for the isa driver and
+ * pcmcia one.  When building the pcmcia one, the file is slightly
+ * modified, so they can't share the same object file.  The following
+ * macro alters a symbol depending on whether pcmcia driver is being
+ * built or not and should be used for any global symbol.
+ */
+#if defined(PCMCIA)
+#define GLOBAL(x)	CS_##x
+#else
+#define GLOBAL(x)	ISA_##x
+#endif
+
+extern struct scsi_host_template GLOBAL(fdomain_driver_template);
+extern int GLOBAL(fdomain_setup)(char *str);
+extern struct Scsi_Host *GLOBAL(__fdomain_16x0_detect)(struct  scsi_host_template *tpnt );
+extern int GLOBAL(fdomain_16x0_bus_reset)(struct scsi_cmnd *SCpnt);
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 2dd0dc9..57f83d1 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -47,13 +47,15 @@

 #include "scsi.h"
 #include <scsi/scsi_host.h>
-#include "aha152x.h"

 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>

+#define PCMCIA	1
+#include "aha152x.h"
+
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
 module_param(pc_debug, int, 0644);
@@ -194,7 +196,7 @@ static int aha152x_config_cs(struct pcmcia_device *link)
     if (ext_trans)
         s.ext_trans = ext_trans;

-    host = aha152x_probe_one(&s);
+    host = GLOBAL(aha152x_probe_one)(&s);
     if (host == NULL) {
 	printk(KERN_INFO "aha152x_cs: no SCSI devices found\n");
 	goto cs_failed;
@@ -216,7 +218,7 @@ static void aha152x_release_cs(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;

-	aha152x_release(info->host);
+	GLOBAL(aha152x_release)(info->host);
 	pcmcia_disable_device(link);
 }

@@ -224,7 +226,7 @@ static int aha152x_resume(struct pcmcia_device *link)
 {
 	scsi_info_t *info = link->priv;

-	aha152x_host_reset_host(info->host);
+	GLOBAL(aha152x_host_reset_host)(info->host);

 	return 0;
 }
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index 4b82b20..b075576 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -44,13 +44,15 @@

 #include "scsi.h"
 #include <scsi/scsi_host.h>
-#include "fdomain.h"

 #include <pcmcia/cs_types.h>
 #include <pcmcia/cs.h>
 #include <pcmcia/cistpl.h>
 #include <pcmcia/ds.h>

+#define PCMCIA	1
+#include "fdomain.h"
+
 /*====================================================================*/

 /* Module parameters */
@@ -161,9 +163,9 @@ static int fdomain_config(struct pcmcia_device *link)

     /* Set configuration options for the fdomain driver */
     sprintf(str, "%d,%d", link->io.BasePort1, link->irq.AssignedIRQ);
-    fdomain_setup(str);
+    GLOBAL(fdomain_setup)(str);

-    host = __fdomain_16x0_detect(&fdomain_driver_template);
+    host = GLOBAL(__fdomain_16x0_detect)(&GLOBAL(fdomain_driver_template));
     if (!host) {
         printk(KERN_INFO "fdomain_cs: no SCSI devices found\n");
 	goto cs_failed;
@@ -202,7 +204,7 @@ static void fdomain_release(struct pcmcia_device *link)

 static int fdomain_resume(struct pcmcia_device *link)
 {
-	fdomain_16x0_bus_reset(NULL);
+	GLOBAL(fdomain_16x0_bus_reset)(NULL);

 	return 0;
 }
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
--

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
  2008-01-18  7:30         ` Kamalesh Babulal
@ 2008-01-18 14:58         ` James Bottomley
  2008-01-18 23:27           ` Tejun Heo
  2008-01-21  9:56         ` Christoph Hellwig
  2 siblings, 1 reply; 17+ messages in thread
From: James Bottomley @ 2008-01-18 14:58 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz


On Fri, 2008-01-18 at 16:20 +0900, Tejun Heo wrote:
> aha152x.c and fdomain are built twice - once for the isa driver and
> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> slightly different; thus, global symbols need to be given different
> names depending on which flavor is being built.  This patch adds
> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> depending on PCMCIA.
> 
> This bug has always existed but has been masked by the fact the
> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> avoided the duplicate symbols during compilation.
> 
> Signed-off-by: Tejun Heo <htejun@gmail.com>
> ---
> Ah... missed that one.  Here's the updated version.

Actually, isn't the better fix just to return to the original behaviour?

As you pointed out, using the subdir instead of obj meant that although
the modules were built, the drivers were never linked into the main
kernel.  According to the records, this has been the default forever, so
there can be no-one anywhere relying on these drivers being built in.
Actually, as old style pcmcia drivers, I'm not sure there's much value
building them into the kernel anyway.

So just modify scsi/pcmcia/Kconfig to make them all depend on m.

James



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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 14:58         ` James Bottomley
@ 2008-01-18 23:27           ` Tejun Heo
  2008-01-18 23:28             ` Tejun Heo
  2008-01-18 23:32             ` James Bottomley
  0 siblings, 2 replies; 17+ messages in thread
From: Tejun Heo @ 2008-01-18 23:27 UTC (permalink / raw)
  To: James Bottomley
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz

James Bottomley wrote:
> On Fri, 2008-01-18 at 16:20 +0900, Tejun Heo wrote:
>> aha152x.c and fdomain are built twice - once for the isa driver and
>> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
>> slightly different; thus, global symbols need to be given different
>> names depending on which flavor is being built.  This patch adds
>> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
>> depending on PCMCIA.
>>
>> This bug has always existed but has been masked by the fact the
>> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
>> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
>> avoided the duplicate symbols during compilation.
>>
>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>> ---
>> Ah... missed that one.  Here's the updated version.
> 
> Actually, isn't the better fix just to return to the original behaviour?
> 
> As you pointed out, using the subdir instead of obj meant that although
> the modules were built, the drivers were never linked into the main
> kernel.  According to the records, this has been the default forever, so
> there can be no-one anywhere relying on these drivers being built in.
> Actually, as old style pcmcia drivers, I'm not sure there's much value
> building them into the kernel anyway.
> 
> So just modify scsi/pcmcia/Kconfig to make them all depend on m.

Yeap, there is no problem if you don't allow them to be linked into the
kernel.  If that's how you want it, please go ahead.

I personally think it's a bit odd to disallow building into kernel
because of the peculiarity of the implementation (including c files and
compiling them slightly differently) and also no one reporting doesn't
necessarily mean no one has attempted it and failed.

Thanks.

-- 
tejun

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 23:27           ` Tejun Heo
@ 2008-01-18 23:28             ` Tejun Heo
  2008-01-18 23:32             ` James Bottomley
  1 sibling, 0 replies; 17+ messages in thread
From: Tejun Heo @ 2008-01-18 23:28 UTC (permalink / raw)
  To: James Bottomley
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz

Tejun Heo wrote:
> James Bottomley wrote:
>> On Fri, 2008-01-18 at 16:20 +0900, Tejun Heo wrote:
>>> aha152x.c and fdomain are built twice - once for the isa driver and
>>> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
>>> slightly different; thus, global symbols need to be given different
>>> names depending on which flavor is being built.  This patch adds
>>> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
>>> depending on PCMCIA.
>>>
>>> This bug has always existed but has been masked by the fact the
>>> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
>>> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
>>> avoided the duplicate symbols during compilation.
>>>
>>> Signed-off-by: Tejun Heo <htejun@gmail.com>
>>> ---
>>> Ah... missed that one.  Here's the updated version.
>> Actually, isn't the better fix just to return to the original behaviour?
>>
>> As you pointed out, using the subdir instead of obj meant that although
>> the modules were built, the drivers were never linked into the main
>> kernel.  According to the records, this has been the default forever, so
>> there can be no-one anywhere relying on these drivers being built in.
>> Actually, as old style pcmcia drivers, I'm not sure there's much value
>> building them into the kernel anyway.
>>
>> So just modify scsi/pcmcia/Kconfig to make them all depend on m.
> 
> Yeap, there is no problem if you don't allow them to be linked into the
> kernel.  If that's how you want it, please go ahead.
> 
> I personally think it's a bit odd to disallow building into kernel
> because of the peculiarity of the implementation (including c files and
> compiling them slightly differently) and also no one reporting doesn't
> necessarily mean no one has attempted it and failed.

Actually what's better would be to make all symbols static and include
the c file directly into the stub file.  How about that?

-- 
tejun

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 23:27           ` Tejun Heo
  2008-01-18 23:28             ` Tejun Heo
@ 2008-01-18 23:32             ` James Bottomley
  2008-01-18 23:46               ` Tejun Heo
  2008-01-18 23:47               ` James Bottomley
  1 sibling, 2 replies; 17+ messages in thread
From: James Bottomley @ 2008-01-18 23:32 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz


On Sat, 2008-01-19 at 08:27 +0900, Tejun Heo wrote:
> James Bottomley wrote:
> > On Fri, 2008-01-18 at 16:20 +0900, Tejun Heo wrote:
> >> aha152x.c and fdomain are built twice - once for the isa driver and
> >> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> >> slightly different; thus, global symbols need to be given different
> >> names depending on which flavor is being built.  This patch adds
> >> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> >> depending on PCMCIA.
> >>
> >> This bug has always existed but has been masked by the fact the
> >> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> >> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> >> avoided the duplicate symbols during compilation.
> >>
> >> Signed-off-by: Tejun Heo <htejun@gmail.com>
> >> ---
> >> Ah... missed that one.  Here's the updated version.
> > 
> > Actually, isn't the better fix just to return to the original behaviour?
> > 
> > As you pointed out, using the subdir instead of obj meant that although
> > the modules were built, the drivers were never linked into the main
> > kernel.  According to the records, this has been the default forever, so
> > there can be no-one anywhere relying on these drivers being built in.
> > Actually, as old style pcmcia drivers, I'm not sure there's much value
> > building them into the kernel anyway.
> > 
> > So just modify scsi/pcmcia/Kconfig to make them all depend on m.
> 
> Yeap, there is no problem if you don't allow them to be linked into the
> kernel.  If that's how you want it, please go ahead.
> 
> I personally think it's a bit odd to disallow building into kernel
> because of the peculiarity of the implementation (including c files and
> compiling them slightly differently) and also no one reporting doesn't
> necessarily mean no one has attempted it and failed.

Heh ... I'll make you a deal.  Find just one user of one of these
drivers who can make use of them built in, and I'll apply the patch.  

I'm just a bit reluctant to touch these drivers, since they're all
incredibly ancient.  We don't have good luck with simple transformation
patches on the older drivers ... and it seems to take months before
anyone notices there's a problem.

James



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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 23:32             ` James Bottomley
@ 2008-01-18 23:46               ` Tejun Heo
  2008-01-18 23:47               ` James Bottomley
  1 sibling, 0 replies; 17+ messages in thread
From: Tejun Heo @ 2008-01-18 23:46 UTC (permalink / raw)
  To: James Bottomley
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz

James Bottomley wrote:
>> I personally think it's a bit odd to disallow building into kernel
>> because of the peculiarity of the implementation (including c files and
>> compiling them slightly differently) and also no one reporting doesn't
>> necessarily mean no one has attempted it and failed.
> 
> Heh ... I'll make you a deal.  Find just one user of one of these
> drivers who can make use of them built in, and I'll apply the patch.  

I don't think I can.  I didn't even know they were isa ones before
actually looking at the code.

> I'm just a bit reluctant to touch these drivers, since they're all
> incredibly ancient.  We don't have good luck with simple transformation
> patches on the older drivers ... and it seems to take months before
> anyone notices there's a problem.

Alright then, please go ahead and disallow built-in.

Thanks.

-- 
tejun

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 23:32             ` James Bottomley
  2008-01-18 23:46               ` Tejun Heo
@ 2008-01-18 23:47               ` James Bottomley
  2008-01-18 23:54                 ` Tejun Heo
  1 sibling, 1 reply; 17+ messages in thread
From: James Bottomley @ 2008-01-18 23:47 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz


On Fri, 2008-01-18 at 17:32 -0600, James Bottomley wrote:
> On Sat, 2008-01-19 at 08:27 +0900, Tejun Heo wrote:
> > James Bottomley wrote:
> > > On Fri, 2008-01-18 at 16:20 +0900, Tejun Heo wrote:
> > >> aha152x.c and fdomain are built twice - once for the isa driver and
> > >> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> > >> slightly different; thus, global symbols need to be given different
> > >> names depending on which flavor is being built.  This patch adds
> > >> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> > >> depending on PCMCIA.
> > >>
> > >> This bug has always existed but has been masked by the fact the
> > >> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> > >> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> > >> avoided the duplicate symbols during compilation.
> > >>
> > >> Signed-off-by: Tejun Heo <htejun@gmail.com>
> > >> ---
> > >> Ah... missed that one.  Here's the updated version.
> > > 
> > > Actually, isn't the better fix just to return to the original behaviour?
> > > 
> > > As you pointed out, using the subdir instead of obj meant that although
> > > the modules were built, the drivers were never linked into the main
> > > kernel.  According to the records, this has been the default forever, so
> > > there can be no-one anywhere relying on these drivers being built in.
> > > Actually, as old style pcmcia drivers, I'm not sure there's much value
> > > building them into the kernel anyway.
> > > 
> > > So just modify scsi/pcmcia/Kconfig to make them all depend on m.
> > 
> > Yeap, there is no problem if you don't allow them to be linked into the
> > kernel.  If that's how you want it, please go ahead.
> > 
> > I personally think it's a bit odd to disallow building into kernel
> > because of the peculiarity of the implementation (including c files and
> > compiling them slightly differently) and also no one reporting doesn't
> > necessarily mean no one has attempted it and failed.
> 
> Heh ... I'll make you a deal.  Find just one user of one of these
> drivers who can make use of them built in, and I'll apply the patch.  
> 
> I'm just a bit reluctant to touch these drivers, since they're all
> incredibly ancient.  We don't have good luck with simple transformation
> patches on the older drivers ... and it seems to take months before
> anyone notices there's a problem.

This is the patch that will return them to their original behaviour.

James

---
diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
index fa481b5..53857c6 100644
--- a/drivers/scsi/pcmcia/Kconfig
+++ b/drivers/scsi/pcmcia/Kconfig
@@ -6,7 +6,8 @@ menuconfig SCSI_LOWLEVEL_PCMCIA
 	bool "PCMCIA SCSI adapter support"
 	depends on SCSI!=n && PCMCIA!=n
 
-if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA
+# drivers have problems when build in, so require modules
+if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA && m
 
 config PCMCIA_AHA152X
 	tristate "Adaptec AHA152X PCMCIA support"



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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18 23:47               ` James Bottomley
@ 2008-01-18 23:54                 ` Tejun Heo
  0 siblings, 0 replies; 17+ messages in thread
From: Tejun Heo @ 2008-01-18 23:54 UTC (permalink / raw)
  To: James Bottomley
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz

James Bottomley wrote:
>> I'm just a bit reluctant to touch these drivers, since they're all
>> incredibly ancient.  We don't have good luck with simple transformation
>> patches on the older drivers ... and it seems to take months before
>> anyone notices there's a problem.
> 
> This is the patch that will return them to their original behaviour.
> 
> James
> 
> ---
> diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
> index fa481b5..53857c6 100644
> --- a/drivers/scsi/pcmcia/Kconfig
> +++ b/drivers/scsi/pcmcia/Kconfig
> @@ -6,7 +6,8 @@ menuconfig SCSI_LOWLEVEL_PCMCIA
>  	bool "PCMCIA SCSI adapter support"
>  	depends on SCSI!=n && PCMCIA!=n
>  
> -if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA
> +# drivers have problems when build in, so require modules
> +if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA && m
>  
>  config PCMCIA_AHA152X
>  	tristate "Adaptec AHA152X PCMCIA support"
> 
> 

Looks good to me.

-- 
tejun

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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
  2008-01-18  7:30         ` Kamalesh Babulal
  2008-01-18 14:58         ` James Bottomley
@ 2008-01-21  9:56         ` Christoph Hellwig
  2008-01-21 14:59           ` James Bottomley
  2 siblings, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2008-01-21  9:56 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Kamalesh Babulal, Andrew Morton, linux-kernel, linux-scsi,
	fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz,
	James Bottomley

On Fri, Jan 18, 2008 at 04:20:40PM +0900, Tejun Heo wrote:
> aha152x.c and fdomain are built twice - once for the isa driver and
> once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> slightly different; thus, global symbols need to be given different
> names depending on which flavor is being built.  This patch adds
> GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> depending on PCMCIA.
> 
> This bug has always existed but has been masked by the fact the
> drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> avoided the duplicate symbols during compilation.

The right fix would be to compile it only once and attach it to both
busses.  It would be nice if someone could look into that instead of
hacking around the issue.


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

* Re: [PATCH] SCSI: fix isa/pcmcia compile problem
  2008-01-21  9:56         ` Christoph Hellwig
@ 2008-01-21 14:59           ` James Bottomley
  0 siblings, 0 replies; 17+ messages in thread
From: James Bottomley @ 2008-01-21 14:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Tejun Heo, Kamalesh Babulal, Andrew Morton, linux-kernel,
	linux-scsi, fischer, Andy Whitcroft, Balbir Singh, Samuel Ortiz


On Mon, 2008-01-21 at 09:56 +0000, Christoph Hellwig wrote:
> On Fri, Jan 18, 2008 at 04:20:40PM +0900, Tejun Heo wrote:
> > aha152x.c and fdomain are built twice - once for the isa driver and
> > once for the PCMCIA one.  Through #ifdefs, the compiled codes are
> > slightly different; thus, global symbols need to be given different
> > names depending on which flavor is being built.  This patch adds
> > GLOBAL() macro to aha152x.h and fdomain.h which change the symbol
> > depending on PCMCIA.
> > 
> > This bug has always existed but has been masked by the fact the
> > drivers/scsi/pcmcia used subdir-(y|m) instead of obj-(y|m) which made
> > drivers/scsi/pcmcia/built_in.o not linked into the kernel and thus
> > avoided the duplicate symbols during compilation.
> 
> The right fix would be to compile it only once and attach it to both
> busses.  It would be nice if someone could look into that instead of
> hacking around the issue.

I agree in principle, but without the hardware such a change would be
untested ... which is what makes me worry about it.

James



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

end of thread, other threads:[~2008-01-21 14:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080117023514.9df393cf.akpm@linux-foundation.org>
2008-01-17 16:15 ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
2008-01-17 19:11   ` Andrew Morton
2008-01-18  0:53     ` [PATCH] aha152x: fix isa/pcmcia compile problem Tejun Heo
2008-01-18  6:29       ` Kamalesh Babulal
2008-01-18  6:37     ` 2.6.24-rc8-mm1 Build Failure on scsi driver Kamalesh Babulal
2008-01-18  7:20       ` [PATCH] SCSI: fix isa/pcmcia compile problem Tejun Heo
2008-01-18  7:30         ` Kamalesh Babulal
2008-01-18 14:58         ` James Bottomley
2008-01-18 23:27           ` Tejun Heo
2008-01-18 23:28             ` Tejun Heo
2008-01-18 23:32             ` James Bottomley
2008-01-18 23:46               ` Tejun Heo
2008-01-18 23:47               ` James Bottomley
2008-01-18 23:54                 ` Tejun Heo
2008-01-21  9:56         ` Christoph Hellwig
2008-01-21 14:59           ` James Bottomley
2008-01-18  7:27       ` 2.6.24-rc8-mm1 Build Failure on scsi driver Andrew Morton

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).