On Mon, 23 Feb 2015 10:08:16 +0200
Gilad Broner <[email protected]> wrote:

> @@ -5551,14 +5956,23 @@ EXPORT_SYMBOL(ufshcd_system_suspend);
>  
>  int ufshcd_system_resume(struct ufs_hba *hba)
>  {
> +     int ret = 0;
> +     ktime_t start = ktime_get();
> +
>       if (!hba || !hba->is_powered || pm_runtime_suspended(hba->dev))
>               /*
>                * Let the runtime resume take care of resuming
>                * if runtime suspended.
>                */
> -             return 0;
> -
> -     return ufshcd_resume(hba, UFS_SYSTEM_PM);
> +             goto out;
> +     else
> +             ret = ufshcd_resume(hba, UFS_SYSTEM_PM);
> +out:

If I understand the patch above, you basically have:

        if (....)
                goto out;
        else
                ret = ufshcd_resume();
out:

Wouldn't it be better to just reverse the above if condition?

        if (!...)
                ret = ufshcd_resume();

That would be much less confusing.


> +     trace_ufshcd_system_resume(dev_name(hba->dev), ret,
> +             ktime_to_us(ktime_sub(ktime_get(), start)),
> +             ufschd_ufs_dev_pwr_mode_to_string(hba->curr_dev_pwr_mode),
> +             ufschd_uic_link_state_to_string(hba->uic_link_state));
> +     return ret;
>  }
>  EXPORT_SYMBOL(ufshcd_system_resume);
>  
> @@ -5572,10 +5986,19 @@ EXPORT_SYMBOL(ufshcd_system_resume);
>   */
>  int ufshcd_runtime_suspend(struct ufs_hba *hba)
>  {
> -     if (!hba || !hba->is_powered)
> -             return 0;
> +     int ret = 0;
> +     ktime_t start = ktime_get();
>  
> -     return ufshcd_suspend(hba, UFS_RUNTIME_PM);
> +     if (!hba || !hba->is_powered)
> +             goto out;
> +     else
> +             ret = ufshcd_suspend(hba, UFS_RUNTIME_PM);
> +out:

Here too.

> +     trace_ufshcd_runtime_suspend(dev_name(hba->dev), ret,
> +             ktime_to_us(ktime_sub(ktime_get(), start)),
> +             ufschd_ufs_dev_pwr_mode_to_string(hba->curr_dev_pwr_mode),
> +             ufschd_uic_link_state_to_string(hba->uic_link_state));
> +     return ret;
>  }
>  EXPORT_SYMBOL(ufshcd_runtime_suspend);
>  
> @@ -5602,10 +6025,19 @@ EXPORT_SYMBOL(ufshcd_runtime_suspend);
>   */
>  int ufshcd_runtime_resume(struct ufs_hba *hba)
>  {
> +     int ret = 0;
> +     ktime_t start = ktime_get();
> +
>       if (!hba || !hba->is_powered)
> -             return 0;
> +             goto out;
>       else
> -             return ufshcd_resume(hba, UFS_RUNTIME_PM);
> +             ret = ufshcd_resume(hba, UFS_RUNTIME_PM);
> +out:

And here.

-- Steve

> +     trace_ufshcd_runtime_resume(dev_name(hba->dev), ret,
> +             ktime_to_us(ktime_sub(ktime_get(), start)),
> +             ufschd_ufs_dev_pwr_mode_to_string(hba->curr_dev_pwr_mode),
> +             ufschd_uic_link_state_to_string(hba->uic_link_state));
> +     return ret;
>  }
>  EXPORT_SYMBOL(ufshcd_runtime_resume);
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to