* [PATCH] spi: dw: Set default value if reg-io-width isn't specified
@ 2023-08-07 0:16 Kunihiko Hayashi
2023-08-07 22:57 ` Serge Semin
2023-08-08 15:34 ` Mark Brown
0 siblings, 2 replies; 6+ messages in thread
From: Kunihiko Hayashi @ 2023-08-07 0:16 UTC (permalink / raw)
To: Serge Semin, Mark Brown; +Cc: linux-spi, linux-kernel, Kunihiko Hayashi
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.
Should set the actual value to dws->reg_io_width, considering it
referenced.
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
2023-08-07 0:16 [PATCH] spi: dw: Set default value if reg-io-width isn't specified Kunihiko Hayashi
@ 2023-08-07 22:57 ` Serge Semin
2023-08-08 0:00 ` Kunihiko Hayashi
2023-08-08 15:34 ` Mark Brown
1 sibling, 1 reply; 6+ messages in thread
From: Serge Semin @ 2023-08-07 22:57 UTC (permalink / raw)
To: Kunihiko Hayashi; +Cc: Mark Brown, linux-spi, linux-kernel
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.
-Serge(y)
>
> Should set the actual value to dws->reg_io_width, considering it
> referenced.
>
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
2023-08-07 22:57 ` Serge Semin
@ 2023-08-08 0:00 ` Kunihiko Hayashi
2023-08-08 12:46 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Kunihiko Hayashi @ 2023-08-08 0:00 UTC (permalink / raw)
To: Serge Semin; +Cc: Mark Brown, linux-spi, linux-kernel
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@socionext.com>
>> ---
>> 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
2023-08-08 0:00 ` Kunihiko Hayashi
@ 2023-08-08 12:46 ` Mark Brown
2023-08-08 20:59 ` Serge Semin
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2023-08-08 12:46 UTC (permalink / raw)
To: Kunihiko Hayashi; +Cc: Serge Semin, linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 929 bytes --]
On Tue, Aug 08, 2023 at 09:00:18AM +0900, Kunihiko Hayashi wrote:
> 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.
It does feel like a sensible robustness improvement, even if it's not
fixing a specific issue now it might save us from future issues.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
2023-08-08 12:46 ` Mark Brown
@ 2023-08-08 20:59 ` Serge Semin
0 siblings, 0 replies; 6+ messages in thread
From: Serge Semin @ 2023-08-08 20:59 UTC (permalink / raw)
To: Mark Brown; +Cc: Kunihiko Hayashi, linux-spi, linux-kernel
On Tue, Aug 08, 2023 at 01:46:08PM +0100, Mark Brown wrote:
> On Tue, Aug 08, 2023 at 09:00:18AM +0900, Kunihiko Hayashi wrote:
> > 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.
>
> It does feel like a sensible robustness improvement,
I wouldn't call it "a sensible improvement" in this context, but
merely something like "a data-field/property coherency fixup".
> even if it's not
> fixing a specific issue now it might save us from future issues.
Such issues are very unlikely to happen unless somebody would try to
use the dw_spi.reg_io_width field separately from the denoted methods.
If one does, what he would have needed to make sure is that the field
always takes a correct value which would have led to this patch anyway
but at least it would have got a firm justification.
So to speak I wouldn't have bothered with merging the patch now at
least without changing the patch log which would have had to be
reduced to just the first paragraph with additional message stating
that the change just makes sure that the field is in a coherent state
with the DT-property value in order to improve the code
maintainability.
-Serge(y)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
2023-08-07 0:16 [PATCH] spi: dw: Set default value if reg-io-width isn't specified Kunihiko Hayashi
2023-08-07 22:57 ` Serge Semin
@ 2023-08-08 15:34 ` Mark Brown
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2023-08-08 15:34 UTC (permalink / raw)
To: Serge Semin, Kunihiko Hayashi; +Cc: linux-spi, linux-kernel
On Mon, 07 Aug 2023 09:16:21 +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.
>
> Should set the actual value to dws->reg_io_width, considering it
> referenced.
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: dw: Set default value if reg-io-width isn't specified
commit: 2ca03ecc9c8556e913aef6f381154721dec4e44b
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-08 21:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07 0:16 [PATCH] spi: dw: Set default value if reg-io-width isn't specified Kunihiko Hayashi
2023-08-07 22:57 ` Serge Semin
2023-08-08 0:00 ` Kunihiko Hayashi
2023-08-08 12:46 ` Mark Brown
2023-08-08 20:59 ` Serge Semin
2023-08-08 15:34 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®