From ak03@gte.com  Tue Oct 16 11:28:25 2001
Return-Path: <ak03@gte.com>
Received: from h132-197-97-45.gte.com (h132-197-179-27.gte.com [132.197.179.27])
	by hub.freebsd.org (Postfix) with ESMTP id 2063937B405
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 16 Oct 2001 11:28:25 -0700 (PDT)
Received: (from ak03@localhost)
	by h132-197-97-45.gte.com (8.11.6/8.11.4) id f9GISO449220;
	Tue, 16 Oct 2001 14:28:24 -0400 (EDT)
	(envelope-from ak03)
Message-Id: <200110161828.f9GISO449220@h132-197-97-45.gte.com>
Date: Tue, 16 Oct 2001 14:28:24 -0400 (EDT)
From: "Alexander N. Kabaev" <ak03@gte.com>
Reply-To: "Alexander N. Kabaev" <ak03@gte.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: kldxref introduction broke snd_driver.ko
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31316
>Category:       kern
>Synopsis:       kldxref introduction broke snd_driver.ko
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 16 11:30:00 PDT 2001
>Closed-Date:    Tue Oct 30 05:47:56 PST 2001
>Last-Modified:  Tue Oct 30 05:48:17 PST 2001
>Originator:     Alexander N. Kabaev
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Verizon Data Services
>Environment:
System: FreeBSD kanpc.gte.com 5.0-CURRENT FreeBSD 5.0-CURRENT #6: Tue Oct 16 11:03:35 EDT 2001 root@kanpc.gte.com:/usr/src/sys/i386/compile/KANPC i386


	
>Description:
	snd_driver uses MODULE_DEPEND(name, ....) to load specific cards
	drivers. Previously, the 'name' above was treated as a name of
	the kernel module binary, i.e system would try to load name.ko
	in the above case. This has changed with kldxref and corresponding
	kernel module linker changes. Linker currently looks for the name, 
	specified in the DRIVER_MODULE() macro instead.

	Several sound drivers currently have driver name which differs
	from the module filename, and since snd_driver tries to
	depend on them using their filenames, it is unable to load
	and fails with an 'unavailable dependency' error.

	The patch below simply restores one-to-one mapping 
	between driver name and its module name. This way 
	the same code will work as expected on both -CURRENT and
	-STABLE.
>How-To-Repeat:
	kldload snd_driver.ko should suffice.
>Fix:

Index: pci/als4000.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/sound/pci/als4000.c,v
retrieving revision 1.7
diff -u -r1.7 als4000.c
--- pci/als4000.c	10 Oct 2001 17:56:35 -0000	1.7
+++ pci/als4000.c	16 Oct 2001 18:00:36 -0000
@@ -897,6 +897,6 @@
 	PCM_SOFTC_SIZE,
 };
 
-DRIVER_MODULE(snd_als, pci, als_driver, pcm_devclass, 0, 0);
-MODULE_DEPEND(snd_als, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
-MODULE_VERSION(snd_als, 1);
+DRIVER_MODULE(snd_als4000, pci, als_driver, pcm_devclass, 0, 0);
+MODULE_DEPEND(snd_als4000, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
+MODULE_VERSION(snd_als4000, 1);
Index: pci/cmi.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/sound/pci/cmi.c,v
retrieving revision 1.13
diff -u -r1.13 cmi.c
--- pci/cmi.c	10 Oct 2001 17:56:35 -0000	1.13
+++ pci/cmi.c	16 Oct 2001 18:03:06 -0000
@@ -981,6 +981,6 @@
 	PCM_SOFTC_SIZE
 };
 
-DRIVER_MODULE(snd_cmipci, pci, cmi_driver, pcm_devclass, 0, 0);
-MODULE_DEPEND(snd_cmipci, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
-MODULE_VERSION(snd_cmipci, 1);
+DRIVER_MODULE(snd_cmi, pci, cmi_driver, pcm_devclass, 0, 0);
+MODULE_DEPEND(snd_cmi, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
+MODULE_VERSION(snd_cmi, 1);
Index: pci/via82c686.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/sound/pci/via82c686.c,v
retrieving revision 1.15
diff -u -r1.15 via82c686.c
--- pci/via82c686.c	8 Oct 2001 05:55:03 -0000	1.15
+++ pci/via82c686.c	16 Oct 2001 18:10:51 -0000
@@ -584,8 +584,8 @@
 	PCM_SOFTC_SIZE,
 };
 
-DRIVER_MODULE(via, pci, via_driver, pcm_devclass, 0, 0);
-MODULE_DEPEND(via, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
-MODULE_VERSION(via, 1);
+DRIVER_MODULE(snd_via82c686, pci, via_driver, pcm_devclass, 0, 0);
+MODULE_DEPEND(snd_via82c686, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
+MODULE_VERSION(snd_via82c686, 1);
 
 
Index: pci/vibes.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/sound/pci/vibes.c,v
retrieving revision 1.10
diff -u -r1.10 vibes.c
--- pci/vibes.c	10 Oct 2001 17:56:35 -0000	1.10
+++ pci/vibes.c	16 Oct 2001 18:12:11 -0000
@@ -940,6 +940,6 @@
         PCM_SOFTC_SIZE
 };
 
-DRIVER_MODULE(snd_sonicvibes, pci, sonicvibes_driver, pcm_devclass, 0, 0);
-MODULE_DEPEND(snd_sonicvibes, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
-MODULE_VERSION(snd_sonicvibes, 1);
+DRIVER_MODULE(snd_vibes, pci, sonicvibes_driver, pcm_devclass, 0, 0);
+MODULE_DEPEND(snd_vibes, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER);
+MODULE_VERSION(snd_vibes, 1);
>Release-Note:
>Audit-Trail:

From: "Alexander N. Kabaev" <ak03@gte.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/31316: kldxref introduction broke snd_driver.ko
Date: Mon, 29 Oct 2001 11:41:58 -0500

 John Baldwin committed the same fix to the tree. This PR can be closed now.
 
State-Changed-From-To: open->closed 
State-Changed-By: dd 
State-Changed-When: Tue Oct 30 05:47:56 PST 2001 
State-Changed-Why:  
requested by originator 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=31316 
>Unformatted:
