Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2012 12:06:32 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r233359 - in stable/8/sys: i386/conf kern
Message-ID:  <201203231206.q2NC6WRc075511@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Mar 23 12:06:32 2012
New Revision: 233359
URL: http://svn.freebsd.org/changeset/base/233359

Log:
  MFC 232218:
  Clear the a device's description string anytime it's driver changes.
  Descriptions are specific to drivers and we don't change drivers on attached
  devices.  This fixes a few places where we were not clearing the description
  when detaching a driver (e.g. if device_attach() failed).  While here, fix
  a few other nits:
  - Remove spurious call to remove a device's driver from
    devclass_driver_deleted().  device_detach() removes it already.
  - Fix a typo.

Modified:
  stable/8/sys/kern/subr_bus.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)
  stable/8/sys/i386/conf/XENHVM   (props changed)

Modified: stable/8/sys/kern/subr_bus.c
==============================================================================
--- stable/8/sys/kern/subr_bus.c	Fri Mar 23 12:05:51 2012	(r233358)
+++ stable/8/sys/kern/subr_bus.c	Fri Mar 23 12:06:32 2012	(r233359)
@@ -1165,7 +1165,6 @@ devclass_driver_deleted(devclass_t buscl
 			    dev->parent->devclass == busclass) {
 				if ((error = device_detach(dev)) != 0)
 					return (error);
-				(void)device_set_driver(dev, NULL);
 				BUS_PROBE_NOMATCH(dev->parent, dev);
 				devnomatch(dev);
 				dev->flags |= DF_DONENOMATCH;
@@ -2094,7 +2093,7 @@ device_probe_child(device_t dev, device_
 	/* XXX What happens if we rebid and got no best? */
 	if (best) {
 		/*
-		 * If this device was atached, and we were asked to
+		 * If this device was attached, and we were asked to
 		 * rescan, and it is a different driver, then we have
 		 * to detach the old driver and reattach this new one.
 		 * Note, we don't have to check for DF_REBID here
@@ -2601,6 +2600,7 @@ device_set_driver(device_t dev, driver_t
 		free(dev->softc, M_BUS_SC);
 		dev->softc = NULL;
 	}
+	device_set_desc(dev, NULL);
 	kobj_delete((kobj_t) dev, NULL);
 	dev->driver = driver;
 	if (driver) {
@@ -2785,7 +2785,6 @@ device_detach(device_t dev)
 
 	dev->state = DS_NOTPRESENT;
 	(void)device_set_driver(dev, NULL);
-	device_set_desc(dev, NULL);
 	device_sysctl_fini(dev);
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203231206.q2NC6WRc075511>