lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.19 1033/1157] scsi: ufs: core: Correct ufshcd_shutdown() flow
    Date
    From: Peter Wang <peter.wang@mediatek.com>

    commit 00511d2abf5708ad05dd5d1c36adb2468d274698 upstream.

    After ufshcd_wl_shutdown() set device power off and link off,
    ufshcd_shutdown() could turn off clock/power. Also remove
    pm_runtime_get_sync.

    The reason why it is safe to remove pm_runtime_get_sync() is because:

    - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too.

    - device resume(turn on clk/power) is not required, even if device is in
    RPM_SUSPENDED.

    Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.com
    Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun")
    Cc: <stable@vger.kernel.org> # 5.15.x
    Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
    Signed-off-by: Peter Wang <peter.wang@mediatek.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/ufs/core/ufshcd.c | 6 +-----
    1 file changed, 1 insertion(+), 5 deletions(-)

    --- a/drivers/ufs/core/ufshcd.c
    +++ b/drivers/ufs/core/ufshcd.c
    @@ -9484,12 +9484,8 @@ EXPORT_SYMBOL(ufshcd_runtime_resume);
    int ufshcd_shutdown(struct ufs_hba *hba)
    {
    if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba))
    - goto out;
    + ufshcd_suspend(hba);

    - pm_runtime_get_sync(hba->dev);
    -
    - ufshcd_suspend(hba);
    -out:
    hba->is_powered = false;
    /* allow force shutdown even in case of errors */
    return 0;

    \
     
     \ /
      Last update: 2022-08-16 06:53    [W:4.045 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site