Re: [patch] RFC: Namespace-collision between SIM710 and 53C7,8XX

Richard Hirst (richard@sleepie.demon.co.uk)
Tue, 19 Oct 1999 00:24:20 +0100


Regarding namespace collision between drivers/scsi/sim710_d.c and
53c7,8xx.c.

The attached patch makes the variables generated by script_asm.pl static,
so you can compile in both sim710.c and 53c7,8xx.c. Unfortunately it
is not perfect, as you now get a bunch of 'defined but not used' warnings.
I cannot easily get rid of the unused variables, as script_asm.pl is
used by multiple drivers and doesn't know which variables a driver is
going to reference.

Options seem to be

a) Stay as we are - 53c7,8xx.c supports 53c810 chips and sim710.c
supports 53c710; if you want to build support for both chips in to one
kernel then use ncr53c8xx.c instead of 53c7,8xx.c

b) Use the patch below, if we can get rid of the warnings

c) Change script_asm.pl to add some unique prefix to symbols, so
the symbols stay global but don't clash (change drivers to match).

Does anyone have a preference?

Richard

diff -ur -x *.o linux-2.3.22clean/drivers/scsi/script_asm.pl linux-2.3.22/drivers/scsi/script_asm.pl
--- linux-2.3.22clean/drivers/scsi/script_asm.pl Mon Oct 18 22:52:21 1999
+++ linux-2.3.22/drivers/scsi/script_asm.pl Mon Oct 18 22:54:55 1999
@@ -896,7 +896,7 @@
open (OUTPUT, ">$output") || die "$0 : can't open $output for writing\n";
open (OUTPUTU, ">$outputu") || die "$0 : can't open $outputu for writing\n";

-print OUTPUT "u32 ".$prefix."SCRIPT[] = {\n";
+print OUTPUT "static u32 ".$prefix."SCRIPT[] = {\n";
$instructions = 0;
for ($i = 0; $i < $#code; ) {
if ($list_in_array) {
@@ -935,7 +935,7 @@
}
printf OUTPUTU "#undef A_$i\n";

- printf OUTPUT "u32 A_".$i."_used\[\] = {\n";
+ printf OUTPUT "static u32 A_".$i."_used\[\] = {\n";
printf STDERR "$i is used $symbol_references{$i}\n" if ($debug);
foreach $j (split (/\s+/,$symbol_references{$i})) {
$j =~ /(ABS|REL),(.*),(.*)/;
@@ -957,14 +957,14 @@
# NCR assembler outputs label patches in the form of indices into
# the code.
#
-printf OUTPUT "u32 ".$prefix."LABELPATCHES[] = {\n";
+printf OUTPUT "static u32 ".$prefix."LABELPATCHES[] = {\n";
for $patch (sort {$a <=> $b} @label_patches) {
printf OUTPUT "\t0x%08x,\n", $patch;
}
printf OUTPUT "};\n\n";

$num_external_patches = 0;
-printf OUTPUT "struct {\n\tu32\toffset;\n\tvoid\t\t*address;\n".
+printf OUTPUT "static struct {\n\tu32\toffset;\n\tvoid\t\t*address;\n".
"} ".$prefix."EXTERNAL_PATCHES[] = {\n";
while ($ident = pop(@external_patches)) {
$off = pop(@external_patches);
@@ -973,11 +973,11 @@
}
printf OUTPUT "};\n\n";

-printf OUTPUT "u32 ".$prefix."INSTRUCTIONS\t= %d;\n",
+printf OUTPUT "static u32 ".$prefix."INSTRUCTIONS\t= %d;\n",
$instructions;
-printf OUTPUT "u32 ".$prefix."PATCHES\t= %d;\n",
+printf OUTPUT "static u32 ".$prefix."PATCHES\t= %d;\n",
$#label_patches+1;
-printf OUTPUT "u32 ".$prefix."EXTERNAL_PATCHES_LEN\t= %d;\n",
+printf OUTPUT "static u32 ".$prefix."EXTERNAL_PATCHES_LEN\t= %d;\n",
$num_external_patches;
close OUTPUT;
close OUTPUTU;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/