* [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
@ 2016-01-19 6:13 Pawel Wodkowski
2016-01-19 6:35 ` Shawn Lin
0 siblings, 1 reply; 4+ messages in thread
From: Pawel Wodkowski @ 2016-01-19 6:13 UTC (permalink / raw)
To: linux-mmc; +Cc: Chuanxiao Dong, Yuan Juntao
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>
---
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..bdfce774d848 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 > host->f_max || val < host->f_min)
return -EINVAL;
mmc_claim_host(host);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
2016-01-19 6:13 [PATCH] mmc: Add a restriction to mmc debugfs clock setting Pawel Wodkowski
@ 2016-01-19 6:35 ` Shawn Lin
2016-01-19 6:44 ` Wodkowski, PawelX
0 siblings, 1 reply; 4+ messages in thread
From: Shawn Lin @ 2016-01-19 6:35 UTC (permalink / raw)
To: Pawel Wodkowski, linux-mmc; +Cc: shawn.lin, Chuanxiao Dong, Yuan Juntao
On 2016/1/19 14:13, Pawel Wodkowski 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>
> ---
> 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..bdfce774d848 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 > host->f_max || val < host->f_min)
Hmm... how about if I want to disable clk from sysfs and pass ZERO to
mmc_clock_opt_set, doesn't that case make sense? :)
> return -EINVAL;
>
> mmc_claim_host(host);
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
2016-01-19 6:35 ` Shawn Lin
@ 2016-01-19 6:44 ` Wodkowski, PawelX
2016-01-19 7:44 ` Shawn Lin
0 siblings, 1 reply; 4+ messages in thread
From: Wodkowski, PawelX @ 2016-01-19 6:44 UTC (permalink / raw)
To: Shawn Lin, linux-mmc@vger.kernel.org; +Cc: Dong, Chuanxiao, Yuan, Juntao
> -----Original Message-----
> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> owner@vger.kernel.org] On Behalf Of Shawn Lin
> Sent: Tuesday, January 19, 2016 7:35 AM
> To: Wodkowski, PawelX <pawelx.wodkowski@intel.com>; linux-
> mmc@vger.kernel.org
> Cc: shawn.lin@rock-chips.com; Dong, Chuanxiao
> <chuanxiao.dong@intel.com>; Yuan, Juntao <juntao.yuan@intel.com>
> Subject: Re: [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
>
> On 2016/1/19 14:13, Pawel Wodkowski 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>
> > ---
> > 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..bdfce774d848 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 > host->f_max || val < host->f_min)
>
> Hmm... how about if I want to disable clk from sysfs and pass ZERO to
> mmc_clock_opt_set, doesn't that case make sense? :)
>
So maybe something like this?
if (val != 0 && (val > host->f_max || val < host->f_min))
--
Pawel
> > return -EINVAL;
> >
> > mmc_claim_host(host);
> >
>
>
> --
> Best Regards
> Shawn Lin
>
> --
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
2016-01-19 6:44 ` Wodkowski, PawelX
@ 2016-01-19 7:44 ` Shawn Lin
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2016-01-19 7:44 UTC (permalink / raw)
To: Wodkowski, PawelX, linux-mmc@vger.kernel.org
Cc: shawn.lin, Dong, Chuanxiao, Yuan, Juntao
On 2016/1/19 14:44, Wodkowski, PawelX wrote:
>> -----Original Message-----
>> From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
>> owner@vger.kernel.org] On Behalf Of Shawn Lin
>> Sent: Tuesday, January 19, 2016 7:35 AM
>> To: Wodkowski, PawelX <pawelx.wodkowski@intel.com>; linux-
>> mmc@vger.kernel.org
>> Cc: shawn.lin@rock-chips.com; Dong, Chuanxiao
>> <chuanxiao.dong@intel.com>; Yuan, Juntao <juntao.yuan@intel.com>
>> Subject: Re: [PATCH] mmc: Add a restriction to mmc debugfs clock setting.
>>
>> On 2016/1/19 14:13, Pawel Wodkowski 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>
>>> ---
>>> 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..bdfce774d848 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 > host->f_max || val < host->f_min)
>>
>> Hmm... how about if I want to disable clk from sysfs and pass ZERO to
>> mmc_clock_opt_set, doesn't that case make sense? :)
>>
>
> So maybe something like this?
> if (val != 0 && (val > host->f_max || val < host->f_min))
yep.
>
--
Best Regards
Shawn Lin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-19 7:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-19 6:13 [PATCH] mmc: Add a restriction to mmc debugfs clock setting Pawel Wodkowski
2016-01-19 6:35 ` Shawn Lin
2016-01-19 6:44 ` Wodkowski, PawelX
2016-01-19 7:44 ` Shawn Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.