diff options
author | Frank Crawford <frank@crawford.emu.id.au> | 2023-01-28 17:03:06 +1100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2023-02-03 07:30:11 -0800 |
commit | 2a64e9d4451758fe4e1dc9106177b3b937b8c186 (patch) | |
tree | 5bcf04fe370a436b9bfea57949438b16c847d003 /drivers/hwmon/it87.c | |
parent | f09c7965053e1608e508e9e2c18b1d77b350cff1 (diff) |
hwmon: (it87) Allow multiple chip IDs for force_id
Extend the force_id module parameter to allow specifying one or both
chip IDs separately. If only a single parameter is given it defaults
to using that value for all chips, similar to previous usage.
Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20230128060308.1549707-6-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/it87.c')
-rw-r--r-- | drivers/hwmon/it87.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 01d890a00b85..5a1d11a66032 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -175,8 +175,9 @@ static inline void superio_exit(int ioreg, bool noexit) #define IT87_SIO_VID_REG 0xfc /* VID value */ #define IT87_SIO_BEEP_PIN_REG 0xf6 /* Beep pin mapping */ -/* Force chip ID to specified value. Should only be used for testing */ -static unsigned short force_id; +/* Force chip IDs to specified values. Should only be used for testing */ +static unsigned short force_id[2]; +static unsigned int force_id_cnt; /* ACPI resource conflicts are ignored if this parameter is set to 1 */ static bool ignore_resource_conflict; @@ -2410,7 +2411,7 @@ static const struct attribute_group it87_group_auto_pwm = { /* SuperIO detection - will change isa_address if a chip is found */ static int __init it87_find(int sioaddr, unsigned short *address, - struct it87_sio_data *sio_data) + struct it87_sio_data *sio_data, int chip_cnt) { int err; u16 chip_type; @@ -2426,8 +2427,12 @@ static int __init it87_find(int sioaddr, unsigned short *address, if (chip_type == 0xffff) goto exit; - if (force_id) - chip_type = force_id; + if (force_id_cnt == 1) { + /* If only one value given use for all chips */ + if (force_id[0]) + chip_type = force_id[0]; + } else if (force_id[chip_cnt]) + chip_type = force_id[chip_cnt]; switch (chip_type) { case IT8705F_DEVID: @@ -3419,7 +3424,7 @@ static int __init sm_it87_init(void) for (i = 0; i < ARRAY_SIZE(sioaddr); i++) { memset(&sio_data, 0, sizeof(struct it87_sio_data)); isa_address[i] = 0; - err = it87_find(sioaddr[i], &isa_address[i], &sio_data); + err = it87_find(sioaddr[i], &isa_address[i], &sio_data, i); if (err || isa_address[i] == 0) continue; /* @@ -3468,8 +3473,8 @@ static void __exit sm_it87_exit(void) MODULE_AUTHOR("Chris Gauthron, Jean Delvare <jdelvare@suse.de>"); MODULE_DESCRIPTION("IT8705F/IT871xF/IT872xF hardware monitoring driver"); -module_param(force_id, ushort, 0); -MODULE_PARM_DESC(force_id, "Override the detected device ID"); +module_param_array(force_id, ushort, &force_id_cnt, 0); +MODULE_PARM_DESC(force_id, "Override one or more detected device ID(s)"); module_param(ignore_resource_conflict, bool, 0); MODULE_PARM_DESC(ignore_resource_conflict, "Ignore ACPI resource conflict"); |