Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753832AbYARHVJ (ORCPT ); Fri, 18 Jan 2008 02:21:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750946AbYARHU4 (ORCPT ); Fri, 18 Jan 2008 02:20:56 -0500 Received: from wa-out-1112.google.com ([209.85.146.178]:65340 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750950AbYARHUz (ORCPT ); Fri, 18 Jan 2008 02:20:55 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=sKihEWfRDhesdx30dapqU4cLZILhCAYu1nhp+1bgXtukj2a+BKFd6dCDwylq34uRIe4OzHReD0/Hyb08RfL8M/m4wRX3tyxC4A6yihl1Hymzfz0WxKuDoCTKduUiQXM865TGj6UiYHf6cwEvZPhkgnsdAv+Rl37QJhEkSzKH4bs= Message-ID: <47905348.1000709@gmail.com> Date: Fri, 18 Jan 2008 16:20:40 +0900 From: Tejun Heo User-Agent: Thunderbird 2.0.0.9 (X11/20070801) MIME-Version: 1.0 To: Kamalesh Babulal CC: Andrew Morton , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org, fischer@norbit.de, Andy Whitcroft , Balbir Singh , Samuel Ortiz , James Bottomley Subject: [PATCH] SCSI: fix isa/pcmcia compile problem References: <20080117023514.9df393cf.akpm@linux-foundation.org> <478F7F2B.9000801@linux.vnet.ibm.com> <20080117111104.3baa878e.akpm@linux-foundation.org> <47904927.1040000@linux.vnet.ibm.com> In-Reply-To: <47904927.1040000@linux.vnet.ibm.com> X-Enigmail-Version: 0.95.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10709 Lines: 324 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 --- 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 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 -#include "aha152x.h" #include #include #include #include +#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 -#include "fdomain.h" #include #include #include #include +#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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/