[PATCH v5] ufs: core: Add HID support

Bart Van Assche bvanassche at acm.org
Tue May 20 13:22:05 PDT 2025


On 5/20/25 9:01 AM, Bean Huo wrote:
> 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"
> };

If this change is made, please use the designated initializer syntax
([label] = "text"). This will make it easier to verify that the
enumeration labels and the strings match.

Thanks,

Bart.



More information about the linux-arm-kernel mailing list