From frank@pinky.sax.de  Sat Oct 22 15:43:36 2005
Return-Path: <frank@pinky.sax.de>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7830A16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 22 Oct 2005 15:43:36 +0000 (GMT)
	(envelope-from frank@pinky.sax.de)
Received: from pinky.frank-behrens.de (pinky.frank-behrens.de [82.139.199.24])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 42B7B43D68
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 22 Oct 2005 15:43:31 +0000 (GMT)
	(envelope-from frank@pinky.sax.de)
Received: from moon.behrens (localhost [127.0.0.1])
	by pinky.frank-behrens.de (8.13.4/8.13.4) with ESMTP/MSA id j9MFhT3h027157
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 22 Oct 2005 17:43:29 +0200 (CEST)
	(envelope-from frank@moon.behrens)
Received: (from frank@localhost)
	by moon.behrens (8.13.4/8.13.4/Submit) id j9MFhTCt027156;
	Sat, 22 Oct 2005 17:43:29 +0200 (CEST)
	(envelope-from frank)
Message-Id: <200510221543.j9MFhTCt027156@moon.behrens>
Date: Sat, 22 Oct 2005 17:43:29 +0200 (CEST)
From: Frank Behrens <frank@pinky.sax.de>
Reply-To: Frank Behrens <frank@pinky.sax.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sio(4) should on probe return BUS_PROBE_GENERIC to allow other drivers to attach [fix]
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         87845
>Category:       kern
>Synopsis:       [sio] [patch] sio(4) should on probe return BUS_PROBE_GENERIC to allow other drivers to attach
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 22 15:50:16 GMT 2005
>Closed-Date:    Tue Jul 10 16:05:22 MDT 2007
>Last-Modified:  Tue Jul 10 16:05:22 MDT 2007
>Originator:     Frank Behrens
>Release:        FreeBSD 6.0-BETA3-200508221325 i386
>Organization:
>Environment:
	all FreeBSD 5.x/6.x/7.x
>Description:
For special communication protocols it is necessary to replace the sio(4) driver.
But the sio driver returns on bus probe always BUS_PROBE_SPECIFIC, what indicates the highest
priority and prohibits the attachment of other drivers.

sio(4) should return BUS_PROBE_GENERIC on successful bus probe. This allows an attachment of a
more specific driver. Other drivers (e.g. puc(4)i) do this already.

The proposed behavior conforms to DEVICE_PROBE(9) and the comments in /usr/include/sys/bus.h:
	#define BUS_PROBE_SPECIFIC      0       /* Only I can use this device */
	#define BUS_PROBE_GENERIC       (-100)  /* generic driver for dev */

The changed driver should be MFCed to RELENG_6.

>How-To-Repeat:
>Fix:

--- sioprobe6_050828.patch begins here ---
--- sys/dev/sio/sio.c.orig	Thu Jul 21 15:21:20 2005
+++ sys/dev/sio/sio.c	Tue Aug 23 17:38:58 2005
@@ -700,7 +700,7 @@
 			device_set_softc(dev, NULL);
 			free(com, M_DEVBUF);
 		}
-		return (result);
+		return (result==0? BUS_PROBE_DEFAULT : result);
 	}
 
 	/*
@@ -777,7 +777,7 @@
 		device_set_softc(dev, NULL);
 		free(com, M_DEVBUF);
 	}
-	return (result);
+	return (result==0? BUS_PROBE_DEFAULT : result);
 }
 
 #ifdef COM_ESP
--- sioprobe6_050828.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: yar 
Responsible-Changed-When: Wed Jun 28 09:55:17 UTC 2006 
Responsible-Changed-Why:  
This PR proposes a change to code introduced by Warner. 
In http://docs.freebsd.org/cgi/mid.cgi?20051022.103242.98606517.imp 
Warner said that the change looked OK to him. 
(However, in http://docs.freebsd.org/cgi/mid.cgi?200510241120.31203.jhb 
John Baldwin expressed some reservation about the change.) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=87845 
State-Changed-From-To: open->closed 
State-Changed-By: imp 
State-Changed-When: Tue Jul 10 16:04:57 MDT 2007 
State-Changed-Why:  
Already committed. 

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