diff mbox series

[3/6] spi: rockchip: Fix error in getting num-cs property

Message ID 20220211034344.4130-3-jon.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show
Series [1/6] spi: rockchip: Stop spi slave dma receiver when cs inactive | expand

Commit Message

Jon Lin Feb. 11, 2022, 3:43 a.m. UTC
Get num-cs u32 from dts of_node property rather than u16.

Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
---

 drivers/spi/spi-rockchip.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Mark Brown Feb. 11, 2022, 11:25 a.m. UTC | #1
On Fri, Feb 11, 2022 at 11:43:39AM +0800, Jon Lin wrote:
> Get num-cs u32 from dts of_node property rather than u16.

Bug fixes should go at the start of a series so they can be sent as
fixes without dependencies on anything else.
diff mbox series

Patch

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 1738a2611a2b..5f6a70664871 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -738,7 +738,7 @@  static int rockchip_spi_probe(struct platform_device *pdev)
 	struct spi_controller *ctlr;
 	struct resource *mem;
 	struct device_node *np = pdev->dev.of_node;
-	u32 rsd_nsecs;
+	u32 rsd_nsecs, num_cs;
 	bool slave_mode;
 
 	slave_mode = of_property_read_bool(np, "spi-slave");
@@ -848,8 +848,9 @@  static int rockchip_spi_probe(struct platform_device *pdev)
 		 * rk spi0 has two native cs, spi1..5 one cs only
 		 * if num-cs is missing in the dts, default to 1
 		 */
-		if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect))
-			ctlr->num_chipselect = 1;
+		if (of_property_read_u32(np, "num-cs", &num_cs))
+			num_cs = 1;
+		ctlr->num_chipselect = num_cs;
 		ctlr->use_gpio_descriptors = true;
 	}
 	ctlr->dev.of_node = pdev->dev.of_node;