lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a07adf23-8073-4c07-ae4a-0fdd4feb9f2a@t-8ch.de>
Date: Sat, 10 May 2025 09:50:43 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Sung-Chi Li <lschyi@...omium.org>
Cc: Benson Leung <bleung@...omium.org>, 
	Guenter Roeck <groeck@...omium.org>, Jean Delvare <jdelvare@...e.com>, 
	Guenter Roeck <linux@...ck-us.net>, Jonathan Corbet <corbet@....net>, 
	chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org, linux-hwmon@...r.kernel.org, 
	linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 2/3] hwmon: (cros_ec) add PWM control over fans

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@...omium.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ