RE: [PATCH v2 1/2] scsi: ufs: Prepare to add HCI capabilities sysfs

From: Avri Altman
Date: Wed Aug 07 2024 - 01:42:20 EST


> On 8/4/24 12:21 AM, Avri Altman wrote:
> > - up(&hba->host_sem);
> > - return ret;
> > + return sysfs_emit(buf, "%d\n", ufshcd_ahit_to_us(ahit));
> > }
>
> All ufshcd_read_hci_reg() callers call sysfs_emit(). How about renaming
> ufshcd_read_hci_reg() into ufshcd_show_hci_reg(), adding an argument that
> indicates how the result should be formatted and moving the
> sysfs_emit() call into ufshcd_show_hci_reg()?
Yes, but with the cost of:
- complication - You would need to attend the extra processing e.g. if ufs4.0 or as in hibern8 ahit_to_us(),
- readability - read_hci_reg does just that (reading), and nothing more
- breaks the _show _store convention that one would expect from a sysfs entry

Wouldn't keep it simple be better?

Thanks,
Avri
>
> Thanks,
>
> Bart.