]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/hwmon/vt1211.c
mvpp2: refactor MTU change code
[mirror_ubuntu-bionic-kernel.git] / drivers / hwmon / vt1211.c
index 3a6bfa51cb94f69cb8323ee69f32c88c62360575..95d5e8ec8b7fcbf84275e9ca15476ab3ecee0e22 100644 (file)
@@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn)
        outb(ldn, sio_cip + 1);
 }
 
-static inline void superio_enter(int sio_cip)
+static inline int superio_enter(int sio_cip)
 {
+       if (!request_muxed_region(sio_cip, 2, DRVNAME))
+               return -EBUSY;
+
        outb(0x87, sio_cip);
        outb(0x87, sio_cip);
+
+       return 0;
 }
 
 static inline void superio_exit(int sio_cip)
 {
        outb(0xaa, sio_cip);
+       release_region(sio_cip, 2);
 }
 
 /* ---------------------------------------------------------------------
@@ -1282,11 +1288,14 @@ EXIT:
 
 static int __init vt1211_find(int sio_cip, unsigned short *address)
 {
-       int err = -ENODEV;
+       int err;
        int devid;
 
-       superio_enter(sio_cip);
+       err = superio_enter(sio_cip);
+       if (err)
+               return err;
 
+       err = -ENODEV;
        devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID);
        if (devid != SIO_VT1211_ID)
                goto EXIT;