svn commit: r310518 - stable/11/sys/dev/smbus

Andriy Gapon avg at FreeBSD.org
Sat Dec 24 14:39:31 UTC 2016


Author: avg
Date: Sat Dec 24 14:39:30 2016
New Revision: 310518
URL: https://svnweb.freebsd.org/changeset/base/310518

Log:
  MFC r308220: smbus: remove the potentially very dangerous slave probing code

Modified:
  stable/11/sys/dev/smbus/smbus.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/smbus/smbus.c
==============================================================================
--- stable/11/sys/dev/smbus/smbus.c	Sat Dec 24 14:33:35 2016	(r310517)
+++ stable/11/sys/dev/smbus/smbus.c	Sat Dec 24 14:39:30 2016	(r310518)
@@ -50,7 +50,6 @@ struct smbus_ivar
 /*
  * Autoconfiguration and support routines for System Management bus
  */
-static void smbus_probe_device(device_t dev, u_char addr);
 
 static int
 smbus_probe(device_t dev)
@@ -65,13 +64,9 @@ static int
 smbus_attach(device_t dev)
 {
 	struct smbus_softc *sc = device_get_softc(dev);
-	unsigned char addr;
 
 	mtx_init(&sc->lock, device_get_nameunit(dev), "smbus", MTX_DEF);
 	bus_generic_probe(dev);
-	for (addr = SMBUS_ADDR_MIN; addr < SMBUS_ADDR_MAX; ++addr) {
-		smbus_probe_device(dev, addr);
-	}
 	bus_enumerate_hinted_children(dev);
 	bus_generic_attach(dev);
 
@@ -98,30 +93,6 @@ smbus_generic_intr(device_t dev, u_char 
 {
 }
 
-static void
-smbus_probe_device(device_t dev, u_char addr)
-{
-	device_t child;
-	int error;
-	u_char cmd;
-	u_char buf[2];
-	struct smbus_ivar *devi;
-
-	cmd = 0x01;
-	error = smbus_trans(dev, addr, cmd,
-			    SMB_TRANS_NOCNT | SMB_TRANS_NOREPORT,
-			    NULL, 0, buf, 1, NULL);
-	if (error == 0) {
-		if (bootverbose)
-			device_printf(dev, "Probed address 0x%02x\n", addr);
-		child = BUS_ADD_CHILD(dev, SMBUS_ORDER_PNP, NULL, -1);
-		if (child == NULL)
-			return;
-		devi = device_get_ivars(child);
-		devi->addr = addr;
-	}
-}
-
 static device_t
 smbus_add_child(device_t dev, u_int order, const char *name, int unit)
 {


More information about the svn-src-all mailing list