Commit 04045c47 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'spi/for-5.12' into spi-linus

parents 13311e74 f60d7270
...@@ -2057,6 +2057,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc) ...@@ -2057,6 +2057,7 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
/* Store a pointer to the node in the device structure */ /* Store a pointer to the node in the device structure */
of_node_get(nc); of_node_get(nc);
spi->dev.of_node = nc; spi->dev.of_node = nc;
spi->dev.fwnode = of_fwnode_handle(nc);
/* Register the new device */ /* Register the new device */
rc = spi_add_device(spi); rc = spi_add_device(spi);
...@@ -2621,9 +2622,10 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr) ...@@ -2621,9 +2622,10 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr)
native_cs_mask |= BIT(i); native_cs_mask |= BIT(i);
} }
ctlr->unused_native_cs = ffz(native_cs_mask); ctlr->unused_native_cs = ffs(~native_cs_mask) - 1;
if (num_cs_gpios && ctlr->max_native_cs &&
ctlr->unused_native_cs >= ctlr->max_native_cs) { if ((ctlr->flags & SPI_MASTER_GPIO_SS) && num_cs_gpios &&
ctlr->max_native_cs && ctlr->unused_native_cs >= ctlr->max_native_cs) {
dev_err(dev, "No unused native chip select available\n"); dev_err(dev, "No unused native chip select available\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment