Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Serge,

On 2023/08/08 7:57, Serge Semin wrote:
On Mon, Aug 07, 2023 at 09:16:21AM +0900, Kunihiko Hayashi wrote:
According to the dt-bindings, the default value of reg-io-width is 4.
However, the value becomes zero when reg-io-width isn't specified.

This semantic is implied by the dw_read_io_reg() and dw_write_io_reg()
methods. It doesn't seem like that much necessary duplicating it in the
property parse procedure, if not to say - redundant.

I see. Currently since the variable reg_io_width has no other references
other than dw_{read, write}_io_reg(), it means the default value is taken
if this is zero.

So, I think we should be careful when actually using the value of
this variable.

Thank you,


-Serge(y)


Should set the actual value to dws->reg_io_width, considering it
referenced.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@xxxxxxxxxxxxx>
---
  drivers/spi/spi-dw-mmio.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index a963bc96c223..7eafc07ef7aa 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -369,7 +369,9 @@ static int dw_spi_mmio_probe(struct platform_device
*pdev)
dws->max_freq = clk_get_rate(dwsmmio->clk); - device_property_read_u32(&pdev->dev, "reg-io-width",
&dws->reg_io_width);
+	if (device_property_read_u32(&pdev->dev, "reg-io-width",
+				     &dws->reg_io_width))
+		dws->reg_io_width = 4;
num_cs = 4; --
2.25.1


---
Best Regards
Kunihiko Hayashi



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux