mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
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>
This commit is contained in:
parent
f09c796505
commit
2a64e9d445
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user