mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: dw: Set default value if reg-io-width isn't specified
Date: Tue, 8 Aug 2023 09:00:18 +0900	[thread overview]
Message-ID: <213763b3-5a8b-3a88-54f1-024325f7fe80@socionext.com> (raw)
In-Reply-To: <az7wvv5f42mnuuwkqzpfmwg4ngvl4jvpcfmns7d6lhzogc4qdi@ox64l6i7b44r>

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

  reply	other threads:[~2023-08-08  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  0:16 Kunihiko Hayashi
2023-08-07 22:57 ` Serge Semin
2023-08-08  0:00   ` Kunihiko Hayashi [this message]
2023-08-08 12:46     ` Mark Brown
2023-08-08 20:59       ` Serge Semin
2023-08-08 15:34 ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=213763b3-5a8b-3a88-54f1-024325f7fe80@socionext.com \
    --to=hayashi.kunihiko@socionext.com \
    --cc=broonie@kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®