Chrome platform driver development
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Sung-Chi Li <lschyi@chromium.org>
Cc: Benson Leung <bleung@chromium.org>,
	 Guenter Roeck <groeck@chromium.org>,
	Jean Delvare <jdelvare@suse.com>,
	 Guenter Roeck <linux@roeck-us.net>,
	Jonathan Corbet <corbet@lwn.net>,
	 chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org,  linux-doc@vger.kernel.org
Subject: Re: [PATCH v2 2/3] hwmon: (cros_ec) add PWM control over fans
Date: Sat, 10 May 2025 09:50:43 +0200	[thread overview]
Message-ID: <a07adf23-8073-4c07-ae4a-0fdd4feb9f2a@t-8ch.de> (raw)
In-Reply-To: <aBgpepY29tFUGVYm@google.com>

On 2025-05-05 10:59:06+0800, Sung-Chi Li wrote:
> On Sat, May 03, 2025 at 09:36:39AM +0200, Thomas Weißschuh wrote:
> > On 2025-05-02 13:34:46+0800, Sung-Chi Li via B4 Relay wrote:
> > > From: Sung-Chi Li <lschyi@chromium.org>

<snip>

> > >  static int cros_ec_hwmon_read_temp(struct cros_ec_device *cros_ec, u8 index, u8 *temp)
> > >  {
> > >  	unsigned int offset;
> > > @@ -76,6 +114,8 @@ static int cros_ec_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> > >  	struct cros_ec_hwmon_priv *priv = dev_get_drvdata(dev);
> > >  	int ret = -EOPNOTSUPP;
> > >  	u16 speed;
> > > +	u8 control_method;
> > > +	u8 pwm_value;
> > 
> > Ordering.
> > 
> 
> I thought you are talking about only the u8 variables, or do you mean the
> ordering should be applied with different types (and the declarations of
> different types are mixed)?

The ordering was for the whole declaration block.
If you want to keep variables of the same type together, declare them in
a single line (and sort that).

<snip>

> > > +static int cros_ec_hwmon_resume(struct platform_device *pdev)
> > > +{
> > > +	const struct cros_ec_hwmon_priv *priv = platform_get_drvdata(pdev);
> > > +	size_t i;
> > > +
> > > +	if (!priv->fan_control_supported)
> > > +		return 0;
> > > +
> > > +	/* EC sets fan control to auto after suspended, restore to settings before suspended. */
> > > +	for (i = 0; i < EC_FAN_SPEED_ENTRIES; i++) {
> > > +		if (!(priv->manual_fans & BIT(i)))
> > > +			continue;
> > > +
> > > +		/*
> > > +		 * Setting fan PWM value to EC will change the mode to manual for that fan in EC as
> > > +		 * well, so we do not need to issue a separate fan mode to manual call.
> > > +		 */
> > > +		cros_ec_hwmon_set_fan_pwm_val(priv->cros_ec, i, priv->manual_fan_pwm_values[i]);
> > 
> > Error handling?
> > 
> 
> I removed the error checking in the v2 version because after second thought, I
> think even if we failed at the i th fan, we should do our best to restore these
> fan settings, thus continuing on the (i+1) th fan and so on rather than stop the
> process immediately. Is adding a warning log for the failure sufficient?

A warning sounds good here.

  reply	other threads:[~2025-05-10  7:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  5:34 [PATCH v2 0/3] Export fan control and register fans as cooling devices Sung-Chi Li via B4 Relay
2025-05-02  5:34 ` [PATCH v2 1/3] platform/chrome: update pwm fan control host commands Sung-Chi Li via B4 Relay
2025-05-02  5:34 ` [PATCH v2 2/3] hwmon: (cros_ec) add PWM control over fans Sung-Chi Li via B4 Relay
2025-05-03  7:36   ` Thomas Weißschuh
2025-05-05  2:59     ` Sung-Chi Li
2025-05-10  7:50       ` Thomas Weißschuh [this message]
2025-05-02  5:34 ` [PATCH v2 3/3] hwmon: (cros_ec) register fans into thermal framework cooling devices Sung-Chi Li via B4 Relay
2025-05-03  7:27   ` Thomas Weißschuh
2025-05-03 13:00     ` Guenter Roeck
2025-05-06  2:49     ` Sung-Chi Li
2025-05-10  7:58       ` Thomas Weißschuh

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=a07adf23-8073-4c07-ae4a-0fdd4feb9f2a@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=corbet@lwn.net \
    --cc=groeck@chromium.org \
    --cc=jdelvare@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lschyi@chromium.org \
    /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