hwmon: (it87) Do not enter configuration mode for some chiptypes
authorFrank Crawford <frank@crawford.emu.id.au>
Sun, 28 Apr 2024 06:06:34 +0000 (16:06 +1000)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 30 Apr 2024 17:32:14 +0000 (10:32 -0700)
Update the configuration mode entry code to allow conditional entry, and
apply to all calls.

Signed-off-by: Frank Crawford <frank@crawford.emu.id.au>
Link: https://lore.kernel.org/r/20240428060653.2425296-3-frank@crawford.emu.id.au
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/it87.c

index 23b68808d07d338d0459ba38f2fe353375bf2a5b..702a3752a211023f636708548d7db8378b540d2d 100644 (file)
@@ -117,7 +117,7 @@ static inline void superio_select(int ioreg, int ldn)
        outb(ldn, ioreg + 1);
 }
 
-static inline int superio_enter(int ioreg)
+static inline int superio_enter(int ioreg, bool noentry)
 {
        /*
         * Try to reserve ioreg and ioreg + 1 for exclusive access.
@@ -125,7 +125,8 @@ static inline int superio_enter(int ioreg)
        if (!request_muxed_region(ioreg, 2, DRVNAME))
                return -EBUSY;
 
-       __superio_enter(ioreg);
+       if (!noentry)
+               __superio_enter(ioreg);
        return 0;
 }
 
@@ -742,7 +743,7 @@ static int smbus_disable(struct it87_data *data)
        int err;
 
        if (data->smbus_bitmap) {
-               err = superio_enter(data->sioaddr);
+               err = superio_enter(data->sioaddr, has_noconf(data));
                if (err)
                        return err;
                superio_select(data->sioaddr, PME);
@@ -758,7 +759,7 @@ static int smbus_enable(struct it87_data *data)
        int err;
 
        if (data->smbus_bitmap) {
-               err = superio_enter(data->sioaddr);
+               err = superio_enter(data->sioaddr, has_noconf(data));
                if (err)
                        return err;
 
@@ -2674,7 +2675,7 @@ static int __init it87_find(int sioaddr, unsigned short *address,
        u16 chip_type;
        const struct it87_devices *config = NULL;
 
-       err = superio_enter(sioaddr);
+       err = superio_enter(sioaddr, false);
        if (err)
                return err;
 
@@ -3520,7 +3521,7 @@ static void it87_resume_sio(struct platform_device *pdev)
        if (!data->need_in7_reroute)
                return;
 
-       err = superio_enter(data->sioaddr);
+       err = superio_enter(data->sioaddr, has_noconf(data));
        if (err) {
                dev_warn(&pdev->dev,
                         "Unable to enter Super I/O to reroute in7 (%d)",