[tip: x86/cleanups] block/floppy: Don't use REALLY_SLOW_IO for delays

tip-bot2 for Juergen Gross posted 1 patch 1 week, 6 days ago
There is a newer version of this series
arch/x86/include/asm/floppy.h | 27 ++++++++++++++++++++++-----
arch/x86/include/asm/io.h     |  5 -----
drivers/block/floppy.c        |  2 --
3 files changed, 22 insertions(+), 12 deletions(-)
[tip: x86/cleanups] block/floppy: Don't use REALLY_SLOW_IO for delays
Posted by tip-bot2 for Juergen Gross 1 week, 6 days ago
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     00c5f98db0e3a109331de89a42081cd9cdad8ec1
Gitweb:        https://git.kernel.org/tip/00c5f98db0e3a109331de89a42081cd9cdad8ec1
Author:        Juergen Gross <jgross@suse.com>
AuthorDate:    Mon, 19 Jan 2026 19:26:29 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sat, 21 Mar 2026 12:36:41 +01:00

block/floppy: Don't use REALLY_SLOW_IO for delays

Instead of defining REALLY_SLOW_IO before including io.h, add the
required additional calls of native_io_delay() to the related functions
in arch/x86/include/asm/floppy.h.

Drop REALLY_SLOW_IO now too as it has no users.

  [ bp: Merge the REALLY_SLOW_IO removal into this patch. ]

Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260119182632.596369-4-jgross@suse.com
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 arch/x86/include/asm/floppy.h | 27 ++++++++++++++++++++++-----
 arch/x86/include/asm/io.h     |  5 -----
 drivers/block/floppy.c        |  2 --
 3 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h
index e7a2440..8d1e866 100644
--- a/arch/x86/include/asm/floppy.h
+++ b/arch/x86/include/asm/floppy.h
@@ -29,9 +29,6 @@
 #define CSW fd_routine[can_use_virtual_dma & 1]
 
 
-#define fd_inb(base, reg)		inb_p((base) + (reg))
-#define fd_outb(value, base, reg)	outb_p(value, (base) + (reg))
-
 #define fd_request_dma()	CSW._request_dma(FLOPPY_DMA, "floppy")
 #define fd_free_dma()		CSW._free_dma(FLOPPY_DMA)
 #define fd_enable_irq()		enable_irq(FLOPPY_IRQ)
@@ -49,6 +46,26 @@ static char *virtual_dma_addr;
 static int virtual_dma_mode;
 static int doing_pdma;
 
+static inline u8 fd_inb(u16 base, u16 reg)
+{
+	u8 ret = inb_p(base + reg);
+
+	native_io_delay();
+	native_io_delay();
+	native_io_delay();
+
+	return ret;
+}
+
+static inline void fd_outb(u8 value, u16 base, u16 reg)
+{
+	outb_p(value, base + reg);
+
+	native_io_delay();
+	native_io_delay();
+	native_io_delay();
+}
+
 static irqreturn_t floppy_hardint(int irq, void *dev_id)
 {
 	unsigned char st;
@@ -79,9 +96,9 @@ static irqreturn_t floppy_hardint(int irq, void *dev_id)
 			if (st != (STATUS_DMA | STATUS_READY))
 				break;
 			if (virtual_dma_mode)
-				outb_p(*lptr, virtual_dma_port + FD_DATA);
+				fd_outb(*lptr, virtual_dma_port, FD_DATA);
 			else
-				*lptr = inb_p(virtual_dma_port + FD_DATA);
+				*lptr = fd_inb(virtual_dma_port, FD_DATA);
 		}
 		virtual_dma_count = lcount;
 		virtual_dma_addr = lptr;
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 4179a2e..7f4847b 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -253,11 +253,6 @@ static inline void slow_down_io(void)
 		return;
 
 	native_io_delay();
-#ifdef REALLY_SLOW_IO
-	native_io_delay();
-	native_io_delay();
-	native_io_delay();
-#endif
 }
 
 #define BUILDIO(bwl, type)						\
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 92e446a..0509746 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -145,8 +145,6 @@
  * Better audit of register_blkdev.
  */
 
-#define REALLY_SLOW_IO
-
 #define DEBUGT 2
 
 #define DPRINT(format, args...) \