[PATCH v5] ufs: core: Add HID support
Bean Huo
huobean at gmail.com
Tue May 20 09:01:50 PDT 2025
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";
}
More information about the Linux-mediatek
mailing list