From: Bart Van Assche <bvanassche@acm.org>
To: Avri Altman <avri.altman@sandisk.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code
Date: Tue, 17 Jun 2025 08:59:08 -0700 [thread overview]
Message-ID: <74b7ed8e-2de3-4498-9add-5b50d010d496@acm.org> (raw)
In-Reply-To: <20250617095611.89229-3-avri.altman@sandisk.com>
On 6/17/25 2:56 AM, Avri Altman wrote:
> UPIU_TRANSACTION_NOP_OUT is 0x0, which is the default value after
> memset. Comment out the explicit assignment and leave it as
> documentation.
This description is based on the assumption that the compiler only
initializes the data structure members that have been mentioned
explicitly. That is wrong. There is no partial initialization in the
C programming language. Structure members that have not been mentioned
explicitly are zero-initialized. All structure members, including those
that have not been mentioned explicitly, are copied when performing
structure assignment.
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index c2048aca09fc..84165b45467d 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2835,7 +2835,7 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufshcd_lrb *lrbp)
> memset(ucd_req_ptr, 0, sizeof(struct utp_upiu_req));
>
> ucd_req_ptr->header = (struct utp_upiu_header){
> - .transaction_code = UPIU_TRANSACTION_NOP_OUT,
> + /* .transaction_code = UPIU_TRANSACTION_NOP_OUT = 0x0, */
> .task_tag = lrbp->task_tag,
> };
> }
This patch probably doesn't change the generated assembly code. So I
don't think that it is useful.
Bart.
next prev parent reply other threads:[~2025-06-17 15:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 9:56 [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Avri Altman
2025-06-17 9:56 ` [PATCH 1/2] scsi: ufs: Clear ucd_rsp_ptr for UPIU requests once Avri Altman
2025-06-17 20:35 ` Bart Van Assche
2025-06-20 2:54 ` Martin K. Petersen
2025-06-17 9:56 ` [PATCH 2/2] scsi: ufs: Document NOP_OUT transaction code Avri Altman
2025-06-17 15:59 ` Bart Van Assche [this message]
2025-06-25 1:44 ` (subset) [PATCH 0/2] scsi: ufs: Two minor optimizations in query UPIU preparation Martin K. Petersen
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=74b7ed8e-2de3-4498-9add-5b50d010d496@acm.org \
--to=bvanassche@acm.org \
--cc=avri.altman@sandisk.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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;
as well as URLs for NNTP newsgroup(s).