All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Willy Wolff <willy.mh.wolff.ml@gmail.com>,
	Zhang Rui <rui.zhang@intel.com>,
	Eduardo Valentin <edubezval@gmail.com>,
	Amit Kucheria <amit.kucheria@verdurent.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: weird cooling_device/cur_state sysfs behaviour
Date: Fri, 20 Mar 2020 18:43:37 +0100	[thread overview]
Message-ID: <bbdd32b7-c376-d44b-df2f-a50911592692@linaro.org> (raw)
In-Reply-To: <20200320151055.h32rh5hpnv7xyuey@macmini.local>

On 20/03/2020 16:10, Willy Wolff wrote:
> Hi all,
> Hope you're doing well with the situation.
> 
> I fill that my board get a cold too...
> 
> When I write to a sysfs node, I have a weird behaviour about the function that is called behind.
> This bug appears on an arm32 odroid-xu3, and only after v5.4, v5.3.18 behave correctly.
> 
> 
> Here my modification to see what's going on:
> 
> diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
> index aa99edb4dff7..a437ae3f4b9f 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -706,11 +706,22 @@ cur_state_store(struct device *dev, struct device_attribute *attr,

[ ... ]

>         return result ? result : count;
>  }
>  
> +

[ ... ]

> 
> As you can see, the function is recalled with one character less, until the "buffer is empty".
> I don't understand why. Can anybody help me for this thing?
> Many thanks in advance.

[ ... ]

Very likely the problem is coming from:

        result = cdev->ops->set_cur_state(cdev, state);

which returns '1' as showed by the traces:

drivers/thermal/thermal_sysfs.c:735:cur_state_store result = 1, count = 3

And because of the return condition above:

	return result ? result : count;

 the function is returning result, so '1', which is interpreted by the
sysfs as "I wrote one character', so it recalls the function with the
two remaining characters, etc ...

The problem is from the governor AFAICT, which governor is it?


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2020-03-20 17:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 15:10 weird cooling_device/cur_state sysfs behaviour Willy Wolff
2020-03-20 17:43 ` Daniel Lezcano [this message]
2020-03-20 20:17   ` Daniel Lezcano
2020-03-21  9:43     ` Willy Wolff

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=bbdd32b7-c376-d44b-df2f-a50911592692@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amit.kucheria@verdurent.com \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=willy.mh.wolff.ml@gmail.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 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.