svn commit: r310156 - in stable/11/sys/arm: at91 broadcom/bcm2835 ti

Emmanuel Vadot manu at FreeBSD.org
Fri Dec 16 15:33:23 UTC 2016


Author: manu
Date: Fri Dec 16 15:33:21 2016
New Revision: 310156
URL: https://svnweb.freebsd.org/changeset/base/310156

Log:
  MFC r309912:
  
  CS ivar is uint32_t, not int.

Modified:
  stable/11/sys/arm/at91/at91_spi.c
  stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c
  stable/11/sys/arm/ti/ti_spi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/at91/at91_spi.c
==============================================================================
--- stable/11/sys/arm/at91/at91_spi.c	Fri Dec 16 14:23:08 2016	(r310155)
+++ stable/11/sys/arm/at91/at91_spi.c	Fri Dec 16 15:33:21 2016	(r310156)
@@ -291,7 +291,8 @@ at91_spi_transfer(device_t dev, device_t
 {
 	struct at91_spi_softc *sc;
 	bus_addr_t addr;
-	int err, i, j, mode[4], cs;
+	int err, i, j, mode[4];
+	uint32_t cs;
 
 	KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz,
 	    ("%s: TX/RX command sizes should be equal", __func__));
@@ -315,7 +316,7 @@ at91_spi_transfer(device_t dev, device_t
 	 * PSCDEC = 0 has a range of 0..3 for chip select.  We
 	 * don't support PSCDEC = 1 which has a range of 0..15.
 	 */
-	if (cs < 0 || cs > 3) {
+	if (cs > 3) {
 		device_printf(dev,
 		    "Invalid chip select %d requested by %s\n", cs,
 		    device_get_nameunit(child));

Modified: stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c
==============================================================================
--- stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c	Fri Dec 16 14:23:08 2016	(r310155)
+++ stable/11/sys/arm/broadcom/bcm2835/bcm2835_spi.c	Fri Dec 16 15:33:21 2016	(r310156)
@@ -422,7 +422,8 @@ static int
 bcm_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
 {
 	struct bcm_spi_softc *sc;
-	int cs, err;
+	uint32_t cs;
+	int err;
 
 	sc = device_get_softc(dev);
 
@@ -433,7 +434,7 @@ bcm_spi_transfer(device_t dev, device_t 
 
 	/* Get the proper chip select for this child. */
 	spibus_get_cs(child, &cs);
-	if (cs < 0 || cs > 2) {
+	if (cs > 2) {
 		device_printf(dev,
 		    "Invalid chip select %d requested by %s\n", cs,
 		    device_get_nameunit(child));

Modified: stable/11/sys/arm/ti/ti_spi.c
==============================================================================
--- stable/11/sys/arm/ti/ti_spi.c	Fri Dec 16 14:23:08 2016	(r310155)
+++ stable/11/sys/arm/ti/ti_spi.c	Fri Dec 16 15:33:21 2016	(r310156)
@@ -445,9 +445,9 @@ ti_spi_gcd(int a, int b)
 static int
 ti_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
 {
-	int cs, err;
+	int err;
 	struct ti_spi_softc *sc;
-	uint32_t reg;
+	uint32_t reg, cs;
 
 	sc = device_get_softc(dev);
 
@@ -458,7 +458,7 @@ ti_spi_transfer(device_t dev, device_t c
 
 	/* Get the proper chip select for this child. */
 	spibus_get_cs(child, &cs);
-	if (cs < 0 || cs > sc->sc_numcs) {
+	if (cs > sc->sc_numcs) {
 		device_printf(dev, "Invalid chip select %d requested by %s\n",
 		    cs, device_get_nameunit(child));
 		return (EINVAL);


More information about the svn-src-all mailing list