linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [BUG 380][PATCHv2] SB16 compile errors
@ 2003-03-09 10:39 shaheed
  2003-03-25 22:21 ` [PROBLEM] SB16 fails to compile: ISA PNP issues shaheed
  0 siblings, 1 reply; 6+ messages in thread
From: shaheed @ 2003-03-09 10:39 UTC (permalink / raw)
  To: Lukas; +Cc: linux-kernel


BTW, I am trying to get a 2.5'ified and PNP'ified version of this going. I 
hope to have a patch for Jaroslev in the next week or so...



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

* Re: [PROBLEM] SB16 fails to compile: ISA PNP issues
  2003-03-25 19:12   ` Adam Belay
@ 2003-03-25 15:30     ` Joe Rayhawk
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Rayhawk @ 2003-03-25 15:30 UTC (permalink / raw)
  To: Adam Belay; +Cc: linux-kernel, shaheed

With everything compiled into the kernel, ISAPNP initializes -after- ALSA initializes, so ALSA fails to find the card. Good news is that ISAPNP does indeed find the card. Is there some way to re-init ALSA or get it to do a rescan?

Syslog stuff:

isapnp: Scanning for PnP cards...
pnp: Calling quirk for 01:01.00
pnp: SB audio device quirk - increasing port range
isapnp: Card 'Creative SB16 PnP'
isapnp: 1 Plug & Play card detected total
[...]
Advanced Linux Sound Architecture Driver Version 0.9.2 (Thu Mar 20 13:31:57 2003 UTC).
request_module: failed /sbin/modprobe -- snd-card-0. error = -16
ALSA sound/drivers/mpu401/mpu401.c:76: specify port
pnp: the driver 'sb16' has been registered
ALSA sound/pci/intel8x0.c:2560: joystick(s) found
ALSA device list:
  No soundcards found.
[...]
Board 1 has Identity 59 10 08 23 bc 24 00 8c 1e:  GTL0024 Serial No 268968892 [checksum 59]
GTL0024/268968892[0]{Audio               }: Ports 0x220 0x330 0x388; IRQ5 DMA1 DMA3 --- Enabled OK
GTL0024/268968892[3]{Game                }: --- Enabled OK  

cat /proc/asound/cards
--- no soundcards ---

cat /etc/isapnp.conf | grep -v \#
(READPORT 0x0273)
(ISOLATE PRESERVE)
(IDENTIFY *)
(VERBOSITY 2)
(CONFIGURE GTL0024/268968892 (LD 0
(INT 0 (IRQ 5 (MODE +E)))
(DMA 0 (CHANNEL 1))
(DMA 1 (CHANNEL 3))
(IO 0 (SIZE 16) (BASE 0x0220))
(IO 1 (SIZE 2) (BASE 0x0330))
(IO 2 (SIZE 4) (BASE 0x0388))
 (NAME "GTL0024/268968892[0]{Audio               }")
(ACT Y)
))
(CONFIGURE GTL0024/268968892 (LD 1
 (NAME "GTL0024/268968892[3]{Game                }")
 (ACT Y)
))
(WAITFORKEY)
# Note: This config works fine for OSS in 2.4


Next I compiled ALSA as a module so I could get it to rescan after ISAPNP goes to work. SB16 is modularized as a result of this, but upon attempting to compile, I get this:

make -f scripts/Makefile.build obj=sound/isa/sb
   rm -f sound/isa/sb/built-in.o; ar rcs sound/isa/sb/built-in.o
  gcc -Wp,-MD,sound/isa/sb/.emu8000_synth.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=emu8000_synth -DKBUILD_MODNAME=snd_emu8000_synth -c -o sound/isa/sb/emu8000_synth.o sound/isa/sb/emu8000_synth.c
  gcc -Wp,-MD,sound/isa/sb/.emu8000_callback.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=emu8000_callback -DKBUILD_MODNAME=snd_emu8000_synth -c -o sound/isa/sb/emu8000_callback.o sound/isa/sb/emu8000_callback.c
  gcc -Wp,-MD,sound/isa/sb/.emu8000_patch.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=emu8000_patch -DKBUILD_MODNAME=snd_emu8000_synth -c -o sound/isa/sb/emu8000_patch.o sound/isa/sb/emu8000_patch.c
  gcc -Wp,-MD,sound/isa/sb/.emu8000_pcm.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=emu8000_pcm -DKBUILD_MODNAME=snd_emu8000_synth -c -o sound/isa/sb/emu8000_pcm.o sound/isa/sb/emu8000_pcm.c
  gcc -Wp,-MD,sound/isa/sb/.sb_common.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=sb_common -DKBUILD_MODNAME=snd_sb_common -c -o sound/isa/sb/sb_common.o sound/isa/sb/sb_common.c
  gcc -Wp,-MD,sound/isa/sb/.sb_mixer.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=sb_mixer -DKBUILD_MODNAME=snd_sb_common -c -o sound/isa/sb/sb_mixer.o sound/isa/sb/sb_mixer.c
  gcc -Wp,-MD,sound/isa/sb/.sb16_csp.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=sb16_csp -DKBUILD_MODNAME=snd_sb16_csp -c -o sound/isa/sb/sb16_csp.o sound/isa/sb/sb16_csp.c
  gcc -Wp,-MD,sound/isa/sb/.sb16_main.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=sb16_main -DKBUILD_MODNAME=snd_sb16_dsp -c -o sound/isa/sb/sb16_main.o sound/isa/sb/sb16_main.c
  gcc -Wp,-MD,sound/isa/sb/.sb16.o.d -D__KERNEL__ -Iinclude -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -Iinclude/asm-i386/mach-default -nostdinc -iwithprefix include -DMODULE -DKBUILD_BASENAME=sb16 -DKBUILD_MODNAME=snd_sb16 -c -o sound/isa/sb/sb16.o sound/isa/sb/sb16.c
sound/isa/sb/sb16.c:251: storage size of `__mod_pnp_card_device_table' isn't known
make[3]: *** [sound/isa/sb/sb16.o] Error 1
make[2]: *** [sound/isa/sb] Error 2
make[1]: *** [sound/isa] Error 2
make: *** [sound] Error 2

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

* Re: [PROBLEM] SB16 fails to compile: ISA PNP issues
  2003-03-25 22:21 ` [PROBLEM] SB16 fails to compile: ISA PNP issues shaheed
@ 2003-03-25 19:12   ` Adam Belay
  2003-03-25 15:30     ` Joe Rayhawk
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Belay @ 2003-03-25 19:12 UTC (permalink / raw)
  To: Joe Rayhawk; +Cc: linux-kernel, shaheed

On Tue, Mar 25, 2003 at 10:21:59PM +0000, shaheed wrote:
> Joe,
> 
> Adam Belay (cc'd) has a compiled-but-not-tested fix for this, and several 
> other cards: sadly the hardware with my SB16 died before I could do the 
> testing.
> 
> Your offer of testing is probably *just* what he needs...
>

Thanks for bringing this to my attention.  Yes, the sb code needs testors.
Below is the latest patch.  Please note that the legacy detection code
could be cleaned up some more.

Thanks,
Adam

--- a/sound/isa/sb/sb16.c	Mon Mar 24 22:01:16 2003
+++ b/sound/isa/sb/sb16.c	Mon Mar 24 20:33:11 2003
@@ -23,11 +23,7 @@
 #include <asm/dma.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#ifndef LINUX_ISAPNP_H
-#include <linux/isapnp.h>
-#define isapnp_card pci_bus
-#define isapnp_dev pci_dev
-#endif
+#include <linux/pnp.h>
 #include <sound/core.h>
 #include <sound/sb.h>
 #include <sound/sb16_csp.h>
@@ -77,7 +73,7 @@
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
 #endif
 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;	/* 0x220,0x240,0x260,0x280 */
@@ -106,10 +102,10 @@
 MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
 MODULE_PARM_DESC(enable, "Enable SoundBlaster 16 soundcard.");
 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC);
-#ifdef __ISAPNP__
-MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
-MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
-MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC);
+#ifdef CONFIG_PNP
+MODULE_PARM(pnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");
+MODULE_PARM_DESC(pnp, "PnP detection for specified soundcard.");
+MODULE_PARM_SYNTAX(pnp, SNDRV_ISAPNP_DESC);
 #endif
 MODULE_PARM(port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");
 MODULE_PARM_DESC(port, "Port # for SB16 driver.");
@@ -148,231 +144,211 @@
 MODULE_PARM_SYNTAX(seq_ports, SNDRV_ENABLED ",allows:{{0,8}},skill:advanced");
 #endif

-struct snd_sb16 {
+struct snd_card_sb16 {
 	struct resource *fm_res;	/* used to block FM i/o region for legacy cards */
-#ifdef __ISAPNP__
-	struct isapnp_dev *dev;
+#ifdef CONFIG_PNP
+	int dev_no;
+	struct pnp_dev *dev;
 #ifdef SNDRV_SBAWE_EMU8000
-	struct isapnp_dev *devwt;
+	struct pnp_dev *devwt;
 #endif
 #endif
 };
 
-static snd_card_t *snd_sb16_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
-
-#ifdef __ISAPNP__
-
-static struct isapnp_card *snd_sb16_isapnp_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
-static const struct isapnp_card_id *snd_sb16_isapnp_id[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
-
-#define ISAPNP_SB16(_va, _vb, _vc, _device, _audio) \
-	{ \
-		ISAPNP_CARD_ID(_va, _vb, _vc, _device), \
-		.devs = { ISAPNP_DEVICE_ID(_va, _vb, _vc, _audio), } \
-	}
-#define ISAPNP_SBAWE(_va, _vb, _vc, _device, _audio, _awe) \
-	{ \
-		ISAPNP_CARD_ID(_va, _vb, _vc, _device), \
-		.devs = { ISAPNP_DEVICE_ID(_va, _vb, _vc, _audio), \
-			 ISAPNP_DEVICE_ID(_va, _vb, _vc, _awe), } \
-	}
+static snd_card_t *snd_sb16_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
-static struct isapnp_card_id snd_sb16_pnpids[] __devinitdata = {
+static struct pnp_card_id snd_sb16_pnpids[] __devinitdata = {
 #ifndef SNDRV_SBAWE
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0024,0x0031),
+	{ .id = "CTL0024", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0025,0x0031),
+	{ .id = "CTL0025", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0026,0x0031),
+	{ .id = "CTL0026", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0027,0x0031),
+	{ .id = "CTL0027", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0028,0x0031),
+	{ .id = "CTL0028", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x0029,0x0031),
+	{ .id = "CTL0029", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x002a,0x0031),
+	{ .id = "CTL002a", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
 	/* Note: This card has also a CTL0051:StereoEnhance device!!! */
-	ISAPNP_SB16('C','T','L',0x002b,0x0031),
+	{ .id = "CTL002b", .devs = { { "CTL0031" } } },
 	/* Sound Blaster 16 PnP */
-	ISAPNP_SB16('C','T','L',0x002c,0x0031),	
+	{ .id = "CTL002c", .devs = { { "CTL0031" } } },
 	/* Sound Blaster Vibra16S */
-	ISAPNP_SB16('C','T','L',0x0051,0x0001),
+	{ .id = "CTL0051", .devs = { { "CTL0001" } } },
 	/* Sound Blaster Vibra16C */
-	ISAPNP_SB16('C','T','L',0x0070,0x0001),
+	{ .id = "CTL0070", .devs = { { "CTL0001" } } },
 	/* Sound Blaster Vibra16CL - added by ctm@ardi.com */
-	ISAPNP_SB16('C','T','L',0x0080,0x0041),
+	{ .id = "CTL0080", .devs = { { "CTL0041" } } },
 	/* Sound Blaster 16 'value' PnP. It says model ct4130 on the pcb, */
 	/* but ct4131 on a sticker on the board.. */
-	ISAPNP_SB16('C','T','L',0x0086,0x0041),
+	{ .id = "CTL0086", .devs = { { "CTL0041" } } },
 	/* Sound Blaster Vibra16X */
-	ISAPNP_SB16('C','T','L',0x00f0,0x0043),
+	{ .id = "CTL00f0", .devs = { { "CTL0043" } } },
 #else  /* SNDRV_SBAWE defined */
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0035,0x0031,0x0021),
+	{ .id = "CTL0035", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0039,0x0031,0x0021),
+	{ .id = "CTL0039", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0042,0x0031,0x0021),
+	{ .id = "CTL0042", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0043,0x0031,0x0021),
+	{ .id = "CTL0043", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
 	/* Note: This card has also a CTL0051:StereoEnhance device!!! */
-	ISAPNP_SBAWE('C','T','L',0x0044,0x0031,0x0021),
+	{ .id = "CTL0044", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
 	/* Note: This card has also a CTL0051:StereoEnhance device!!! */
-	ISAPNP_SBAWE('C','T','L',0x0045,0x0031,0x0021),
+	{ .id = "CTL0045", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0046,0x0031,0x0021),
+	{ .id = "CTL0046", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0047,0x0031,0x0021),
+	{ .id = "CTL0047", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0048,0x0031,0x0021),
+	{ .id = "CTL0048", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x0054,0x0031,0x0021),
+	{ .id = "CTL0054", .devs = { { "CTL0031" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x009a,0x0041,0x0021),
+	{ .id = "CTL009a", .devs = { { "CTL0041" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x009c,0x0041,0x0021),
+	{ .id = "CTL009c", .devs = { { "CTL0041" }, { "CTL0021" } } },
 	/* Sound Blaster 32 PnP */
-	ISAPNP_SBAWE('C','T','L',0x009f,0x0041,0x0021),
+	{ .id = "CTL009f", .devs = { { "CTL0041" }, { "CTL0021" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x009d,0x0042,0x0022),
+	{ .id = "CTL009d", .devs = { { "CTL0042" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP Gold */
-	ISAPNP_SBAWE('C','T','L',0x009e,0x0044,0x0023),
+	{ .id = "CTL009e", .devs = { { "CTL0044" }, { "CTL0023" } } },
 	/* Sound Blaster AWE 64 PnP Gold */
-	ISAPNP_SBAWE('C','T','L',0x00b2,0x0044,0x0023),
+	{ .id = "CTL00b2", .devs = { { "CTL0044" }, { "CTL0023" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00c1,0x0042,0x0022),
+	{ .id = "CTL00c1", .devs = { { "CTL0042" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00c3,0x0045,0x0022),
+	{ .id = "CTL00c3", .devs = { { "CTL0045" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00c5,0x0045,0x0022),
+	{ .id = "CTL00c5", .devs = { { "CTL0045" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00c7,0x0045,0x0022),
+	{ .id = "CTL00c7", .devs = { { "CTL0045" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00e4,0x0045,0x0022),
+	{ .id = "CTL00e4", .devs = { { "CTL0045" }, { "CTL0022" } } },
 	/* Sound Blaster AWE 64 PnP */
-	ISAPNP_SBAWE('C','T','L',0x00e9,0x0045,0x0022),
+	{ .id = "CTL00e9", .devs = { { "CTL0045" }, { "CTL0022" } } },
 	/* Sound Blaster 16 PnP (AWE) */
-	ISAPNP_SBAWE('C','T','L',0x00ed,0x0041,0x0070),
+	{ .id = "CTL00ed", .devs = { { "CTL0041" }, { "CTL0070" } } },
 	/* Generic entries */
-	ISAPNP_SBAWE('C','T','L',ISAPNP_ANY_ID,0x0031,0x0021),
-	ISAPNP_SBAWE('C','T','L',ISAPNP_ANY_ID,0x0041,0x0021),
-	ISAPNP_SBAWE('C','T','L',ISAPNP_ANY_ID,0x0042,0x0022),
-	ISAPNP_SBAWE('C','T','L',ISAPNP_ANY_ID,0x0044,0x0023),
-	ISAPNP_SBAWE('C','T','L',ISAPNP_ANY_ID,0x0045,0x0022),
+	{ .id = "CTLXXXX" , .devs = { { "CTL0031" }, { "CTL0021" } } },
+	{ .id = "CTLXXXX" , .devs = { { "CTL0041" }, { "CTL0021" } } },
+	{ .id = "CTLXXXX" , .devs = { { "CTL0042" }, { "CTL0022" } } },
+	{ .id = "CTLXXXX" , .devs = { { "CTL0044" }, { "CTL0023" } } },
+	{ .id = "CTLXXXX" , .devs = { { "CTL0045" }, { "CTL0022" } } },
 #endif /* SNDRV_SBAWE */
-	{ ISAPNP_CARD_END, }
+	{ .id = "", }
 };
 
-ISAPNP_CARD_TABLE(snd_sb16_pnpids);
+MODULE_DEVICE_TABLE(pnp_card, snd_sb16_pnpids);
 
-static int __init snd_sb16_isapnp(int dev, struct snd_sb16 *acard)
+#ifdef SNDRV_SBAWE_EMU8000
+#define DRIVER_NAME	"snd-card-sbawe"
+#else
+#define DRIVER_NAME	"snd-card-sb16"
+#endif
+
+static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
+				       struct pnp_card_link *card,
+				       const struct pnp_card_id *id)
 {
-	const struct isapnp_card_id *id = snd_sb16_isapnp_id[dev];
-	struct isapnp_card *card = snd_sb16_isapnp_cards[dev];
-	struct isapnp_dev *pdev;
-
-	acard->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);
-	if (acard->dev->active) {
-		acard->dev = NULL;
-		return -EBUSY;
-	}
-#ifdef SNDRV_SBAWE_EMU8000
-	acard->devwt = isapnp_find_dev(card, id->devs[1].vendor, id->devs[1].function, NULL);
-	if (acard->devwt->active) {
-		acard->dev = acard->devwt = NULL;
-		return -EBUSY;
-	}
-#endif	
+	struct pnp_dev *pdev;
+	struct pnp_resource_table * cfg = kmalloc(GFP_ATOMIC, sizeof(struct pnp_resource_table));
+	int err;
+
+	if (!cfg) 
+		return -ENOMEM; 
+	acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
+	if (acard->dev == NULL) { 
+		kfree(cfg); 
+		return -ENODEV; 
+	} 
+#ifdef SNDRV_SBAWE_EMU8000
+	acard->devwt = pnp_request_card_device(card, id->devs[1].id, acard->dev);
+#endif
 	/* Audio initialization */
 	pdev = acard->dev;
-	if (pdev->prepare(pdev) < 0)
-		return -EAGAIN;
+
+	pnp_init_resource_table(cfg); 
+	 
+	/* override resources */ 
+
 	if (port[dev] != SNDRV_AUTO_PORT)
-		isapnp_resource_change(&pdev->resource[0], port[dev], 16);
+		pnp_resource_change(&cfg->port_resource[0], port[dev], 16);
 	if (mpu_port[dev] != SNDRV_AUTO_PORT)
-		isapnp_resource_change(&pdev->resource[1], mpu_port[dev], 2);
+		pnp_resource_change(&cfg->port_resource[1], mpu_port[dev], 2);
 	if (fm_port[dev] != SNDRV_AUTO_PORT)
-		isapnp_resource_change(&pdev->resource[2], fm_port[dev], 4);
+		pnp_resource_change(&cfg->port_resource[2], fm_port[dev], 4);
 	if (dma8[dev] != SNDRV_AUTO_DMA)
-		isapnp_resource_change(&pdev->dma_resource[0], dma8[dev], 1);
+		pnp_resource_change(&cfg->dma_resource[0], dma8[dev], 1);
 	if (dma16[dev] != SNDRV_AUTO_DMA)
-		isapnp_resource_change(&pdev->dma_resource[1], dma16[dev], 1);
+		pnp_resource_change(&cfg->dma_resource[1], dma16[dev], 1);
 	if (irq[dev] != SNDRV_AUTO_IRQ)
-		isapnp_resource_change(&pdev->irq_resource[0], irq[dev], 1);
-	if (pdev->activate(pdev) < 0) {
-		printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n");
-		return -EBUSY;
-	}
-	port[dev] = pdev->resource[0].start;
-	mpu_port[dev] = pdev->resource[1].start;
-	fm_port[dev] = pdev->resource[2].start;
-	dma8[dev] = pdev->dma_resource[0].start;
-	dma16[dev] = pdev->dma_resource[1].start;
-	irq[dev] = pdev->irq_resource[0].start;
-	snd_printdd("isapnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n",
+		pnp_resource_change(&cfg->irq_resource[0], irq[dev], 1);
+	if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0) 
+		printk(KERN_ERR PFX "AUDIO the requested resources are invalid, using auto config\n"); 
+	err = pnp_activate_dev(pdev); 
+	if (err < 0) { 
+		printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); 
+		kfree(cfg);
+		return err; 
+	} 
+	port[dev] = pnp_port_start(pdev, 0);
+	mpu_port[dev] = pnp_port_start(pdev, 1);
+	fm_port[dev] = pnp_port_start(pdev, 2);
+	dma8[dev] = pnp_dma(pdev, 0);
+	dma16[dev] = pnp_dma(pdev, 1);
+	irq[dev] = pnp_irq(pdev, 0);
+	snd_printdd("pnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n",
 			port[dev], mpu_port[dev], fm_port[dev]);
-	snd_printdd("isapnp SB16: dma1=%i, dma2=%i, irq=%i\n",
+	snd_printdd("pnp SB16: dma1=%i, dma2=%i, irq=%i\n",
 			dma8[dev], dma16[dev], irq[dev]);
 #ifdef SNDRV_SBAWE_EMU8000
 	/* WaveTable initialization */
 	pdev = acard->devwt;
-	if (pdev->prepare(pdev)<0) {
-		acard->dev->deactivate(acard->dev);
-		return -EAGAIN;
-	}
-	if (awe_port[dev] != SNDRV_AUTO_PORT) {
-		isapnp_resource_change(&pdev->resource[0], awe_port[dev], 4);
-		isapnp_resource_change(&pdev->resource[1], awe_port[dev] + 0x400, 4);
-		isapnp_resource_change(&pdev->resource[2], awe_port[dev] + 0x800, 4);
-	}
-	if (pdev->activate(pdev)<0) {
-		printk(KERN_ERR PFX "WaveTable isapnp configure failure (out of resources?)\n");
-		acard->dev->deactivate(acard->dev);		
-		return -EBUSY;
-	}
-	awe_port[dev] = pdev->resource[0].start;
-	snd_printdd("isapnp SB16: wavetable port=0x%lx\n", pdev->resource[0].start);
-#endif
-	return 0;
-}
-
-static void snd_sb16_deactivate(struct snd_sb16 *acard)
-{
-	if (acard->dev) {
-		acard->dev->deactivate(acard->dev);
-		acard->dev = NULL;
-	}
-#ifdef SNDRV_SBAWE_EMU8000
-	if (acard->devwt) {
-		acard->devwt->deactivate(acard->devwt);
+	if (pdev != NULL) {
+		pnp_init_resource_table(cfg); 
+	 
+		/* override resources */ 
+
+		if (awe_port[dev] != SNDRV_AUTO_PORT) {
+			pnp_resource_change(&cfg->port_resource[0], awe_port[dev], 4);
+			pnp_resource_change(&cfg->port_resource[1], awe_port[dev] + 0x400, 4);
+			pnp_resource_change(&cfg->port_resource[2], awe_port[dev] + 0x800, 4);
+		}
+		if ((pnp_manual_config_dev(pdev, cfg, 0)) < 0) 
+			printk(KERN_ERR PFX "WaveTable the requested resources are invalid, using auto config\n"); 
+		err = pnp_activate_dev(pdev); 
+		if (err < 0) { 
+			goto __wt_error; 
+		} 
+		awe_port[dev] = pnp_port_start(pdev, 0);
+		snd_printdd("pnp SB16: wavetable port=0x%lx\n", pdev->resource[0].start);
+	} else {
+__wt_error:
+		if (pdev) {
+			pnp_release_card_device(pdev);
+			printk(KERN_ERR PFX "WaveTable pnp configure failure\n");
+		}
 		acard->devwt = NULL;
+		awe_port[dev] = -1;
 	}
 #endif
+	kfree(cfg);
+	return 0;
 }
 
-#endif /* __ISAPNP__ */
-
-static void snd_sb16_free(snd_card_t *card)
-{
-	struct snd_sb16 *acard = (struct snd_sb16 *)card->private_data;
-
-	if (acard == NULL)
-		return;
-	if (acard->fm_res) {
-		release_resource(acard->fm_res);
-		kfree_nocheck(acard->fm_res);
-	}
-#ifdef __ISAPNP__
-	snd_sb16_deactivate(acard);
-#endif
-}
-
-static int __init snd_sb16_probe(int dev)
+static int __init snd_sb16_probe(int dev,
+				 struct pnp_card_link *pcard,
+				 const struct pnp_card_id *pid)
 {
 	static int possible_irqs[] = {5, 9, 10, 7, -1};
 	static int possible_dmas8[] = {1, 3, 0, -1};
@@ -380,7 +356,7 @@
 	int xirq, xdma8, xdma16;
 	sb_t *chip;
 	snd_card_t *card;
-	struct snd_sb16 *acard;
+	struct snd_card_sb16 *acard;
 	opl3_t *opl3;
 	snd_hwdep_t *synth = NULL;
 #ifdef CONFIG_SND_SB16_CSP
@@ -390,22 +366,21 @@
 	int err;
 
 	card = snd_card_new(index[dev], id[dev], THIS_MODULE,
-			    sizeof(struct snd_sb16));
+			    sizeof(struct snd_card_sb16));
 	if (card == NULL)
 		return -ENOMEM;
-	acard = (struct snd_sb16 *) card->private_data;
-	card->private_free = snd_sb16_free;
-#ifdef __ISAPNP__
-	if (isapnp[dev] && snd_sb16_isapnp(dev, acard) < 0) {
-		snd_card_free(card);
-		return -EBUSY;
+	acard = (struct snd_card_sb16 *) card->private_data;
+	if (isapnp[dev]) {
+		if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {
+			snd_card_free(card);
+			return err;
+		}
 	}
-#endif
 
 	xirq = irq[dev];
 	xdma8 = dma8[dev];
 	xdma16 = dma16[dev];
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 	if (!isapnp[dev]) {
 #endif
 	if (xirq == SNDRV_AUTO_IRQ) {
@@ -437,7 +412,7 @@
 	/* non-PnP AWE port address is hardwired with base port address */
 	awe_port[dev] = port[dev] + 0x400;
 #endif
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 	}
 #endif
 
@@ -458,7 +433,7 @@
 		return -ENODEV;
 	}
 	chip->mpu_port = mpu_port[dev];
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 	if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) {
 #else
 	if ((err = snd_sb16dsp_configure(chip)) < 0) {
@@ -554,7 +529,10 @@
 		snd_card_free(card);
 		return err;
 	}
-	snd_sb16_cards[dev] = card;
+	if (pcard)
+		pnp_set_card_drvdata(pcard, card);
+	else
+		snd_sb16_legacy[dev] = card;
 	return 0;
 }
 
@@ -566,12 +544,12 @@
 	for ( ; dev < SNDRV_CARDS; dev++) {
 		if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
 			continue;
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 		if (isapnp[dev])
 			continue;
 #endif
 		port[dev] = xport;
-		res = snd_sb16_probe(dev);
+		res = snd_sb16_probe(dev, NULL, NULL);
 		if (res < 0)
 			port[dev] = SNDRV_AUTO_PORT;
 		return res;
@@ -579,10 +557,10 @@
 	return -ENODEV;
 }
 
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 
-static int __init snd_sb16_isapnp_detect(struct isapnp_card *card,
-					 const struct isapnp_card_id *id)
+static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *card,
+					 const struct pnp_card_id *id)
 {
 	static int dev;
 	int res;
@@ -590,9 +568,7 @@
 	for ( ; dev < SNDRV_CARDS; dev++) {
 		if (!enable[dev] || !isapnp[dev])
 			continue;
-		snd_sb16_isapnp_cards[dev] = card;
-		snd_sb16_isapnp_id[dev] = id;
-		res = snd_sb16_probe(dev);
+		res = snd_sb16_probe(dev, card, id);
 		if (res < 0)
 			return res;
 		dev++;
@@ -602,7 +578,23 @@
 	return -ENODEV;
 }
 
-#endif /* __ISAPNP__ */
+#endif
+
+static void __devexit snd_sb16_pnp_remove(struct pnp_card_link * pcard)
+{
+	snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard);
+
+	snd_card_disconnect(card);
+	snd_card_free_in_thread(card);
+}
+
+static struct pnp_card_driver sb16_pnpc_driver = {
+	.flags = PNP_DRIVER_RES_DISABLE,
+	.name = "sb16",
+	.id_table = snd_sb16_pnpids,
+	.probe = snd_sb16_pnp_detect,
+	.remove = __devexit_p(snd_sb16_pnp_remove),
+};
 
 static int __init alsa_card_sb16_init(void)
 {
@@ -613,23 +605,23 @@
 	for (dev = 0; dev < SNDRV_CARDS; dev++) {
 		if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
 			continue;
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 		if (isapnp[dev])
 			continue;
 #endif
-		if (!snd_sb16_probe(dev)) {
+		if (!snd_sb16_probe(dev, NULL, NULL)) {
 			cards++;
 			continue;
 		}
 #ifdef MODULE
 		printk(KERN_ERR "Sound Blaster 16+ soundcard #%i not found at 0x%lx or device busy\n", dev, port[dev]);
-#endif			
+#endif
 	}
 	/* legacy auto configured cards */
 	cards += snd_legacy_auto_probe(possible_ports, snd_sb16_probe_legacy_port);
-#ifdef __ISAPNP__
-	/* ISA PnP cards at last */
-	cards += isapnp_probe_cards(snd_sb16_pnpids, snd_sb16_isapnp_detect);
+#ifdef CONFIG_PNP
+	/* PnP cards at last */
+	cards += pnp_register_card_driver(&sb16_pnpc_driver);
 #endif
 
 	if (!cards) {
@@ -650,8 +642,12 @@
 {
 	int dev;
 
+#ifdef CONFIG_PNP
+	/* PnP cards first */
+	pnp_unregister_card_driver(&sb16_pnpc_driver);
+#endif
 	for (dev = 0; dev < SNDRV_CARDS; dev++)
-		snd_card_free(snd_sb16_cards[dev]);
+		snd_card_free(snd_sb16_legacy[dev]);
 }
 
 module_init(alsa_card_sb16_init)
@@ -659,7 +655,7 @@
 
 #ifndef MODULE
 
-/* format is: snd-sb16=enable,index,id,isapnp,
+/* format is: snd-sb16=enable,index,id,pnp,
 		       port,mpu_port,fm_port,
 		       irq,dma8,dma16,
 		       mic_agc,csp,
@@ -694,7 +690,7 @@
 	       get_option(&str,&seq_ports[nr_dev]) == 2
 #endif
 	       );
-#ifdef __ISAPNP__
+#ifdef CONFIG_PNP
 	if (pnp != INT_MAX)
 		isapnp[nr_dev] = pnp;
 #endif

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

* Re: [PROBLEM] SB16 fails to compile: ISA PNP issues
  2003-03-09 10:39 [BUG 380][PATCHv2] SB16 compile errors shaheed
@ 2003-03-25 22:21 ` shaheed
  2003-03-25 19:12   ` Adam Belay
  0 siblings, 1 reply; 6+ messages in thread
From: shaheed @ 2003-03-25 22:21 UTC (permalink / raw)
  To: Joe Rayhawk, Adam Belay; +Cc: linux-kernel

Joe,

Adam Belay (cc'd) has a compiled-but-not-tested fix for this, and several 
other cards: sadly the hardware with my SB16 died before I could do the 
testing.

Your offer of testing is probably *just* what he needs...



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

* Re: [BUG 380][PATCHv2] SB16 compile errors
  2003-03-08 18:08 [BUG 380][PATCHv2] SB16 compile errors Lukas
@ 2003-03-08 18:12 ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2003-03-08 18:12 UTC (permalink / raw)
  To: Lukas; +Cc: linux-kernel

On Sat, Mar 08, 2003 at 07:08:30PM +0100, Lukas@Razik.de wrote:
>  #include <linux/slab.h>
>  #ifndef LINUX_ISAPNP_H
>  #include <linux/isapnp.h>
> -#define isapnp_card pci_bus
> -#define isapnp_dev pci_dev
> +#define isapnp_card pnp_card
> +#define isapnp_dev pnp_dev
>  #endif

No, no, no - this is a mess!  Rip out those ugly ifdefs and just use
the native typedefs directly.

IT might be worth to switch over to 2.5-style drivers completly, btw.

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

* [BUG 380][PATCHv2] SB16 compile errors
@ 2003-03-08 18:08 Lukas
  2003-03-08 18:12 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Lukas @ 2003-03-08 18:08 UTC (permalink / raw)
  To: linux-kernel

Hi!

Bug description:
	Please look at:
	http://bugme.osdl.org/show_bug.cgi?id=380

Further information
	Bug reported for linux-2.5.62
	Bug also present in linux-2.5.64

Patch:
	Compiled without errors/warnings but driver not tested!
	(No ISA SB16 card available)


Changed files (differences to files of linux-2.5.64.tar.gz):
==================================================
=== sound/isa/sb/sb16.c ==========================
=== DIFFERENCES BEGIN ============================
==================================================
diff -Nru linux-2.5.64/sound/isa/sb/sb16.c linux-2.5.64/sound/isa/sb/sb16.c.new
--- linux-2.5.64/sound/isa/sb/sb16.c            Wed Mar  5 04:29:33 2003
+++ linux-2.5.64/sound/isa/sb/sb16.c.new        Sat Mar  8 18:41:42 2003
@@ -17,6 +17,12 @@
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
+ *  Update 2003-03-08: Changed some #defines and the names of some functions
+ *                     to the new names in isapnp.h and pnp.h
+ *                     isapnp_find_dev()       to  pnp_find_def()
+ *                     isapnp_resourcechange() to  pnp_resource_change()
+ *                     by Lukas Razik <Lukas@Razik.de>
+ *
  */

 #include <sound/driver.h>
@@ -25,8 +31,8 @@
 #include <linux/slab.h>
 #ifndef LINUX_ISAPNP_H
 #include <linux/isapnp.h>
-#define isapnp_card pci_bus
-#define isapnp_dev pci_dev
+#define isapnp_card pnp_card
+#define isapnp_dev pnp_dev
 #endif
 #include <sound/core.h>
 #include <sound/sb.h>
@@ -275,14 +281,15 @@
        const struct isapnp_card_id *id = snd_sb16_isapnp_id[dev];
        struct isapnp_card *card = snd_sb16_isapnp_cards[dev];
        struct isapnp_dev *pdev;
+       struct pnp_resource_table *resource_table;

-       acard->dev = isapnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, 
NULL);
+       acard->dev = pnp_find_dev(card, id->devs[0].vendor, id->devs[0].function, NULL);
        if (acard->dev->active) {
                acard->dev = NULL;
                return -EBUSY;
        }
 #ifdef SNDRV_SBAWE_EMU8000
-       acard->devwt = isapnp_find_dev(card, id->devs[1].vendor, id->devs[1].function, 
NULL);
+       acard->devwt = pnp_find_dev(card, id->devs[1].vendor, id->devs[1].function, 
NULL);
        if (acard->devwt->active) {
                acard->dev = acard->devwt = NULL;
                return -EBUSY;
@@ -290,30 +297,31 @@
 #endif
        /* Audio initialization */
        pdev = acard->dev;
+       resource_table = &pdev->res;
        if (pdev->prepare(pdev) < 0)
                return -EAGAIN;
        if (port[dev] != SNDRV_AUTO_PORT)
-               isapnp_resource_change(&pdev->resource[0], port[dev], 16);
+               pnp_resource_change(&resource_table->port_resource[0], port[dev], 16);
        if (mpu_port[dev] != SNDRV_AUTO_PORT)
-               isapnp_resource_change(&pdev->resource[1], mpu_port[dev], 2);
+               pnp_resource_change(&resource_table->port_resource[1], mpu_port[dev], 
2);
        if (fm_port[dev] != SNDRV_AUTO_PORT)
-               isapnp_resource_change(&pdev->resource[2], fm_port[dev], 4);
+               pnp_resource_change(&resource_table->port_resource[2], fm_port[dev], 4);
        if (dma8[dev] != SNDRV_AUTO_DMA)
-               isapnp_resource_change(&pdev->dma_resource[0], dma8[dev], 1);
+               pnp_resource_change(&resource_table->dma_resource[0], dma8[dev], 1);
        if (dma16[dev] != SNDRV_AUTO_DMA)
-               isapnp_resource_change(&pdev->dma_resource[1], dma16[dev], 1);
+               pnp_resource_change(&resource_table->dma_resource[1], dma16[dev], 1);
        if (irq[dev] != SNDRV_AUTO_IRQ)
-               isapnp_resource_change(&pdev->irq_resource[0], irq[dev], 1);
+               pnp_resource_change(&resource_table->irq_resource[0], irq[dev], 1);
        if (pdev->activate(pdev) < 0) {
                printk(KERN_ERR PFX "isapnp configure failure (out of resources?)\n");
                return -EBUSY;
        }
-       port[dev] = pdev->resource[0].start;
-       mpu_port[dev] = pdev->resource[1].start;
-       fm_port[dev] = pdev->resource[2].start;
-       dma8[dev] = pdev->dma_resource[0].start;
-       dma16[dev] = pdev->dma_resource[1].start;
-       irq[dev] = pdev->irq_resource[0].start;
+       port[dev]     = resource_table->port_resource[0].start;
+       mpu_port[dev] = resource_table->port_resource[1].start;
+       fm_port[dev]  = resource_table->port_resource[2].start;
+       dma8[dev]     = resource_table->dma_resource[0].start;
+       dma16[dev]    = resource_table->dma_resource[1].start;
+       irq[dev]      = resource_table->irq_resource[0].start;
        snd_printdd("isapnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n",
                        port[dev], mpu_port[dev], fm_port[dev]);
        snd_printdd("isapnp SB16: dma1=%i, dma2=%i, irq=%i\n",
@@ -326,17 +334,17 @@
                return -EAGAIN;
        }
        if (awe_port[dev] != SNDRV_AUTO_PORT) {
-               isapnp_resource_change(&pdev->resource[0], awe_port[dev], 4);
-               isapnp_resource_change(&pdev->resource[1], awe_port[dev] + 0x400, 4);
-               isapnp_resource_change(&pdev->resource[2], awe_port[dev] + 0x800, 4);
+               pnp_resource_change(&resource_table->port_resource[0], awe_port[dev], 4);
+               pnp_resource_change(&resource_table->port_resource[1], awe_port[dev] + 
0x400, 4);
+               pnp_resource_change(&resource_table->port_resource[2], awe_port[dev] + 
0x800, 4);
        }
        if (pdev->activate(pdev)<0) {
                printk(KERN_ERR PFX "WaveTable isapnp configure failure (out of 
resources?)\n");
                acard->dev->deactivate(acard->dev);
                return -EBUSY;
        }
-       awe_port[dev] = pdev->resource[0].start;
-       snd_printdd("isapnp SB16: wavetable port=0x%lx\n", pdev->resource[0].start);
+       awe_port[dev] = resource_table->port_resource[0].start;
+       snd_printdd("isapnp SB16: wavetable port=0x%lx\n", resource_table-
>port_resource[0].start);
 #endif
        return 0;
 }
@@ -629,7 +637,7 @@
        cards += snd_legacy_auto_probe(possible_ports, snd_sb16_probe_legacy_port);
 #ifdef __ISAPNP__
        /* ISA PnP cards at last */
-       cards += isapnp_probe_cards(snd_sb16_pnpids, snd_sb16_isapnp_detect);
+       cards += pnp_probe_cards(snd_sb16_pnpids, snd_sb16_isapnp_detect);
 #endif

        if (!cards) {
==================================================
=== DIFFERENCES END ==============================
==================================================

==================================================
=== drivers/pnp/isapnp/compat.c ==================
=== DIFFERENCES BEGIN ============================
==================================================
diff -Nru linux-2.5.64/drivers/pnp/isapnp/compat.c linux-
2.5.64/drivers/pnp/isapnp/compat.c.new
--- linux-2.5.64/drivers/pnp/isapnp/compat.c    Wed Mar  5 04:29:34 2003
+++ linux-2.5.64/drivers/pnp/isapnp/compat.c.new        Sat Mar  8 18:42:18 2003
@@ -6,7 +6,10 @@
  *
  */

-/* TODO: see if more isapnp functions are needed here */
+/* TODO: see if more isapnp functions are needed here
+ * Update 2003-03-08: added pnp_probe_cards() and pnp_match_card()
+ *                    by Lukas Razik <Lukas@Razik.de>
+ */

 #include <linux/config.h>
 #include <linux/version.h>
@@ -47,6 +50,7 @@
        return NULL;
 }

+
 struct pnp_dev *pnp_find_dev(struct pnp_card *card,
                             unsigned short vendor,
                             unsigned short function,
@@ -88,5 +92,49 @@
        return NULL;
 }

+static const struct isapnp_card_id *
+pnp_match_card(const struct isapnp_card_id *ids, struct pnp_card *card)
+{
+        int idx;
+
+        while (ids->card_vendor || ids->card_device) {
+                if (ids->card_vendor == ISAPNP_ANY_ID && ids->card_device == 
ISAPNP_ANY_ID) {
+                        for (idx = 0; idx < ISAPNP_CARD_DEVS; idx++) {
+                                if (ids->devs[idx].vendor == 0 &&
+                                    ids->devs[idx].function == 0)
+                                        return ids;
+                                if (pnp_find_dev(card,
+                                                 ids->devs[idx].vendor,
+                                                 ids->devs[idx].function,
+                                                 NULL) == NULL)
+                                        goto __next;
+                        }
+                        return ids;
+                }
+              __next:
+                ids++;
+        }
+        return NULL;
+}
+
+int pnp_probe_cards(const struct isapnp_card_id *ids,
+                    int (*probe)(struct pnp_card *_card,
+                    const struct isapnp_card_id *_id))
+{
+        struct pnp_card *card;
+        const struct isapnp_card_id *id;
+        int count = 0;
+
+        if (ids == NULL || probe == NULL)
+                return -EINVAL;
+        pnp_for_each_card(card) {
+                id = pnp_match_card(ids, card);
+                if (id != NULL && probe(card, id) >= 0)
+                        count++;
+        }
+        return count;
+}
+
 EXPORT_SYMBOL(pnp_find_card);
 EXPORT_SYMBOL(pnp_find_dev);
+EXPORT_SYMBOL(pnp_probe_cards);
==================================================
=== DIFFERENCES END ==============================
==================================================


==================================================
=== linux-2.5.64/include/linux/isapnp.h ==========
=== DIFFERENCES BEGIN ============================
==================================================
diff -Nru linux-2.5.64/include/linux/isapnp.h linux-2.5.64/include/linux/isapnp.h.new
--- linux-2.5.64/include/linux/isapnp.h Wed Mar  5 04:29:53 2003
+++ linux-2.5.64/include/linux/isapnp.h.new     Sat Mar  8 18:43:12 2003
@@ -17,11 +17,17 @@
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
+ *  Update 2003-03-08: Addes some defines
+ *                     added pnp_probe_cards()
+ *                     by Lukas Razik <Lukas@Razik.de>
  */

 #ifndef LINUX_ISAPNP_H
 #define LINUX_ISAPNP_H

+#define isapnp_card pnp_card
+#define isapnp_dev pnp_dev
+
 #include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/pnp.h>
@@ -130,7 +136,10 @@
                             unsigned short vendor,
                             unsigned short function,
                             struct pnp_dev *from);
-
+int pnp_probe_cards(const struct isapnp_card_id *ids,
+                    int (*probe)(struct pnp_card *card,
+                    const struct isapnp_card_id *id));
+
 #else /* !CONFIG_ISAPNP */

 /* lowlevel configuration */
@@ -155,6 +164,9 @@
                                           unsigned short vendor,
                                           unsigned short function,
                                           struct pnp_dev *from) { return NULL; }
+static inline int pnp_probe_cards(const struct isapnp_card_id *ids,
+                                  int (*probe)(struct pnp_card *card,
+                                  const struct isapnp_card_id *id));

 #endif /* CONFIG_ISAPNP */
==================================================
=== DIFFERENCES END ==============================
==================================================


==================================================
=== linux-2.5.64/include/linux/pnp.h =============
=== DIFFERENCES BEGIN ============================
==================================================
diff -Nru linux-2.5.64/include/linux/pnp.h linux-2.5.64/include/linux/pnp.h.new
--- linux-2.5.64/include/linux/pnp.h    Wed Mar  5 04:29:54 2003
+++ linux-2.5.64/include/linux/pnp.h.new        Sat Mar  8 18:43:20 2003
@@ -2,6 +2,8 @@
  * Linux Plug and Play Support
  * Copyright by Adam Belay <ambx1@neo.rr.com>
  *
+ * Update 2003-03-08: Changed struct pnp_dev
+ *                    by Lukas Razik <Lukas@Razik.de>
  */

 #ifndef _LINUX_PNP_H
@@ -13,6 +15,10 @@
 #include <linux/list.h>
 #include <linux/errno.h>

+#ifndef _LINUX_IOPORT_H
+#include <linux/ioport.h>
+#endif
+
 #define PNP_MAX_PORT           8
 #define PNP_MAX_MEM            4
 #define PNP_MAX_IRQ            2
@@ -207,6 +213,10 @@
        unsigned short  regs;           /* ISAPnP: supported registers */
        int             flags;          /* used by protocols */
        struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */
+
+       int (*prepare)(struct pnp_dev *dev);    /* ISAPnP hooks */
+       int (*activate)(struct pnp_dev *dev);
+       int (*deactivate)(struct pnp_dev *dev);
 };

 #define global_to_pnp_dev(n) list_entry(n, struct pnp_dev, global_list)
==================================================
=== DIFFERENCES END ==============================
==================================================

Lukas

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

end of thread, other threads:[~2003-03-26  9:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-09 10:39 [BUG 380][PATCHv2] SB16 compile errors shaheed
2003-03-25 22:21 ` [PROBLEM] SB16 fails to compile: ISA PNP issues shaheed
2003-03-25 19:12   ` Adam Belay
2003-03-25 15:30     ` Joe Rayhawk
  -- strict thread matches above, loose matches on Subject: below --
2003-03-08 18:08 [BUG 380][PATCHv2] SB16 compile errors Lukas
2003-03-08 18:12 ` Christoph Hellwig

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