[03/15] pcmcia: synclink_cs: remove MGSLPC_MAGIC

Message ID c909c36218b0d4b5888b41f9af18e763a5b36dcf.1666822928.git.nabijaczleweli@nabijaczleweli.xyz
State New
Headers
Series [01/15] hamradio: baycom: remove BAYCOM_MAGIC |

Commit Message

Ahelenia Ziemiańska Oct. 26, 2022, 10:42 p.m. UTC
  MGSLPC_PARANOIA_CHECK has never been defined automatically,
and in the context of magic numbers as defined in magic-number.rst,
"the tty layer should not need this"

This is 100% dead cruft, and we have better debugging tooling nowadays:
kill it

Ref: https://lore.kernel.org/linux-doc/YyMlovoskUcHLEb7@kroah.com/
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/char/pcmcia/synclink_cs.c                      | 10 ----------
 5 files changed, 14 deletions(-)
  

Comments

Bagas Sanjaya Oct. 28, 2022, 1:21 p.m. UTC | #1
On 10/27/22 05:42, наб wrote:
> This is 100% dead cruft, and we have better debugging tooling nowadays:
> kill it
> 

Again, same reply as [1].

Also, ask yourself: what are better ways to do debugging kernel (including
tools) than relying to magic numbers?

Thanks.

[1]: https://lore.kernel.org/linux-doc/47c2bffb-6bfe-7f5d-0d2d-3cbb99d31019@gmail.com/
  

Patch

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index a4414b7e15aa..18f8b1e3a993 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -72,7 +72,6 @@  PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/
 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``
-MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.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 f51c5ef9d93f..827167b18f15 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -78,7 +78,6 @@  PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/
 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``
-MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.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 3b53bd67e41b..9553475e9867 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -61,7 +61,6 @@  PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/
 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``
-MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.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 7d176a87ec3c..8a64f56ae267 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -64,7 +64,6 @@  PG_MAGIC              'P'              pg_{read,write}_hdr      ``include/linux/
 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``
-MGSLPC_MAGIC          0x5402           mgslpc_info              ``drivers/char/pcmcia/synclink_cs.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/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index b2735be81ab2..262f087bfc01 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -137,7 +137,6 @@  struct _input_signal_events {
 typedef struct _mgslpc_info {
 	struct tty_port		port;
 	void *if_ptr;	/* General purpose pointer (used by SPPP) */
-	int			magic;
 	int			line;
 
 	struct mgsl_icount	icount;
@@ -228,8 +227,6 @@  typedef struct _mgslpc_info {
 
 } MGSLPC_INFO;
 
-#define MGSLPC_MAGIC 0x5402
-
 /*
  * The size of the serial xmit buffer is 1 page, or 4096 bytes
  */
@@ -525,7 +522,6 @@  static int mgslpc_probe(struct pcmcia_device *link)
 		return -ENOMEM;
 	}
 
-	info->magic = MGSLPC_MAGIC;
 	tty_port_init(&info->port);
 	info->port.ops = &mgslpc_port_ops;
 	INIT_WORK(&info->task, bh_handler);
@@ -652,8 +648,6 @@  static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
 					char *name, const char *routine)
 {
 #ifdef MGSLPC_PARANOIA_CHECK
-	static const char *badmagic =
-		"Warning: bad magic number for mgsl struct (%s) in %s\n";
 	static const char *badinfo =
 		"Warning: null mgslpc_info for (%s) in %s\n";
 
@@ -661,10 +655,6 @@  static inline bool mgslpc_paranoia_check(MGSLPC_INFO *info,
 		printk(badinfo, name, routine);
 		return true;
 	}
-	if (info->magic != MGSLPC_MAGIC) {
-		printk(badmagic, name, routine);
-		return true;
-	}
 #else
 	if (!info)
 		return true;