Skip to contentSkip to conversation

hwmon: dell-smm-hwmon: fix unused variable error

PATCH Applied Randy Dunlap 5 participants 6 messages Sep 10, 2021 – Oct 4, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: dell-smm-hwmon: fix unused variable error

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]
struct dell_smm_data *data = dev_get_drvdata(dev);

Fix this by making I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- we prefer and try hard not to select entire subsystems).

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

Fixes 039ae58503f3 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
Cc Pali Rohár <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Armin Wolf <[email protected]>
---
 arch/x86/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -1
@@ -1255,7 +1255,8 @@ config TOSHIBA
 
 config I8K
 	tristate "Dell i8k legacy laptop support"
-	select HWMON
+	depends on HWMON
+	depends on PROC_FS
 	select SENSORS_DELL_SMM
 	help
 	  This option enables legacy /proc/i8k userspace interface in hwmon
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Randy Dunlap

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]
struct dell_smm_data *data = dev_get_drvdata(dev);

Fix this by making I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- we prefer and try hard not to select entire subsystems).

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

Quoted 10 lines
Fixes 039ae58503f3 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
Cc Pali Rohár <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Armin Wolf <[email protected]>
Quoted 17 lines
---
  arch/x86/Kconfig |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -1
@@ -1255,7 +1255,8 @@ config TOSHIBA
 
  config I8K
  	tristate "Dell i8k legacy laptop support"
-	select HWMON
+	depends on HWMON
+	depends on PROC_FS
  	select SENSORS_DELL_SMM
  	help
  	  This option enables legacy /proc/i8k userspace interface in hwmon
Acked-by on v1 1/1
#2 lore raw
In reply to Randy Dunlap
Quoted 11 lines · On Friday 10 September 2021 00:19:21 Randy Dunlap wrote:

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]
struct dell_smm_data *data = dev_get_drvdata(dev);

Fix this by making I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- we prefer and try hard not to select entire subsystems).

Quoted 6 lines

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

Fixes 039ae58503f3 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
Cc Pali Rohár <[email protected]>
Quoted 23 lines
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Armin Wolf <[email protected]>
---
 arch/x86/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -1
@@ -1255,7 +1255,8 @@ config TOSHIBA
 
 config I8K
 	tristate "Dell i8k legacy laptop support"
-	select HWMON
+	depends on HWMON
+	depends on PROC_FS
 	select SENSORS_DELL_SMM
 	help
 	  This option enables legacy /proc/i8k userspace interface in hwmon
Reviewed-by on v1 1/1
#3 lore raw
In reply to Randy Dunlap
Quoted 15 lines · Randy Dunlap

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]
struct dell_smm_data *data = dev_get_drvdata(dev);

Fix this by making I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- we prefer and try hard not to select entire subsystems).

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

Quoted 10 lines
Fixes 039ae58503f3 ("hwmon: Allow to compile dell-smm-hwmon driver without /proc/i8k")
Cc Pali Rohár <[email protected]>
Cc Jean Delvare <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Armin Wolf <[email protected]>

I submitted a different patch today after noticing the same issue but your patch is better:

Arnd

merge bot Applied
#4 lore raw

[tip: x86/misc] x86/Kconfig: Fix an unused variable error in dell-smm-hwmon

In reply to Randy Dunlap
The following commit has been merged into the x86/misc branch of tip:

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     64c76a84337a5678009155fafe98c5cd8ec673f0
Gitweb:        https://git.kernel.org/tip/64c76a84337a5678009155fafe98c5cd8ec673f0
Author:        Randy Dunlap <[email protected]>
AuthorDate:    Fri, 10 Sep 2021 00:19:21 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Wed, 22 Sep 2021 19:09:56 +02:00

x86/Kconfig: Fix an unused variable error in dell-smm-hwmon

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]

    struct dell_smm_data *data = dev_get_drvdata(dev);

Make I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- it is strongly preferred to not select entire subsystems).

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

---
 arch/x86/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -1
index dad7f85..e5ba8af 100644
@@ -1256,7 +1256,8 @@ config TOSHIBA
 
 config I8K
 	tristate "Dell i8k legacy laptop support"
-	select HWMON
+	depends on HWMON
+	depends on PROC_FS
 	select SENSORS_DELL_SMM
 	help
 	  This option enables legacy /proc/i8k userspace interface in hwmon
merge bot Applied
#5 lore raw

[tip: x86/misc] x86/Kconfig: Fix an unused variable error in dell-smm-hwmon

In reply to Randy Dunlap
The following commit has been merged into the x86/misc branch of tip:

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     ef775a0e36c6a81c5b07cb228c02f967133fe768
Gitweb:        https://git.kernel.org/tip/ef775a0e36c6a81c5b07cb228c02f967133fe768
Author:        Randy Dunlap <[email protected]>
AuthorDate:    Fri, 10 Sep 2021 00:19:21 -07:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Mon, 04 Oct 2021 11:11:48 +02:00

x86/Kconfig: Fix an unused variable error in dell-smm-hwmon

When CONFIG_PROC_FS is not set, there is a build warning (turned into an error):

../drivers/hwmon/dell-smm-hwmon.c: In function 'i8k_init_procfs':
../drivers/hwmon/dell-smm-hwmon.c:624:24: error: unused variable 'data' [-Werror=unused-variable]

    struct dell_smm_data *data = dev_get_drvdata(dev);

Make I8K depend on PROC_FS and HWMON (instead of selecting HWMON -- it is strongly preferred to not select entire subsystems).

Build tested in all possible combinations of SENSORS_DELL_SMM, I8K, and PROC_FS.

---
 arch/x86/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/Kconfig +2 -1
index ab83c22..16e216b 100644
@@ -1256,7 +1256,8 @@ config TOSHIBA
 
 config I8K
 	tristate "Dell i8k legacy laptop support"
-	select HWMON
+	depends on HWMON
+	depends on PROC_FS
 	select SENSORS_DELL_SMM
 	help
 	  This option enables legacy /proc/i8k userspace interface in hwmon