Skip to contentSkip to conversation

floppy: Replace custom SZ_64K constant

PATCH In review Andy Shevchenko 2 participants 2 messages May 21, 2025 – May 22, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 floppy: Replace custom SZ_64K constant

There are only two headers using the K_64 custom constant. Moreover, its usage tangles a code because the constant is defined in the C file, while users are in the headers. Replace it with well defined SZ_64K from sizes.h.

---

This should be placed on top of
https://lore.kernel.org/r/[email protected]
for the dependency reason. In case some changes are needed there, this one may be attached to v2 of the series.

 arch/parisc/include/asm/floppy.h | 5 +++--
 arch/x86/include/asm/floppy.h    | 3 ++-
 drivers/block/floppy.c           | 2 --
 3 files changed, 5 insertions(+), 5 deletions(-)
arch/parisc/include/asm/floppy.h +3 -2
index df20dbef3ada..f15b69fea901 100644
@@ -8,9 +8,9 @@
 #ifndef __ASM_PARISC_FLOPPY_H
 #define __ASM_PARISC_FLOPPY_H
 
+#include <linux/sizes.h>
 #include <linux/vmalloc.h>
 
-
 /*
  * The DMA channel used by the floppy controller cannot access data at
  * addresses >= 16MB
@@ -20,7 +20,8 @@
  * floppy accesses go through the track buffer.
  */
 #define _CROSS_64KB(a,s,vdma) \
-(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
+	(!(vdma) && \
+	 ((unsigned long)(a) / SZ_64K != ((unsigned long)(a) + (s) - 1) / SZ_64K))
 
 #define SW fd_routine[use_virtual_dma&1]
 #define CSW fd_routine[can_use_virtual_dma & 1]
arch/x86/include/asm/floppy.h +2 -1
index e76cb74bbed2..e7a244051c62 100644
@@ -10,6 +10,7 @@
 #ifndef _ASM_X86_FLOPPY_H
 #define _ASM_X86_FLOPPY_H
 
+#include <linux/sizes.h>
 #include <linux/vmalloc.h>
 
 /*
@@ -22,7 +23,7 @@
  */
 #define _CROSS_64KB(a, s, vdma)						\
 	(!(vdma) &&							\
-	 ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
+	 ((unsigned long)(a) / SZ_64K != ((unsigned long)(a) + (s) - 1) / SZ_64K))
 
 #define SW fd_routine[use_virtual_dma & 1]
 #define CSW fd_routine[can_use_virtual_dma & 1]
drivers/block/floppy.c +0 -2
index e97432032f01..f4dc46fd25ea 100644
@@ -233,8 +233,6 @@ static unsigned short virtual_dma_port = 0x3f0;
 irqreturn_t floppy_interrupt(int irq, void *dev_id);
 static int set_dor(int fdc, char mask, char data);
 
-#define K_64	0x10000		/* 64KB */
-
 /* the following is the mask of allowed drives. By default units 2 and
  * 3 of both floppy controllers are disabled, because switching on the
  * motor of these drives causes system hangs on some PCI computers. drive
Signature · 1 line
2.47.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Andy Shevchenko

There are only two headers using the K_64 custom constant. Moreover, its usage tangles a code because the constant is defined in the C file, while users are in the headers. Replace it with well defined SZ_64K from sizes.h.

---

This should be placed on top of
https://lore.kernel.org/r/[email protected]
for the dependency reason. In case some changes are needed there, this one may be attached to v2 of the series.

Quoted 4 lines
  arch/parisc/include/asm/floppy.h | 5 +++--
  arch/x86/include/asm/floppy.h    | 3 ++-
  drivers/block/floppy.c           | 2 --
  3 files changed, 5 insertions(+), 5 deletions(-)