From: Martin Mares Date: Sun, 26 Dec 2021 22:02:47 +0000 (+0100) Subject: intel_cleanup_io() no longer returns a value X-Git-Tag: v3.8.0~78 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=b980358645470436dacf6924f6c7d6114cb82935;p=pciutils.git intel_cleanup_io() no longer returns a value The value was quite misleading, as witnessed by multiple implementations doing it wrong. In fact, the only return value which ever made sense was -1. --- diff --git a/lib/i386-io-beos.h b/lib/i386-io-beos.h index a0ee6c9..15f391b 100644 --- a/lib/i386-io-beos.h +++ b/lib/i386-io-beos.h @@ -16,10 +16,9 @@ intel_setup_io(struct pci_access *a UNUSED) return 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { - return 1; } static inline u8 diff --git a/lib/i386-io-cygwin.h b/lib/i386-io-cygwin.h index 1602248..a8501cc 100644 --- a/lib/i386-io-cygwin.h +++ b/lib/i386-io-cygwin.h @@ -14,11 +14,10 @@ intel_setup_io(struct pci_access *a UNUSED) return (iopl(3) < 0) ? 0 : 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { - iopl(3); - return -1; + iopl(0); } static inline void intel_io_lock(void) diff --git a/lib/i386-io-djgpp.h b/lib/i386-io-djgpp.h index 41885db..53f2f4e 100644 --- a/lib/i386-io-djgpp.h +++ b/lib/i386-io-djgpp.h @@ -24,10 +24,9 @@ intel_setup_io(struct pci_access *a UNUSED) return 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { - return 1; } static inline void intel_io_lock(void) diff --git a/lib/i386-io-haiku.h b/lib/i386-io-haiku.h index 2bbe592..dd00941 100644 --- a/lib/i386-io-haiku.h +++ b/lib/i386-io-haiku.h @@ -68,11 +68,10 @@ intel_setup_io(struct pci_access *a UNUSED) return (poke_driver_fd < 0) ? 0 : 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { close(poke_driver_fd); - return 1; } static inline u8 diff --git a/lib/i386-io-hurd.h b/lib/i386-io-hurd.h index d6df909..000fd42 100644 --- a/lib/i386-io-hurd.h +++ b/lib/i386-io-hurd.h @@ -18,12 +18,10 @@ intel_setup_io(struct pci_access *a UNUSED) return (ioperm (0, 65535, 1) == -1) ? 0 : 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { ioperm (0, 65535, 0); - - return -1; } static inline void intel_io_lock(void) diff --git a/lib/i386-io-linux.h b/lib/i386-io-linux.h index b39b4eb..731e8e3 100644 --- a/lib/i386-io-linux.h +++ b/lib/i386-io-linux.h @@ -14,11 +14,10 @@ intel_setup_io(struct pci_access *a UNUSED) return (iopl(3) < 0) ? 0 : 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { - iopl(3); - return -1; + iopl(0); } static inline void intel_io_lock(void) diff --git a/lib/i386-io-sunos.h b/lib/i386-io-sunos.h index 6221d13..903ad7c 100644 --- a/lib/i386-io-sunos.h +++ b/lib/i386-io-sunos.h @@ -16,11 +16,10 @@ intel_setup_io(struct pci_access *a UNUSED) return (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) ? 0 : 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { /* FIXME: How to switch off I/O port access? */ - return 1; } static inline u8 diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h index ca8b3bb..772c6f2 100644 --- a/lib/i386-io-windows.h +++ b/lib/i386-io-windows.h @@ -1290,7 +1290,7 @@ intel_setup_io(struct pci_access *a) return 1; } -static inline int +static inline void intel_cleanup_io(struct pci_access *a UNUSED) { /* @@ -1298,7 +1298,6 @@ intel_cleanup_io(struct pci_access *a UNUSED) * systems ProcessUserModeIOPL permanently changes IOPL to 3 for the current * NT process, no revert for current process is possible. */ - return 1; } static inline void intel_io_lock(void) diff --git a/lib/i386-ports.c b/lib/i386-ports.c index b3b752c..8b7ceb7 100644 --- a/lib/i386-ports.c +++ b/lib/i386-ports.c @@ -53,7 +53,10 @@ static void conf12_cleanup(struct pci_access *a UNUSED) { if (conf12_io_enabled > 0) - conf12_io_enabled = intel_cleanup_io(a); + { + intel_cleanup_io(a); + conf12_io_enabled = -1; + } } /*