[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d2d7b7ec-c7db-4cde-b669-df727b93748f@matthias-fetzer.de>
Date: Thu, 15 Aug 2024 22:17:01 +0200
From: Matthias Fetzer <kontakt@...thias-fetzer.de>
To: kernel test robot <lkp@...el.com>, hmh@....eng.br, hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com, ibm-acpi-devel@...ts.sourceforge.net,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev
Subject: Re: [PATCH v3] platform/x86: thinkpad_acpi: Add Thinkpad Edge E531
fan support
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@...el.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?
>
> 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
>
Powered by blists - more mailing lists