public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Matthias Fetzer <kontakt@matthias-fetzer.de>
Cc: kernel test robot <lkp@intel.com>,
	hmh@hmh.eng.br,  Hans de Goede <hdegoede@redhat.com>,
	ibm-acpi-devel@lists.sourceforge.net,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	 oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH v3] platform/x86: thinkpad_acpi: Add Thinkpad Edge E531 fan support
Date: Fri, 16 Aug 2024 16:38:53 +0300 (EEST)	[thread overview]
Message-ID: <e1fe661c-281d-9d59-be53-968f7a0bc18a@linux.intel.com> (raw)
In-Reply-To: <d2d7b7ec-c7db-4cde-b669-df727b93748f@matthias-fetzer.de>

On Thu, 15 Aug 2024, Matthias Fetzer wrote:

> 
> 
> Am 15.08.24 um 21:00 schrieb kernel test robot:
> > Hi Matthias,
> > 
> > kernel test robot noticed the following build warnings:
> > 
> > [auto build test WARNING on linus/master]
> > [also build test WARNING on v6.11-rc3 next-20240815]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> > 
> > url:
> > https://github.com/intel-lab-lkp/linux/commits/Matthias-Fetzer/platform-x86-thinkpad_acpi-Add-Thinkpad-Edge-E531-fan-support/20240815-054239
> > base:   linus/master
> > patch link:
> > https://lore.kernel.org/r/20240814213927.49075-1-kontakt%40matthias-fetzer.de
> > patch subject: [PATCH v3] platform/x86: thinkpad_acpi: Add Thinkpad Edge
> > E531 fan support
> > config: i386-randconfig-001-20240815
> > (https://download.01.org/0day-ci/archive/20240816/202408160253.fMJW95oi-lkp@intel.com/config)
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > reproduce (this is a W=1 build):
> > (https://download.01.org/0day-ci/archive/20240816/202408160253.fMJW95oi-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version
> > of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes:
> > https://lore.kernel.org/oe-kbuild-all/202408160253.fMJW95oi-lkp@intel.com/
> > 
> > All warnings (new ones prefixed by >>):
> > 
> >     drivers/platform/x86/thinkpad_acpi.c: In function 'fan_set_level':
> > > > drivers/platform/x86/thinkpad_acpi.c:8214:13: warning: variable 'rc' set
> > > > but not used [-Wunused-but-set-variable]
> >      8214 |         int rc;
> >           |             ^~
> > 
> 
> I guess just removing the variable and returning -EIO directly should be
> a good approach.
> 
> What do you think?

Yes, it seems that's what the existing code does. That avoids printing
the debug message errornously (as the operation ended up failing, not 
succeeding).

-- 
 i.


> > vim +/rc +8214 drivers/platform/x86/thinkpad_acpi.c
> > 
> >    8211	
> >    8212	static int fan_set_level(int level)
> >    8213	{
> > > 8214		int rc;
> >    8215	
> >    8216		if (!fan_control_allowed)
> >    8217			return -EPERM;
> >    8218	
> >    8219		switch (fan_control_access_mode) {
> >    8220		case TPACPI_FAN_WR_ACPI_SFAN:
> >    8221			if ((level < 0) || (level > 7))
> >    8222				return -EINVAL;
> >    8223	
> >    8224			if (tp_features.second_fan_ctl) {
> >    8225				if (!fan_select_fan2() ||
> >    8226				    !acpi_evalf(sfan_handle, NULL,
> > NULL, "vd", level)) {
> >    8227					pr_warn("Couldn't set 2nd fan
> > level, disabling support\n");
> >    8228					tp_features.second_fan_ctl =
> > 0;
> >    8229				}
> >    8230				fan_select_fan1();
> >    8231			}
> >    8232			if (!acpi_evalf(sfan_handle, NULL, NULL, "vd",
> > level))
> >    8233				return -EIO;
> >    8234			break;
> >    8235	
> >    8236		case TPACPI_FAN_WR_ACPI_FANS:
> >    8237		case TPACPI_FAN_WR_TPEC:
> >    8238			if (!(level & TP_EC_FAN_AUTO) &&
> >    8239			    !(level & TP_EC_FAN_FULLSPEED) &&
> >    8240			    ((level < 0) || (level > 7)))
> >    8241				return -EINVAL;
> >    8242	
> >    8243			/* safety net should the EC not support AUTO
> >    8244			 * or FULLSPEED mode bits and just ignore them
> > */
> >    8245			if (level & TP_EC_FAN_FULLSPEED)
> >    8246				level |= 7;	/* safety min speed 7
> > */
> >    8247			else if (level & TP_EC_FAN_AUTO)
> >    8248				level |= 4;	/* safety min speed 4
> > */
> >    8249	
> >    8250			if (tp_features.second_fan_ctl) {
> >    8251				if (!fan_select_fan2() ||
> >    8252				    !acpi_ec_write(fan_status_offset,
> > level)) {
> >    8253					pr_warn("Couldn't set 2nd fan
> > level, disabling support\n");
> >    8254					tp_features.second_fan_ctl =
> > 0;
> >    8255				}
> >    8256				fan_select_fan1();
> >    8257	
> >    8258			}
> >    8259			if (!acpi_ec_write(fan_status_offset, level))
> >    8260				return -EIO;
> >    8261			else
> >    8262				tp_features.fan_ctrl_status_undef = 0;
> >    8263			break;
> >    8264	
> >    8265		case TPACPI_FAN_WR_ACPI_FANW:
> >    8266			if (!(level & TP_EC_FAN_AUTO) && (level < 0 ||
> > level > 7))
> >    8267				return -EINVAL;
> >    8268			if (level & TP_EC_FAN_FULLSPEED)
> >    8269				return -EINVAL;
> >    8270	
> >    8271			if (level & TP_EC_FAN_AUTO) {
> >    8272				if (!acpi_evalf(fanw_handle, NULL,
> > NULL, "vdd", 0x8106, 0x05)) {
> >    8273					rc = -EIO;
> >    8274					break;
> >    8275				}
> >    8276				if (!acpi_evalf(fanw_handle, NULL,
> > NULL, "vdd", 0x8100, 0x00)) {
> >    8277					rc = -EIO;
> >    8278					break;
> >    8279				}
> >    8280			} else {
> >    8281				if (!acpi_evalf(fanw_handle, NULL,
> > NULL, "vdd", 0x8106, 0x45)) {
> >    8282					rc = -EIO;
> >    8283					break;
> >    8284				}
> >    8285				if (!acpi_evalf(fanw_handle, NULL,
> > NULL, "vdd", 0x8100, 0xff)) {
> >    8286					rc = -EIO;
> >    8287					break;
> >    8288				}
> >    8289				if (!acpi_evalf(fanw_handle, NULL,
> > NULL, "vdd", 0x8102, level * 100 / 7)) {
> >    8290					rc = -EIO;
> >    8291					break;
> >    8292				}
> >    8293			}
> >    8294			break;
> >    8295	
> >    8296		default:
> >    8297			return -ENXIO;
> >    8298		}
> >    8299	
> >    8300		vdbg_printk(TPACPI_DBG_FAN,
> >    8301			"fan control: set fan control register to
> > 0x%02x\n", level);
> >    8302		return 0;
> >    8303	}
> >    8304	
> > 
> 

  reply	other threads:[~2024-08-16 13:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-14 16:50 [PATCH] platform/x86: thinkpad_acpi: Add Thinkpad Edge E531 fan support Matthias Fetzer
2024-08-08 13:14 ` Ilpo Järvinen
2024-08-09 21:06   ` Matthias Fetzer
2024-08-12  7:17     ` Ilpo Järvinen
2024-08-12 12:33 ` Hans de Goede
2024-08-13 21:24   ` [PATCH v2] " Matthias Fetzer
2024-08-14 10:47     ` Ilpo Järvinen
2024-08-14 21:39       ` [PATCH v3] " Matthias Fetzer
2024-08-15  9:43         ` Ilpo Järvinen
2024-08-15 19:00         ` kernel test robot
2024-08-15 20:17           ` Matthias Fetzer
2024-08-16 13:38             ` Ilpo Järvinen [this message]
2024-08-16 14:12               ` [PATCH v4] " Matthias Fetzer
2024-08-16 14:15                 ` Ilpo Järvinen
2024-08-19 14:33                 ` Hans de Goede

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=e1fe661c-281d-9d59-be53-968f7a0bc18a@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=kontakt@matthias-fetzer.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=platform-driver-x86@vger.kernel.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