public inbox for virtio-dev@lists.linux.dev
 help / color / mirror / Atom feed
From: Haixu Cui <quic_haixcui@quicinc.com>
To: Harald Mommer <harald.mommer@opensynergy.com>,
	<virtio-dev@lists.oasis-open.org>,
	<virtio-comment@lists.oasis-open.org>, <cohuck@redhat.com>,
	<broonie@kernel.org>, <qiang4.zhang@linux.intel.com>,
	<viresh.kumar@linaro.org>
Cc: <quic_ztu@quicinc.com>
Subject: Re: [virtio-dev][PATCH V9 2/2] virtio-spi: add the device specification
Date: Fri, 22 Dec 2023 10:28:42 +0800	[thread overview]
Message-ID: <d1f7cb96-c95f-4458-9b58-ea1e6335df55@quicinc.com> (raw)
In-Reply-To: <95dcd2c7-4b5b-4b04-8748-e9e65374d356@opensynergy.com>

Hello Harald,

On 12/21/2023 7:25 PM, Harald Mommer wrote:
> Hello,
> 
> On 12.12.23 04:33, Haixu Cui wrote:
>> +\field{bits_per_word_mask} is a mask indicating which values of 
>> bits_per_word are supported.
>> +If bit n of \field{bits_per_word_mask} is set, the bits_per_word with 
>> value (n+1) is supported.
>> +If all bits are not set, bits_per_word can be any value from 1 to 32.
> 
> "If all bits are not set" is not easy to understand as it means "if no 
> bit is set".
> 
> You can of course specify the value 0 this way to make code more 
> complicated.
> 
> To make code simple, 0 would be not given this special meaning. To allow 
> any value between 1 and 32 solely the value 0xFFFFFFFF would be allowed. 
> Which is already possible now without this additional sentence for 0. 
> Simply checking whether the respective bit is set in the mask and done 
> without having to add senseless additional code to handle the special 
> case that the mask is 0.
> 
> Giving 0 the same meaning as 0xFFFFFFFF brings nothing except confusion.
> 
Here I refer to the __spi_validate_bits_per_word in drivers/spi/spi.c, 
if bits_per_word_mask of spi controller is 0, no check will be done for 
bits_per_word parameter.

Above is just the Linux mechanism, I agree with you, 0 and 0xFFFFFFFF 
have the same meaning will cause confusion in this spec. I prefer 
treating 0 as an invalid value because the backend must support at least 
one bits_per_word value.

How about updating as:
For \field{bits_per_word_mask}, 0 is invalid because at least one 
bits_per_word value should be supported.

Thanks & Regards
Haixu Cui

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2023-12-22  2:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  3:33 [virtio-dev][PATCH V9 0/2] virtio-spi: add virtual SPI controller Haixu Cui
2023-12-12  3:33 ` [virtio-dev][PATCH V9 1/2] content: Rename SPI master to " Haixu Cui
2023-12-12  3:33 ` [virtio-dev][PATCH V9 2/2] virtio-spi: add the device specification Haixu Cui
2023-12-18 11:04   ` Cornelia Huck
2023-12-21  3:57     ` Haixu Cui
2023-12-21  8:44       ` Cornelia Huck
2023-12-21  9:37         ` Haixu Cui
2023-12-21  9:54           ` Cornelia Huck
2023-12-26  3:05             ` [virtio-dev] Re: [virtio-comment] " Haixu Cui
2023-12-21 11:25   ` Harald Mommer
2023-12-22  2:28     ` Haixu Cui [this message]
2023-12-22 14:32       ` Harald Mommer
2023-12-26  4:15         ` Haixu Cui
2024-01-02 14:10           ` Harald Mommer
2023-12-22 12:21   ` Cornelia Huck
2023-12-26  3:11     ` Haixu Cui
2023-12-13  6:54 ` [virtio-dev][PATCH V9 0/2] virtio-spi: add virtual SPI controller Haixu Cui

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=d1f7cb96-c95f-4458-9b58-ea1e6335df55@quicinc.com \
    --to=quic_haixcui@quicinc.com \
    --cc=broonie@kernel.org \
    --cc=cohuck@redhat.com \
    --cc=harald.mommer@opensynergy.com \
    --cc=qiang4.zhang@linux.intel.com \
    --cc=quic_ztu@quicinc.com \
    --cc=viresh.kumar@linaro.org \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.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