summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-06-25 14:08:23 +0100
committerMark Brown <broonie@kernel.org>2021-06-25 14:08:23 +0100
commit04045c479a25b1cf76ee4d4a347d2a32e31cf909 (patch)
tree3f3eafbfaa6a1a69620e67f07c70f0215dd52266 /drivers
parent13311e74253fe64329390df80bed3f07314ddd61 (diff)
parentf60d7270c8a3d2beb1c23ae0da42497afa3584c2 (diff)
downloadlinux-04045c479a25b1cf76ee4d4a347d2a32e31cf909.tar.bz2
Merge remote-tracking branch 'spi/for-5.12' into spi-linus
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e353b7a9e54e..56c173869d97 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -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 */
of_node_get(nc);
spi->dev.of_node = nc;
+ spi->dev.fwnode = of_fwnode_handle(nc);
/* Register the new device */
rc = spi_add_device(spi);
@@ -2621,9 +2622,10 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr)
native_cs_mask |= BIT(i);
}
- ctlr->unused_native_cs = ffz(native_cs_mask);
- if (num_cs_gpios && ctlr->max_native_cs &&
- ctlr->unused_native_cs >= ctlr->max_native_cs) {
+ ctlr->unused_native_cs = ffs(~native_cs_mask) - 1;
+
+ 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");
return -EINVAL;
}