Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Aug 2019 21:24:44 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r350871 - stable/12/sys/arm/ti
Message-ID:  <201908112124.x7BLOiUg090401@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sun Aug 11 21:24:44 2019
New Revision: 350871
URL: https://svnweb.freebsd.org/changeset/base/350871

Log:
  MFC r349116:
  
  In detach(), call bus_generic_detach() before deleting the iicbus child.
  This gives the bus and its children the chance to return EBUSY to abort
  the detach if they're in the middle of doing some IO.

Modified:
  stable/12/sys/arm/ti/ti_i2c.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/ti/ti_i2c.c
==============================================================================
--- stable/12/sys/arm/ti/ti_i2c.c	Sun Aug 11 21:21:32 2019	(r350870)
+++ stable/12/sys/arm/ti/ti_i2c.c	Sun Aug 11 21:24:44 2019	(r350871)
@@ -735,8 +735,6 @@ ti_i2c_deactivate(device_t dev)
 		sc->sc_irq_h = NULL;
 	}
 
-	bus_generic_detach(sc->sc_dev);
-
 	/* Unmap the I2C controller registers. */
 	if (sc->sc_mem_res != NULL) {
 		bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
@@ -925,11 +923,18 @@ ti_i2c_detach(device_t dev)
 	int rv;
 
  	sc = device_get_softc(dev);
-	ti_i2c_deactivate(dev);
-	TI_I2C_LOCK_DESTROY(sc);
-	if (sc->sc_iicbus &&
+
+	if ((rv = bus_generic_detach(dev)) != 0) {
+		device_printf(dev, "cannot detach child devices\n");
+		return (rv);
+	}
+
+    if (sc->sc_iicbus &&
 	    (rv = device_delete_child(dev, sc->sc_iicbus)) != 0)
 		return (rv);
+
+	ti_i2c_deactivate(dev);
+	TI_I2C_LOCK_DESTROY(sc);
 
 	return (0);
 }



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