Skip to contentSkip to conversation

it87: Add param to ignore ACPI resource conflicts

PATCH Superseded Ahmad Khalifa 2 participants 3 messages Sep 30, 2022 – Oct 2, 2022

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover it87: Add param to ignore ACPI resource conflicts

Add in the parameter to ignore ACPI resource conflicts so that modprobe can use the force_id parameter when ACPI has the same address mapped.

This is useful for those who don't compile their own modules from github code and just want to configure modprobe with a /force_id/ value that gives them coverage of the first 3-4 fans/temp/in values.

Code is inspired by the github it87 module floating out there, but didn't merge in support for additional devices as there were objections to that approach in past threads [1].

Tested with it8688 on Gigabyte board with id as it8628 and compared against the out of tree module running the it8688 values (which in turn is blindly based off of the it8686 values) and the results are the same for the enabled sensors (i.e. not all 6 fans/temps/in are valid)

[1]: https://lore.kernel.org/linux-hwmon/6c8b5fbd514df708af84630544eca6ee12766bbd.camel@crawford.emu.id.au/

Ahmad Khalifa (1):
it87: Add param to ignore ACPI resource conflicts

 drivers/hwmon/it87.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

base-commit: c3e0e1e23c70455916ff3472072437b3605c6cfe

Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/1 it87: Add param to ignore ACPI resource conflicts

---
 drivers/hwmon/it87.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/hwmon/it87.c +15 -3
index 0e543dbe0a6b..6d71f6c481c8 100644
@@ -69,6 +69,10 @@ static unsigned short force_id;
 module_param(force_id, ushort, 0);
 MODULE_PARM_DESC(force_id, "Override the detected device ID");
 
+static bool ignore_resource_conflict;
+module_param(ignore_resource_conflict, bool, false);
+MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict");
+
 static struct platform_device *it87_pdev[2];
 
 #define	REG_2E	0x2e	/* The register to read/write */
@@ -2397,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 		return err;
 
 	err = -ENODEV;
-	chip_type = force_id ? force_id : superio_inw(sioaddr, DEVID);
+	chip_type = superio_inw(sioaddr, DEVID);
+	/* check first so force_id doesn't register a second empty device */
+	if (chip_type == 0xffff)
+		goto exit;
+
+	if (force_id)
+		chip_type = force_id;
 
 	switch (chip_type) {
 	case IT8705F_DEVID:
@@ -3261,8 +3271,10 @@ static int __init it87_device_add(int index, unsigned short address,
 	int err;
 
 	err = acpi_check_resource_conflict(&res);
-	if (err)
-		return err;
+	if (err){
+		if (!ignore_resource_conflict)
+			return err;
+	}
 
 	pdev = platform_device_alloc(DRVNAME, address);
 	if (!pdev)
Signature · 1 line
2.30.2
maintainer
#2 lore raw
Quoted 1 line · Ahmad Khalifa

Patch description missing. What are you doing, and why ?

Quoted 21 lines
---
 drivers/hwmon/it87.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/hwmon/it87.c +4 -0
index 0e543dbe0a6b..6d71f6c481c8 100644
@@ -69,6 +69,10 @@ static unsigned short force_id;
 module_param(force_id, ushort, 0);
 MODULE_PARM_DESC(force_id, "Override the detected device ID");
 
+static bool ignore_resource_conflict;
+module_param(ignore_resource_conflict, bool, false);
+MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict");
+
 static struct platform_device *it87_pdev[2];
 
 #define	REG_2E	0x2e	/* The register to read/write */
@@ -2397,7 +2401,13 @@ static int __init it87_find(int sioaddr, unsigned short *address,
 		return err;

drivers/hwmon/it87.c static int __init it87_find(int sioaddr, unsigned short *address, · line 2410

Quoted 10 lines
drivers/hwmon/it87.c +7 -1
 
 	err = -ENODEV;
-	chip_type = force_id ? force_id : superio_inw(sioaddr, DEVID);
+	chip_type = superio_inw(sioaddr, DEVID);
+	/* check first so force_id doesn't register a second empty device */
+	if (chip_type == 0xffff)
+		goto exit;
+
+	if (force_id)
+		chip_type = force_id;

Undocumented change, violating "one logical change per patch" rule.

Quoted 16 lines
drivers/hwmon/it87.c +4 -2
 	switch (chip_type) {
 	case IT8705F_DEVID:
@@ -3261,8 +3271,10 @@ static int __init it87_device_add(int index, unsigned short address,
 	int err;
 
 	err = acpi_check_resource_conflict(&res);
-	if (err)
-		return err;
+	if (err){
+		if (!ignore_resource_conflict)
+			return err;
+	}
 
 	pdev = platform_device_alloc(DRVNAME, address);
 	if (!pdev)