Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bean Huo <huobean@gmail.com>
To: Huan Tang <tanghuan@vivo.com>,
	alim.akhtar@samsung.com, avri.altman@wdc.com,
	 bvanassche@acm.org, James.Bottomley@HansenPartnership.com,
	 martin.petersen@oracle.com, matthias.bgg@gmail.com,
	 angelogioacchino.delregno@collabora.com,
	peter.wang@mediatek.com,  manivannan.sadhasivam@linaro.org,
	quic_nguyenb@quicinc.com, luhongfei@vivo.com,
	 linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Cc: opensource.kernel@vivo.com, Wenxing Cheng <wenxing.cheng@vivo.com>
Subject: Re: [PATCH v5] ufs: core: Add HID support
Date: Tue, 20 May 2025 18:01:50 +0200	[thread overview]
Message-ID: <32c36b58dcdbb09403fa9dccff28b6bee76882e0.camel@gmail.com> (raw)
In-Reply-To: <20250520094054.313-1-tanghuan@vivo.com>

On Tue, 2025-05-20 at 17:40 +0800, Huan Tang wrote:
> @@ -87,6 +87,26 @@ static const char *ufs_wb_resize_status_to_string(enum wb_resize_status status)
>         }
>  }
>  
> +static const char *ufs_hid_state_to_string(enum ufs_hid_state state)
> +{
> +       switch (state) {
> +       case HID_IDLE:
> +               return "idle";
> +       case ANALYSIS_IN_PROGRESS:
> +               return "analysis_in_progress";
> +       case DEFRAG_REQUIRED:
> +               return "defrag_required";
> +       case DEFRAG_IN_PROGRESS:
> +               return "defrag_in_progress";
> +       case DEFRAG_COMPLETED:
> +               return "defrag_completed";
> +       case DEFRAG_NOT_REQUIRED:
> +               return "defrag_not_required";
> +       default:
> +               return "unknown";
> +       }
> +}

The enum ufs_hid_state values are contiguous and start from 0, maybe change switch-state to :

#define NUM_UFS_HID_STATES 6
static const char *ufs_hid_states[NUM_UFS_HID_STATES] = {
    "idle",
    "analysis_in_progress",
    "defrag_required",
    "defrag_in_progress",
    "defrag_completed",
    "defrag_not_required"
};

static const char *ufs_hid_state_to_string(enum ufs_hid_state state) {
    if ((unsigned int)state < NUM_UFS_HID_STATES)
        return ufs_hid_states[state];
    return "unknown";
}


  parent reply	other threads:[~2025-05-20 16:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20  9:40 [PATCH v5] ufs: core: Add HID support Huan Tang
2025-05-20 13:14 ` Peter Wang (王信友)
2025-05-20 20:13   ` Bart Van Assche
2025-05-21  2:22     ` Peter Wang (王信友)
2025-05-21 14:33   ` Huan Tang
2025-05-22  3:26     ` Peter Wang (王信友)
2025-05-20 16:01 ` Bean Huo [this message]
2025-05-20 20:22   ` Bart Van Assche
2025-05-21 14:32     ` Huan Tang
2025-05-21 14:56       ` Bean Huo

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=32c36b58dcdbb09403fa9dccff28b6bee76882e0.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=luhongfei@vivo.com \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martin.petersen@oracle.com \
    --cc=matthias.bgg@gmail.com \
    --cc=opensource.kernel@vivo.com \
    --cc=peter.wang@mediatek.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=tanghuan@vivo.com \
    --cc=wenxing.cheng@vivo.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