Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2018 18:25:07 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r332195 - head/sys/dev/spibus
Message-ID:  <201804071825.w37IP7ri025027@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sat Apr  7 18:25:07 2018
New Revision: 332195
URL: https://svnweb.freebsd.org/changeset/base/332195

Log:
  A couple minor improvements to spibus.c...
  
   - Change the description string to "SPI bus" (was "spibus bus").
  
   - This is the default driver for a SPI bus, not a generic implementation,
     so return the probe value that indicates such.
  
   - Use device_delete_children() at detach time, instead of a local loop
     to enumerate the children and detach each one individually.

Modified:
  head/sys/dev/spibus/spibus.c

Modified: head/sys/dev/spibus/spibus.c
==============================================================================
--- head/sys/dev/spibus/spibus.c	Sat Apr  7 18:09:31 2018	(r332194)
+++ head/sys/dev/spibus/spibus.c	Sat Apr  7 18:25:07 2018	(r332195)
@@ -49,8 +49,9 @@ __FBSDID("$FreeBSD$");
 static int
 spibus_probe(device_t dev)
 {
-	device_set_desc(dev, "spibus bus");
-	return (BUS_PROBE_GENERIC);
+
+	device_set_desc(dev, "SPI bus");
+	return (BUS_PROBE_DEFAULT);
 }
 
 static int
@@ -70,16 +71,11 @@ spibus_attach(device_t dev)
 static int
 spibus_detach(device_t dev)
 {
-	int err, ndevs, i;
-	device_t *devlist;
+	int err;
 
 	if ((err = bus_generic_detach(dev)) != 0)
 		return (err);
-	if ((err = device_get_children(dev, &devlist, &ndevs)) != 0)
-		return (err);
-	for (i = 0; i < ndevs; i++)
-		device_delete_child(dev, devlist[i]);
-	free(devlist, M_TEMP);
+	device_delete_children(dev);
 
 	return (0);
 }



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