Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Oct 2014 18:04:21 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r273337 - head/sys/arm/broadcom/bcm2835
Message-ID:  <201410201804.s9KI4LmG014771@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Mon Oct 20 18:04:20 2014
New Revision: 273337
URL: https://svnweb.freebsd.org/changeset/base/273337

Log:
  Fix the mtx_sleep() error checking, catch all errors and not only
  EWOULDBLOCK.
  
  Do not print any message at errors.  The errors are properly sent to upper
  layers which should be able to deal with it, including printing the errors
  when they need to.
  
  The error message was quite annoying while scanning the i2c bus.
  
  MFC after:	1 week

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c	Mon Oct 20 18:00:50 2014	(r273336)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c	Mon Oct 20 18:04:20 2014	(r273337)
@@ -441,12 +441,11 @@ bcm_bsc_transfer(device_t dev, struct ii
 		/* Wait for the transaction to complete. */
 		err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz);
 
-		/* Check if we have a timeout or an I2C error. */
-		if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) {
-			device_printf(sc->sc_dev, "I2C error\n");
+		/* Check for errors. */
+		if (err != 0 && (sc->sc_flags & BCM_I2C_ERROR))
 			err = EIO;
+		if (err != 0)
 			break;
-		}
 	}
 
 	/* Clean the controller flags. */



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