* [PATCH v3 01/15] hamradio: baycom: remove BAYCOM_MAGIC
2022-11-11 1:13 [PATCH v3 00/15] magic-number.rst funeral rites Ahelenia Ziemiańska
@ 2022-11-11 1:13 ` Ahelenia Ziemiańska
2022-11-11 1:13 ` [PATCH v3 02/15] hamradio: yam: remove YAM_MAGIC Ahelenia Ziemiańska
2022-11-11 1:14 ` [PATCH v3 11/15] hdlcdrv: remove HDLCDRV_MAGIC Ahelenia Ziemiańska
2 siblings, 0 replies; 4+ messages in thread
From: Ahelenia Ziemiańska @ 2022-11-11 1:13 UTC (permalink / raw)
Cc: Jonathan Corbet, Federico Vaga, Alex Shi, Yanteng Si, Hu Haowen,
Thomas Sailer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Greg Kroah-Hartman, Jiri Slaby, linux-doc,
linux-kernel, linux-doc-tw-discuss, linux-hams, netdev
[-- Attachment #1: Type: text/plain, Size: 6828 bytes --]
Before being defanged in v2.6.12-rc1, the magic was validated on each
netdev_priv() invocation; after, it's set exactly once per port on probe
and checked exactly once per port on unload: it's useless. Kill it.
Notably, magic-number.rst has never had the right value for it with the
new-in-Linux-2.1.105 network-based driver, rendering this documentation
worse than useless.
Link: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
drivers/net/hamradio/baycom_epp.c | 15 ++-------------
5 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index 64b5948fc1d4..87353e0207c1 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -73,7 +73,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
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``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 02eb7eb2448e..a96712bd8a68 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -79,7 +79,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
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``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 0617ce125e12..44f3a29fce57 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -62,7 +62,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
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``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index f3f7082e17c6..0fde3183e82a 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -65,7 +65,6 @@ APM_BIOS_MAGIC 0x4101 apm_user ``arch/x86/kerne
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
SLIP_MAGIC 0x5302 slip ``drivers/net/slip.h``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
-BAYCOM_MAGIC 0x19730510 baycom_state ``drivers/net/baycom_epp.c``
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``
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 791b4a53d69f..8f018703e74d 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -45,13 +45,9 @@
/* --------------------------------------------------------------------- */
#define BAYCOM_DEBUG
-#define BAYCOM_MAGIC 19730510
/* --------------------------------------------------------------------- */
-static const char paranoia_str[] = KERN_ERR
- "baycom_epp: bad magic number for hdlcdrv_state struct in routine %s\n";
-
static const char bc_drvname[] = "baycom_epp";
static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n"
"baycom_epp: version 0.7\n";
@@ -152,8 +148,6 @@ static struct net_device *baycom_device[NR_PORTS];
*/
struct baycom_state {
- int magic;
-
struct pardevice *pdev;
struct net_device *dev;
unsigned int work_running;
@@ -1210,7 +1204,6 @@ static void __init baycom_epp_dev_setup(struct net_device *dev)
* initialize part of the baycom_state struct
*/
bc->dev = dev;
- bc->magic = BAYCOM_MAGIC;
bc->cfg.fclk = 19666600;
bc->cfg.bps = 9600;
/*
@@ -1279,12 +1272,8 @@ static void __exit cleanup_baycomepp(void)
struct net_device *dev = baycom_device[i];
if (dev) {
- struct baycom_state *bc = netdev_priv(dev);
- if (bc->magic == BAYCOM_MAGIC) {
- unregister_netdev(dev);
- free_netdev(dev);
- } else
- printk(paranoia_str, "cleanup_module");
+ unregister_netdev(dev);
+ free_netdev(dev);
}
}
parport_unregister_driver(&baycom_epp_par_driver);
--
2.30.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v3 02/15] hamradio: yam: remove YAM_MAGIC
2022-11-11 1:13 [PATCH v3 00/15] magic-number.rst funeral rites Ahelenia Ziemiańska
2022-11-11 1:13 ` [PATCH v3 01/15] hamradio: baycom: remove BAYCOM_MAGIC Ahelenia Ziemiańska
@ 2022-11-11 1:13 ` Ahelenia Ziemiańska
2022-11-11 1:14 ` [PATCH v3 11/15] hdlcdrv: remove HDLCDRV_MAGIC Ahelenia Ziemiańska
2 siblings, 0 replies; 4+ messages in thread
From: Ahelenia Ziemiańska @ 2022-11-11 1:13 UTC (permalink / raw)
Cc: Jonathan Corbet, Federico Vaga, Alex Shi, Yanteng Si, Hu Haowen,
Jean-Paul Roubelat, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Greg Kroah-Hartman, Jiri Slaby, linux-doc,
linux-kernel, linux-doc-tw-discuss, linux-hams, netdev
[-- Attachment #1: Type: text/plain, Size: 6523 bytes --]
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/YyMlovoskUcHLEb7@kroah.com/
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v3 11/15] hdlcdrv: remove HDLCDRV_MAGIC
2022-11-11 1:13 [PATCH v3 00/15] magic-number.rst funeral rites Ahelenia Ziemiańska
2022-11-11 1:13 ` [PATCH v3 01/15] hamradio: baycom: remove BAYCOM_MAGIC Ahelenia Ziemiańska
2022-11-11 1:13 ` [PATCH v3 02/15] hamradio: yam: remove YAM_MAGIC Ahelenia Ziemiańska
@ 2022-11-11 1:14 ` Ahelenia Ziemiańska
2 siblings, 0 replies; 4+ messages in thread
From: Ahelenia Ziemiańska @ 2022-11-11 1:14 UTC (permalink / raw)
Cc: Jonathan Corbet, Federico Vaga, Alex Shi, Yanteng Si, Hu Haowen,
Thomas Sailer, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Greg Kroah-Hartman, Jiri Slaby, Marc Kleine-Budde,
Jason A. Donenfeld, Kees Cook, Wolfram Sang, linux-doc,
linux-kernel, linux-doc-tw-discuss, linux-hams, netdev
[-- Attachment #1: Type: text/plain, Size: 9081 bytes --]
We have largely moved away from this approach, and we have better
debugging instrumentation nowadays: kill it.
Additionally, ~half HDLCDRV_MAGIC checks just early-exit instead of
noting the bug, so they're detrimental, if anything.
Link: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/
Acked-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
Documentation/process/magic-number.rst | 1 -
.../translations/it_IT/process/magic-number.rst | 1 -
.../translations/zh_CN/process/magic-number.rst | 1 -
.../translations/zh_TW/process/magic-number.rst | 1 -
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 +++------
include/linux/hdlcdrv.h | 2 --
9 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index c1c68c713cbc..3b3e607e1cbc 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -70,6 +70,5 @@ Magic Name Number Structure File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
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``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 5b609ca78a14..e8c659b6a743 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -76,6 +76,5 @@ Nome magico Numero Struttura File
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
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``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index ab4d4e32b61f..2105af32187c 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -59,6 +59,5 @@ Linux 魔术数
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
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``
===================== ================ ======================== ==========================================
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index a6131d978189..793a0ae9fb7c 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -62,6 +62,5 @@ Linux 魔術數
===================== ================ ======================== ==========================================
FASYNC_MAGIC 0x4601 fasync_struct ``include/linux/fs.h``
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``
===================== ================ ======================== ==========================================
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
index fd7da5bb1fa5..e1cf3ed42df6 100644
--- a/drivers/net/hamradio/baycom_par.c
+++ b/drivers/net/hamradio/baycom_par.c
@@ -418,7 +418,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
index 646f605e358f..65113cb6de8d 100644
--- a/drivers/net/hamradio/baycom_ser_fdx.c
+++ b/drivers/net/hamradio/baycom_ser_fdx.c
@@ -252,7 +252,7 @@ static irqreturn_t ser12_interrupt(int irq, void *dev_id)
unsigned char iir, msr;
unsigned int txcount = 0;
- if (!bc || bc->hdrv.magic != HDLCDRV_MAGIC)
+ if (!bc)
return IRQ_NONE;
/* fast way out for shared irq */
if ((iir = inb(IIR(dev->base_addr))) & 1)
@@ -507,7 +507,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
index 5d1ab4840753..df33e5cdb5c2 100644
--- a/drivers/net/hamradio/baycom_ser_hdx.c
+++ b/drivers/net/hamradio/baycom_ser_hdx.c
@@ -365,7 +365,7 @@ static irqreturn_t ser12_interrupt(int irq, void *dev_id)
struct baycom_state *bc = netdev_priv(dev);
unsigned char iir;
- if (!dev || !bc || bc->hdrv.magic != HDLCDRV_MAGIC)
+ if (!dev || !bc)
return IRQ_NONE;
/* fast way out */
if ((iir = inb(IIR(dev->base_addr))) & 1)
@@ -561,7 +561,6 @@ static int baycom_ioctl(struct net_device *dev, void __user *data,
return -EINVAL;
bc = netdev_priv(dev);
- BUG_ON(bc->hdrv.magic != HDLCDRV_MAGIC);
if (cmd != SIOCDEVPRIVATE)
return -ENOIOCTLCMD;
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 2263029d1a20..60abd6008cc7 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -158,7 +158,7 @@ void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s)
int i;
unsigned int mask1, mask2, mask3, mask4, mask5, mask6, word;
- if (!s || s->magic != HDLCDRV_MAGIC)
+ if (!s)
return;
if (test_and_set_bit(0, &s->hdlcrx.in_hdlc_rx))
return;
@@ -257,7 +257,7 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s)
struct sk_buff *skb;
int pkt_len;
- if (!s || s->magic != HDLCDRV_MAGIC)
+ if (!s)
return;
if (test_and_set_bit(0, &s->hdlctx.in_hdlc_tx))
return;
@@ -364,7 +364,7 @@ static void start_tx(struct net_device *dev, struct hdlcdrv_state *s)
void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
{
- if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb)
+ if (!s || s->hdlctx.ptt || !s->skb)
return;
if (s->ch_params.fulldup) {
start_tx(dev, s);
@@ -701,7 +701,6 @@ struct net_device *hdlcdrv_register(const struct hdlcdrv_ops *ops,
* initialize part of the hdlcdrv_state struct
*/
s = netdev_priv(dev);
- s->magic = HDLCDRV_MAGIC;
s->ops = ops;
dev->base_addr = baseaddr;
dev->irq = irq;
@@ -723,8 +722,6 @@ void hdlcdrv_unregister(struct net_device *dev)
{
struct hdlcdrv_state *s = netdev_priv(dev);
- BUG_ON(s->magic != HDLCDRV_MAGIC);
-
if (s->opened && s->ops->close)
s->ops->close(dev);
unregister_netdev(dev);
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index 5d70c3f98f5b..809ad0f5c99c 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -13,7 +13,6 @@
#include <linux/spinlock.h>
#include <uapi/linux/hdlcdrv.h>
-#define HDLCDRV_MAGIC 0x5ac6e778
#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */
#define HDLCDRV_BITBUFFER 256 /* should be a power of 2 for speed reasons */
#undef HDLCDRV_LOOPBACK /* define for HDLC debugging purposes */
@@ -84,7 +83,6 @@ struct hdlcdrv_ops {
};
struct hdlcdrv_state {
- int magic;
int opened;
const struct hdlcdrv_ops *ops;
--
2.30.2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 4+ messages in thread