CS ivar is uint32_t, not int.

MFC after:	3 days
This commit is contained in:
Emmanuel Vadot 2016-12-12 18:36:46 +00:00
parent c62801e26d
commit 718860e469
3 changed files with 9 additions and 7 deletions

View File

@ -290,7 +290,8 @@ at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
{
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__));
@ -314,7 +315,7 @@ at91_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
* 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));

View File

@ -421,7 +421,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);
@ -432,7 +433,7 @@ bcm_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
/* 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));

View File

@ -444,9 +444,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);
@ -457,7 +457,7 @@ ti_spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
/* 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);