From: Haixu Cui <quic_haixcui@quicinc.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: <andriy.shevchenko@intel.com>, <harald.mommer@oss.qualcomm.com>,
<quic_msavaliy@quicinc.com>, <broonie@kernel.org>,
<virtio-dev@lists.linux.dev>, <viresh.kumar@linaro.org>,
<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<hdanton@sina.com>, <qiang4.zhang@linux.intel.com>,
<alex.bennee@linaro.org>, <quic_ztu@quicinc.com>
Subject: Re: [PATCH v4 2/3] virtio-spi: Add virtio-spi.h
Date: Wed, 3 Sep 2025 14:55:40 +0800 [thread overview]
Message-ID: <764e77e2-303f-4603-8819-ec3116c85c02@quicinc.com> (raw)
In-Reply-To: <20250828063350-mutt-send-email-mst@kernel.org>
On 8/28/2025 6:34 PM, Michael S. Tsirkin wrote:
> On Mon, Aug 25, 2025 at 05:19:03PM +0800, Haixu Cui wrote:
>>
>>
>> On 8/21/2025 4:45 PM, Michael S. Tsirkin wrote:
>>
>>
>>>> +
>>>> +/* Sample data on trailing clock edge */
>>>> +#define VIRTIO_SPI_CPHA _BITUL(0)
>>>> +/* Clock is high when IDLE */
>>>> +#define VIRTIO_SPI_CPOL _BITUL(1)
>>>> +/* Chip Select is active high */
>>>> +#define VIRTIO_SPI_CS_HIGH _BITUL(2)
>>>> +/* Transmit LSB first */
>>>> +#define VIRTIO_SPI_MODE_LSB_FIRST _BITUL(3)
>>>> +/* Loopback mode */
>>>> +#define VIRTIO_SPI_MODE_LOOP _BITUL(4)
>>>
>>> It is generally preferable to have an enum with just bit
>>> numbers.
>>>
>>>
>>> E.g.
>>>
>>> enum {
>>> VIRTIO_SPI_F_CPHA = 0,
>>> }
>>>
>>>
>>> Userspace can add _BITUL wrappers itself if it
>>> wants.
>>>
>>>
>>
>> Hi Michael,
>>
>> Thank you for the suggestion regarding the bit definitions.
>>
>> Would it be acceptable to keep the current macro definitions with _BITUL()
>> because these macros are also used within the virtio SPI driver itself?
>>
>> Looking forward to your guidance.
>>
>> Best regards,
>> Haixu Cui
>>
>
>
> move them to the .c file if you want them.
>
Hi Michael,
I've observed that other virtio drivers - such as virtio-i2c and
virtio-net - commonly define feature bits directly in their headers and
use them in their drivers.
To maintain alignment with those drivers and ensure consistency in
usage, I’d prefer to retain the current macro-based approach for
defining feature bits.
Do you think this would be reasonable in this case?
thanks
next prev parent reply other threads:[~2025-09-03 6:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-20 8:49 [PATCH v4 0/3] Virtio SPI Linux driver Haixu Cui
2025-08-20 8:49 ` [PATCH v4 1/3] virtio: Add ID for virtio SPI Haixu Cui
2025-08-20 8:49 ` [PATCH v4 2/3] virtio-spi: Add virtio-spi.h Haixu Cui
2025-08-20 14:22 ` Andy Shevchenko
2025-08-25 8:35 ` Haixu Cui
2025-08-21 8:42 ` Michael S. Tsirkin
2025-08-25 9:12 ` Haixu Cui
2025-08-28 10:19 ` Michael S. Tsirkin
2025-08-21 8:45 ` Michael S. Tsirkin
2025-08-25 9:19 ` Haixu Cui
2025-08-28 10:34 ` Michael S. Tsirkin
2025-09-03 6:55 ` Haixu Cui [this message]
2025-09-03 7:00 ` Haixu Cui
2025-08-20 8:49 ` [PATCH v4 3/3] SPI: Add virtio SPI driver Haixu Cui
2025-08-20 14:39 ` Andy Shevchenko
2025-08-25 9:01 ` Haixu Cui
2025-08-21 2:22 ` kernel test robot
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=764e77e2-303f-4603-8819-ec3116c85c02@quicinc.com \
--to=quic_haixcui@quicinc.com \
--cc=alex.bennee@linaro.org \
--cc=andriy.shevchenko@intel.com \
--cc=broonie@kernel.org \
--cc=harald.mommer@oss.qualcomm.com \
--cc=hdanton@sina.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mst@redhat.com \
--cc=qiang4.zhang@linux.intel.com \
--cc=quic_msavaliy@quicinc.com \
--cc=quic_ztu@quicinc.com \
--cc=viresh.kumar@linaro.org \
--cc=virtio-dev@lists.linux.dev \
/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®