[PATCH v2] ufs: core: add missing post notify for power mode change
Bart Van Assche
bvanassche at acm.org
Fri Nov 22 10:23:40 PST 2024
On 11/21/24 6:49 PM, peter.wang at mediatek.com wrote:
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 3f68ae3e4330..1db754b4a4d6 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -308,7 +308,9 @@ struct ufs_pwr_mode_info {
> * to allow variant specific Uni-Pro initialization.
> * @pwr_change_notify: called before and after a power mode change
> * is carried out to allow vendor spesific capabilities
> - * to be set.
> + * to be set. PRE_CHANGE can modify final_params based
> + * on desired_pwr_mode, but POST_CHANGE must not alter
> + * the final_params parameter
> * @setup_xfer_req: called before any transfer request is issued
> * to set some things
> * @setup_task_mgmt: called before any task management request is issued
> @@ -350,9 +352,9 @@ struct ufs_hba_variant_ops {
> int (*link_startup_notify)(struct ufs_hba *,
> enum ufs_notify_change_status);
> int (*pwr_change_notify)(struct ufs_hba *,
> - enum ufs_notify_change_status status,
> - struct ufs_pa_layer_attr *,
> - struct ufs_pa_layer_attr *);
> + enum ufs_notify_change_status status,
> + struct ufs_pa_layer_attr *desired_pwr_mode,
> + struct ufs_pa_layer_attr *final_params);
> void (*setup_xfer_req)(struct ufs_hba *hba, int tag,
> bool is_scsi_cmd);
> void (*setup_task_mgmt)(struct ufs_hba *, int, u8);
'pwr_change_notify' probably should be split into two callback pointers
(one for PRE_CHANGE, one for POST_CHANGE) since the third and fourth
arguments have different roles for pre and post changes. Additionally,
this would allow to constify the fourth argument for the post callback.
Anyway, since this patch looks good to me:
Reviewed-by: Bart Van Assche <bvanassche at acm.org>
More information about the Linux-mediatek
mailing list