2022-11-01 23:32:47

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 00/15] magic-number.rst funeral rites

This is a follow-up for the 18+1-patch series (
https://lore.kernel.org/linux-kernel/8389a7b85b5c660c6891b1740b5dacc53491a41b.1663280877.git.nabijaczleweli@nabijaczleweli.xyz/
https://lore.kernel.org/linux-kernel/[email protected]/
) I sent in September, and the same reasoning applies:

The entire file blames back to the start of git
(minus whitespace from the RST translation and a typo fix):
* there are changelog comments for March 1994 through to Linux 2.5.74
* struct tty_ldisc is two pointers nowadays, so naturally no magic
* GDA_MAGIC is defined but unused, and it's been this way
since start-of-git
* M3_CARD_MAGIC isn't defined, because
commit d56b9b9c464a ("[PATCH] The scheduled removal of some OSS
drivers") removed the entire driver in 2006
* CS_CARD_MAGIC likewise since
commit b5d425c97f7d ("more scheduled OSS driver removal") in 2007
* KMALLOC_MAGIC and VMALLOC_MAGIC were removed in
commit e38e0cfa48ac ("[ALSA] Remove kmalloc wrappers"),
six months after start of git
* SLAB_C_MAGIC has never even appeared in git
(removed in 2.4.0-test3pre6)
* &c., &c., &c.

magic-number.rst is a low-value historial relic at best and misleading
cruft at worst.

This latter half cleans out the remaining entries (either by recognising
that they aren't actually magic numbers or by cutting them out entirely)
and inters the file.

amd64 allyesconfig builds; this largely touches code that would be
exceedingly expensive to test (and largely untouched since the git
import), but is very receptive to static analysis.

v2:
Messages restyled
Moved printk() in synclink_cs.c became pr_warn
(__func__ instead of prescribed hard function name per checkpatch.pl)

Ahelenia Ziemiańska (15):
hamradio: baycom: remove BAYCOM_MAGIC
hamradio: yam: remove YAM_MAGIC
pcmcia: synclink_cs: remove MGSLPC_MAGIC
pcmcia: synclink_cs: remove dead paranoia_check, warn for missing line
coda: remove CODA_MAGIC
Documentation: remove PG_MAGIC (not a magic number)
MIPS: IP27: clean out sn/nmi.h
MIPS: IP27: remove KV_MAGIC
x86/APM: remove APM_BIOS_MAGIC
scsi: acorn: remove QUEUE_MAGIC_{FREE,USED}
hdlcdrv: remove HDLCDRV_MAGIC
drivers: net: slip: remove SLIP_MAGIC
fcntl: remove FASYNC_MAGIC
scsi: ncr53c8xx: replace CCB_MAGIC with bool busy
Documentation: remove magic-number.rst

Documentation/process/index.rst | 1 -
Documentation/process/magic-number.rst | 85 -----------------
.../translations/it_IT/process/index.rst | 1 -
.../it_IT/process/magic-number.rst | 91 -------------------
.../translations/zh_CN/process/index.rst | 1 -
.../zh_CN/process/magic-number.rst | 74 ---------------
.../translations/zh_TW/process/index.rst | 1 -
.../zh_TW/process/magic-number.rst | 77 ----------------
arch/mips/include/asm/sn/klkernvars.h | 8 +-
arch/mips/include/asm/sn/nmi.h | 60 ------------
arch/mips/sgi-ip27/ip27-klnuma.c | 1 -
arch/x86/kernel/apm_32.c | 9 +-
drivers/char/pcmcia/synclink_cs.c | 79 +---------------
drivers/net/hamradio/baycom_epp.c | 15 +--
drivers/net/hamradio/baycom_par.c | 1 -
drivers/net/hamradio/baycom_ser_fdx.c | 3 +-
drivers/net/hamradio/baycom_ser_hdx.c | 3 +-
drivers/net/hamradio/hdlcdrv.c | 9 +-
drivers/net/hamradio/yam.c | 8 +-
drivers/net/slip/slip.c | 11 +--
drivers/net/slip/slip.h | 4 -
drivers/scsi/arm/queue.c | 21 -----
drivers/scsi/ncr53c8xx.c | 25 ++---
fs/coda/cnode.c | 2 +-
fs/coda/coda_fs_i.h | 2 -
fs/coda/file.c | 1 -
fs/fcntl.c | 6 --
include/linux/fs.h | 3 -
include/linux/hdlcdrv.h | 2 -
29 files changed, 29 insertions(+), 575 deletions(-)
delete mode 100644 Documentation/process/magic-number.rst
delete mode 100644 Documentation/translations/it_IT/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_CN/process/magic-number.rst
delete mode 100644 Documentation/translations/zh_TW/process/magic-number.rst

--
2.30.2


Attachments:
(No filename) (4.41 kB)
signature.asc (849.00 B)
Download all attachments

2022-11-01 23:38:35

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 05/15] coda: remove CODA_MAGIC

We have largely moved away from this approach, and we have better
debugging tooling nowadays: kill it.

Link: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
fs/coda/cnode.c | 2 +-
fs/coda/coda_fs_i.h | 2 --
fs/coda/file.c | 1 -
7 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 18f8b1e3a993..335169e43be1 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -74,7 +74,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 827167b18f15..699b681088ac 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -80,7 +80,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 9553475e9867..d1ede86944f1 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -63,7 +63,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 8a64f56ae267..1dd01f1e1c17 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -66,7 +66,6 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
-CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 62a3d2565c26..e217cca338bd 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -157,7 +157,7 @@ struct coda_file_info *coda_ftoc(struct file *file)
{
struct coda_file_info *cfi = file->private_data;

- BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
+ BUG_ON(!cfi);

return cfi;

diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h
index 1763ff95d865..9e4b54dbe7d7 100644
--- a/fs/coda/coda_fs_i.h
+++ b/fs/coda/coda_fs_i.h
@@ -35,9 +35,7 @@ struct coda_inode_info {
/*
* coda fs file private data
*/
-#define CODA_MAGIC 0xC0DAC0DA
struct coda_file_info {
- int cfi_magic; /* magic number */
struct file *cfi_container; /* container file for this cnode */
unsigned int cfi_mapcount; /* nr of times this file is mapped */
bool cfi_access_intent; /* is access intent supported */
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 3f3c81e6b1ab..c23f846bf206 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -222,7 +222,6 @@ int coda_open(struct inode *coda_inode, struct file *coda_file)

host_file->f_flags |= coda_file->f_flags & (O_APPEND | O_SYNC);

- cfi->cfi_magic = CODA_MAGIC;
cfi->cfi_mapcount = 0;
cfi->cfi_container = host_file;
/* assume access intents are supported unless we hear otherwise */
--
2.30.2


Attachments:
(No filename) (6.18 kB)
signature.asc (849.00 B)
Download all attachments

2022-11-01 23:39:37

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 06/15] Documentation: remove PG_MAGIC (not a magic number)

It's part of the userspace I/O packet protocol.

Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
4 files changed, 4 deletions(-)

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 335169e43be1..62a3a2113e7c 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -68,7 +68,6 @@ Changelog::
===================== ================ ======================== ==========================================
Magic Name Number Structure File
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 699b681088ac..b20a54ee6fb2 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -74,7 +74,6 @@ Registro dei cambiamenti::
===================== ================ ======================== ==========================================
Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index d1ede86944f1..e7781ab923f7 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -57,7 +57,6 @@ Linux 魔术数
===================== ================ ======================== ==========================================
魔术数名 数字 结构 文件
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 1dd01f1e1c17..5cc0bfa97d9d 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -60,7 +60,6 @@ Linux 魔術數
===================== ================ ======================== ==========================================
魔術數名 數字 結構 文件
===================== ================ ======================== ==========================================
-PG_MAGIC 'P' pg_{read,write}_hdr ``include/linux/pg.h``
APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kernel/apm_32.c``
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
--
2.30.2


Attachments:
(No filename) (4.25 kB)
signature.asc (849.00 B)
Download all attachments

2022-11-01 23:41:16

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 02/15] hamradio: yam: remove YAM_MAGIC

This is checked inconsistently, only in contexts following directly from
the module init, and returns an error to userspace/ignores the condition
entirely, rather than yielding remotely-useful diagnostics.

This is cruft, and we have better debugging tooling nowadays: kill it.

Link: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 1 -
Documentation/translations/it_IT/process/magic-number.rst | 1 -
Documentation/translations/zh_CN/process/magic-number.rst | 1 -
Documentation/translations/zh_TW/process/magic-number.rst | 1 -
drivers/net/hamradio/yam.c | 8 +-------
5 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 87353e0207c1..a4414b7e15aa 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -76,7 +76,6 @@ MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/p
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
-YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index a96712bd8a68..f51c5ef9d93f 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -82,7 +82,6 @@ MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/p
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
-YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 44f3a29fce57..3b53bd67e41b 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -65,7 +65,6 @@ MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/p
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
-YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 0fde3183e82a..7d176a87ec3c 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -68,7 +68,6 @@ MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/p
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
KV_MAGIC 0x5f4b565f kernel_vars_s ``arch/mips/include/asm/sn/klkernvars.h``
CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h``
-YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 2ed2f836f09a..0f43411a6ca5 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -73,7 +73,6 @@ static const char yam_drvinfo[] __initconst = KERN_INFO \
#define YAM_1200 2

#define NR_PORTS 4
-#define YAM_MAGIC 0xF10A7654

/* Transmitter states */

@@ -94,7 +93,6 @@ static const char yam_drvinfo[] __initconst = KERN_INFO \
#define DEFAULT_PERS 64 /* 0->255 */

struct yam_port {
- int magic;
int bitrate;
int baudrate;
int iobase;
@@ -604,7 +602,7 @@ static void yam_arbitrate(struct net_device *dev)
{
struct yam_port *yp = netdev_priv(dev);

- if (yp->magic != YAM_MAGIC || yp->tx_state != TX_OFF ||
+ if (yp->tx_state != TX_OFF ||
skb_queue_empty(&yp->send_queue))
return;
/* tx_state is TX_OFF and there is data to send */
@@ -930,9 +928,6 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __
if (copy_from_user(&ioctl_cmd, data, sizeof(int)))
return -EFAULT;

- if (yp->magic != YAM_MAGIC)
- return -EINVAL;
-
if (!capable(CAP_NET_ADMIN))
return -EPERM;

@@ -1079,7 +1074,6 @@ static void yam_setup(struct net_device *dev)
{
struct yam_port *yp = netdev_priv(dev);

- yp->magic = YAM_MAGIC;
yp->bitrate = DEFAULT_BITRATE;
yp->baudrate = DEFAULT_BITRATE * 2;
yp->iobase = 0;
--
2.30.2


Attachments:
(No filename) (6.33 kB)
signature.asc (849.00 B)
Download all attachments

2022-11-01 23:58:24

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH v2 10/15] scsi: acorn: remove QUEUE_MAGIC_{FREE,USED}

We have largely moved away from this approach, and we have better
debugging instrumentation nowadays: kill it.

Link: https://lore.kernel.org/linux-doc/[email protected]/
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
---
Documentation/process/magic-number.rst | 2 --
.../it_IT/process/magic-number.rst | 2 --
.../zh_CN/process/magic-number.rst | 2 --
.../zh_TW/process/magic-number.rst | 2 --
drivers/scsi/arm/queue.c | 21 -------------------
5 files changed, 29 deletions(-)

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 77a96a79c7e8..c1c68c713cbc 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -72,6 +72,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index ef509265a3df..5b609ca78a14 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -78,6 +78,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 6437c408dd67..ab4d4e32b61f 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -61,6 +61,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index 453cc205e6c3..a6131d978189 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -64,6 +64,4 @@ FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
HDLCDRV_MAGIC 0x5ac6e778 hdlcdrv_state ``include/linux/hdlcdrv.h``
CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c``
-QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
-QUEUE_MAGIC_USED 0xf7e1cc33 queue_entry ``drivers/scsi/arm/queue.c``
===================== ================ ======================== ==========================================
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index 978df23ce188..fe7d814a73a9 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c
@@ -26,27 +26,11 @@
#include <scsi/scsi_eh.h>
#include <scsi/scsi_tcq.h>

-#define DEBUG
-
typedef struct queue_entry {
struct list_head list;
struct scsi_cmnd *SCpnt;
-#ifdef DEBUG
- unsigned long magic;
-#endif
} QE_t;

-#ifdef DEBUG
-#define QUEUE_MAGIC_FREE 0xf7e1c9a3
-#define QUEUE_MAGIC_USED 0xf7e1cc33
-
-#define SET_MAGIC(q,m) ((q)->magic = (m))
-#define BAD_MAGIC(q,m) ((q)->magic != (m))
-#else
-#define SET_MAGIC(q,m) do { } while (0)
-#define BAD_MAGIC(q,m) (0)
-#endif
-
#include "queue.h"

#define NR_QE 32
@@ -74,7 +58,6 @@ int queue_initialise (Queue_t *queue)
queue->alloc = q = kmalloc_array(nqueues, sizeof(QE_t), GFP_KERNEL);
if (q) {
for (; nqueues; q++, nqueues--) {
- SET_MAGIC(q, QUEUE_MAGIC_FREE);
q->SCpnt = NULL;
list_add(&q->list, &queue->free);
}
@@ -119,9 +102,7 @@ int __queue_add(Queue_t *queue, struct scsi_cmnd *SCpnt, int head)
list_del(l);

q = list_entry(l, QE_t, list);
- BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_FREE));

- SET_MAGIC(q, QUEUE_MAGIC_USED);
q->SCpnt = SCpnt;

if (head)
@@ -144,9 +125,7 @@ static struct scsi_cmnd *__queue_remove(Queue_t *queue, struct list_head *ent)
*/
list_del(ent);
q = list_entry(ent, QE_t, list);
- BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_USED));

- SET_MAGIC(q, QUEUE_MAGIC_FREE);
list_add(ent, &queue->free);

return q->SCpnt;
--
2.30.2


Attachments:
(No filename) (5.89 kB)
signature.asc (849.00 B)
Download all attachments

2022-11-04 18:40:49

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] magic-number.rst funeral rites

On Wed, 2 Nov 2022 00:04:54 +0100 Ahelenia Ziemiańska wrote:
> This is a follow-up for the 18+1-patch series (
> https://lore.kernel.org/linux-kernel/8389a7b85b5c660c6891b1740b5dacc53491a41b.1663280877.git.nabijaczleweli@nabijaczleweli.xyz/
> https://lore.kernel.org/linux-kernel/[email protected]/
> ) I sent in September, and the same reasoning applies:

No idea how you want this to get merged, but FWIW you can add my

Acked-by: Jakub Kicinski <[email protected]>

to patches 1, 2, 11 and 12.