On 2/20/24 18:44, Peter Wang (王信友) wrote:
This help function is designed to assist users eliminating the check. Formalize the usage can make the code more concise and easier to read. Such as ufshcd_vops_init/ufshcd_vops_exit is also only one caller. Besides, it also need a comment of config_scsi_dev in ufshcd.h
My personal opinion is that the helper function makes code harder to read because the definition of a helper function needs to be looked up to understand the code. There are many examples in the changelog of the kernel tree that show that there is a preference in the Linux kernel code base to inline short functions rather than keeping or introducing short helper functions. Regarding the config_scsi_dev comment, shouldn't that be a separate patch since that change is unrelated to the introduction of a helper function? Thanks, Bart.