Andy, On 03-05-2013 09:52, Andy Shevchenko wrote: > Setting policy results in invalid value error. > % echo "step_wise" > policy > % echo: write error: Invalid argument > > Need clean up of the buffer which "echo" may add based on the arguments, before > comparing aganist list of governor names. > > Signed-off-by: Andy Shevchenko > Reported-by: Srinivas Pandruvada > --- > drivers/thermal/thermal_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c > index d755440..a637be5 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -716,7 +717,7 @@ policy_store(struct device *dev, struct device_attribute *attr, > > mutex_lock(&thermal_governor_lock); > > - gov = __find_governor(buf); > + gov = __find_governor(strim(buf)); I am much happier with this approach, much cleaner and does the job. On the other hand, this patch introduces a compilation warning that we want to avoid: drivers/thermal/thermal_sys.c: In function 'policy_store': drivers/thermal/thermal_sys.c:708: warning: passing argument 1 of 'strim' discards qualifiers from pointer target type include/linux/string.h:63: note: expected 'char *' but argument is of type 'const char *' > if (!gov) > goto exit; > >