From junsu@m-net.arbornet.org  Thu Jan 22 08:22:11 2004
Return-Path: <junsu@m-net.arbornet.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id EDD0E16A4CE; Thu, 22 Jan 2004 08:22:11 -0800 (PST)
Received: from arbornet.org (m-net.arbornet.org [209.142.209.161])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 8AF8E43D39; Thu, 22 Jan 2004 08:22:05 -0800 (PST)
	(envelope-from junsu@m-net.arbornet.org)
Received: from m-net.arbornet.org (localhost [127.0.0.1])
	by arbornet.org (8.12.3p2/8.11.2) with ESMTP id i0MGPNBJ081680;
	Thu, 22 Jan 2004 11:25:23 -0500 (EST)
	(envelope-from junsu@m-net.arbornet.org)
Received: (from junsu@localhost)
	by m-net.arbornet.org (8.12.3p2/8.12.3/Submit) id i0MGPNpJ081679;
	Thu, 22 Jan 2004 11:25:23 -0500 (EST)
Message-Id: <200401221625.i0MGPNpJ081679@m-net.arbornet.org>
Date: Thu, 22 Jan 2004 11:25:23 -0500 (EST)
From: Jun Su <junsu@m-net.arbornet.org>
Reply-To: Jun Su <junsu@m-net.arbornet.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: jhb@freebsd.org
Subject: [PATCH]Incorrect unit number when kldload module
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         61734
>Category:       kern
>Synopsis:       [PATCH]Incorrect unit number when kldload module
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 22 08:30:16 PST 2004
>Closed-Date:    Fri Mar 12 13:34:01 PST 2004
>Last-Modified:  Fri Mar 12 13:34:01 PST 2004
>Originator:     Jun Su
>Release:        FreeBSD 4.6.2-RELEASE-p26 i386
>Organization:
NONE
>Environment:
System: FreeBSD 5.2 -Curret


	
>Description:
	If a device has some hint value in device.hints, when kldload the module after boot,
	the unit number is incorrect.

	for example, if_lnc driver.
	in device.hints:
	hint.lnc.0.at="isa"
	hint.lnc.0.disabled="1"
	hint.lnc.0.port="0x280"
	hint.lnc.0.irq="10"
	hint.lnc.0.drq="0"

	Don;t load the if_lnc.ko when boot. Also don't compile the driver into kernel.
	When kldload if_lnc.ko, the device will be lnc1 instead of lnc0.

	This name change make the config in rc.conf incorrect. I think we need fix this.
>How-To-Repeat:
	This behavir will be occured in any isa driver.
>Fix:
--- /usr/src/sys/isa/isa_common.c       Wed Jul  9 02:56:58 2003
+++ isa_common.c        Thu Jan 22 09:08:34 2004
@@ -613,7 +613,16 @@
                        }
                }
        }
+       for (i = 0; i < nchildren; i++) {
+         device_t child = children[i];
+         struct isa_device *idev = DEVTOISA(child);

+         if (TAILQ_FIRST(&idev->id_configs))
+           continue;
+
+         device_delete_child(dev, child);
+       }
+
        free(children, M_TEMP);

        isa_running = 1;



>Release-Note:
>Audit-Trail:

From: "Jun Su" <csujun@263.net>
To: <freebsd-gnats-submit@FreeBSD.org>
Cc:  
Subject: Re: kern/61734: [PATCH]Incorrect unit number when kldload module
Date: Mon, 26 Jan 2004 13:10:16 +0800

 This is a multi-part message in MIME format.
 
 ------=_NextPart_000_0021_01C3E40D.BDB947D0
 Content-Type: text/plain;
 	charset="gb2312"
 Content-Transfer-Encoding: quoted-printable
 
 Per discussion with jhb, this problem need not to fix. Please close this =
 PR.
 
 To document this, a better fix is that the device will not added to =
 parent if it is disabled.
 =3D=3D=3D=3D //depot/usr/junsu/mywork/isa/isahint.c#2 (text) =
 =3D=3D=3D=3D
 
 
 @@ -42,6 +42,9 @@
   int  sensitive, start, count, t;
   int  order;
 =20
 +        if (resource_disabled(name, unit))
 +   return;
 +
   /* device-specific flag overrides any wildcard */
   sensitive =3D 0;
   if (resource_int_value(name, unit, "sensitive", &sensitive) !=3D 0)
 @@ -78,9 +81,6 @@
 =20
   if (resource_int_value(name, unit, "flags", &t) =3D=3D 0)
    device_set_flags(child, t);
 -
 - if (resource_disabled(name, unit))
 -  device_disable(child);
  }
 
 ------=_NextPart_000_0021_01C3E40D.BDB947D0
 Content-Type: text/html;
 	charset="gb2312"
 Content-Transfer-Encoding: quoted-printable
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML><HEAD>
 <META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
 <META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
 <STYLE></STYLE>
 </HEAD>
 <BODY bgColor=3D#ffffff>
 <DIV><FONT face=3DArial size=3D2>Per discussion with jhb, this problem =
 need not to=20
 fix.&nbsp;Please close this PR.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2>To document this, a better fix is that =
 the device=20
 will not added to parent if it is disabled.</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2>=3D=3D=3D=3D =
 //depot/usr/junsu/mywork/isa/isahint.c#2=20
 (text) =3D=3D=3D=3D</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
 <DIV><FONT face=3DArial size=3D2><BR>@@ -42,6 +42,9=20
 @@<BR>&nbsp;&nbsp;int&nbsp;&nbsp;sensitive, start, count,=20
 t;<BR>&nbsp;&nbsp;int&nbsp;&nbsp;order;<BR>&nbsp;<BR>+&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;=20
 if (resource_disabled(name, unit))<BR>+&nbsp;&nbsp;=20
 return;<BR>+<BR>&nbsp;&nbsp;/* device-specific flag overrides any =
 wildcard=20
 */<BR>&nbsp;&nbsp;sensitive =3D 0;<BR>&nbsp;&nbsp;if =
 (resource_int_value(name,=20
 unit, "sensitive", &amp;sensitive) !=3D 0)<BR>@@ -78,9 +81,6=20
 @@<BR>&nbsp;<BR>&nbsp;&nbsp;if (resource_int_value(name, unit, "flags", =
 &amp;t)=20
 =3D=3D 0)<BR>&nbsp;&nbsp;&nbsp;device_set_flags(child, =
 t);<BR>-<BR>-&nbsp;if=20
 (resource_disabled(name,=20
 unit))<BR>-&nbsp;&nbsp;device_disable(child);<BR>&nbsp;}</FONT></DIV>
 <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV></BODY></HTML>
 
 ------=_NextPart_000_0021_01C3E40D.BDB947D0--
 
State-Changed-From-To: open->closed 
State-Changed-By: josef 
State-Changed-When: Fri Mar 12 13:33:50 PST 2004 
State-Changed-Why:  
Submitter asked to close this PR 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61734 
>Unformatted:
