From: Bean Huo <huobean@gmail.com>
To: Can Guo <cang@codeaurora.org>,
	asutoshd@codeaurora.org, nguyenb@codeaurora.org,
	hongwus@codeaurora.org, rnayak@codeaurora.org,
	linux-scsi@vger.kernel.org, kernel-team@android.com,
	saravanak@google.com, salyzyn@google.com
Cc: Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Stanley Chu <stanley.chu@mediatek.com>,
	Bean Huo <beanhuo@micron.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Satya Tangirala <satyat@google.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] scsi: ufs: Clean up ufshcd_exit_clk_scaling/gating()
Date: Thu, 10 Dec 2020 19:03:05 +0100	[thread overview]
Message-ID: <f12d2c516d2a038bcc27677d9b982c52d19d5027.camel@gmail.com> (raw)
In-Reply-To: <1607520942-22254-3-git-send-email-cang@codeaurora.org>
On Wed, 2020-12-09 at 05:35 -0800, Can Guo wrote:
> ufshcd_hba_exit() is always called after ufshcd_exit_clk_scaling()
> and
> ufshcd_exit_clk_gating(), so move ufshcd_exit_clk_scaling/gating() to
> ufshcd_hba_exit().
> 
> Signed-off-by: Can Guo <cang@codeaurora.org>
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 12266bd..41a12d6 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -1846,11 +1846,14 @@ static void ufshcd_init_clk_scaling(struct
> ufs_hba *hba)
>         snprintf(wq_name, sizeof(wq_name), "ufs_clkscaling_%d",
>                  hba->host->host_no);
>         hba->clk_scaling.workq =
> create_singlethread_workqueue(wq_name);
> +
> +       hba->clk_scaling.is_initialized = true;
>  }
>  
>  static void ufshcd_exit_clk_scaling(struct ufs_hba *hba)
>  {
> -       if (!ufshcd_is_clkscaling_supported(hba))
> +       if (!ufshcd_is_clkscaling_supported(hba) ||
> +           !hba->clk_scaling.is_initialized)
>                 return;
>  
>         if (hba->devfreq)
> @@ -1894,12 +1897,16 @@ static void ufshcd_init_clk_gating(struct
> ufs_hba *hba)
>         hba->clk_gating.enable_attr.attr.mode = 0644;
>         if (device_create_file(hba->dev, &hba-
> >clk_gating.enable_attr))
>                 dev_err(hba->dev, "Failed to create sysfs for
> clkgate_enable\n");
> +
> +       hba->clk_gating.is_initialized = true;
>  }
you don't need these two is_initialized at all. they are only be false
when scaling/gating is not supported??
Bean
next prev parent reply	other threads:[~2020-12-10 18:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09 13:35 [PATCH v2 0/2] Two changes related with UFS clock scaling Can Guo
2020-12-09 13:35 ` [PATCH 1/2] scsi: ufs: Protect some contexts from unexpected " Can Guo
2020-12-10 17:34   ` Bean Huo
2020-12-11  1:09     ` Can Guo
2020-12-11  1:36     ` Can Guo
2020-12-11 11:13       ` Can Guo
2020-12-09 13:35 ` [PATCH 2/2] scsi: ufs: Clean up ufshcd_exit_clk_scaling/gating() Can Guo
2020-12-10 18:03   ` Bean Huo [this message]
2020-12-11  1:11     ` Can Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=f12d2c516d2a038bcc27677d9b982c52d19d5027.camel@gmail.com \
    --to=huobean@gmail.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=cang@codeaurora.org \
    --cc=hongwus@codeaurora.org \
    --cc=jejb@linux.ibm.com \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nguyenb@codeaurora.org \
    --cc=rnayak@codeaurora.org \
    --cc=salyzyn@google.com \
    --cc=saravanak@google.com \
    --cc=satyat@google.com \
    --cc=stanley.chu@mediatek.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).