diff mbox

[v2] mmc: Add a restriction to mmc debugfs clock setting.

Message ID 1453381071-47571-1-git-send-email-pawelx.wodkowski@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Pawel Wodkowski Jan. 21, 2016, 12:57 p.m. UTC
From: Chuanxiao Dong <chuanxiao.dong@intel.com>

Clock frequency values written to an mmc host should not be less than
the minimum clock frequency which the mmc host supports.

Signed-off-by: Yuan Juntao <juntaox.yuan@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>

---

Changes in v2:
- Allow setting zero frequency. 

 drivers/mmc/core/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ulf Hansson Jan. 27, 2016, 2:16 p.m. UTC | #1
On 21 January 2016 at 13:57, Pawel Wodkowski <pawelx.wodkowski@intel.com> wrote:
> From: Chuanxiao Dong <chuanxiao.dong@intel.com>
>
> Clock frequency values written to an mmc host should not be less than
> the minimum clock frequency which the mmc host supports.
>
> Signed-off-by: Yuan Juntao <juntaox.yuan@intel.com>
> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>

Thanks, applied for next!

Kind regards
Uffe

>
> ---
>
> Changes in v2:
> - Allow setting zero frequency.
>
>  drivers/mmc/core/debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 154aced0b91b..705586dcd9fa 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -220,7 +220,7 @@ static int mmc_clock_opt_set(void *data, u64 val)
>         struct mmc_host *host = data;
>
>         /* We need this check due to input value is u64 */
> -       if (val > host->f_max)
> +       if (val != 0 && (val > host->f_max || val < host->f_min))
>                 return -EINVAL;
>
>         mmc_claim_host(host);
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 154aced0b91b..705586dcd9fa 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -220,7 +220,7 @@  static int mmc_clock_opt_set(void *data, u64 val)
 	struct mmc_host *host = data;
 
 	/* We need this check due to input value is u64 */
-	if (val > host->f_max)
+	if (val != 0 && (val > host->f_max || val < host->f_min))
 		return -EINVAL;
 
 	mmc_claim_host(host);