2022-09-16 02:00:20

by Ahelenia Ziemiańska

[permalink] [raw]
Subject: [PATCH 4/5] tty: synclink_gt: remove MGSL_MAGIC

According to Greg, in the context of magic numbers as defined in
magic-number.rst, "the tty layer should not need this and I'll gladly
take patches"

Ref: 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/tty/synclink_gt.c | 8 --------
5 files changed, 12 deletions(-)

diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
index fdaa3e4b1953..2326c3be94fc 100644
--- a/Documentation/process/magic-number.rst
+++ b/Documentation/process/magic-number.rst
@@ -83,7 +83,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
-MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
index 1898f98875de..1803497816f1 100644
--- a/Documentation/translations/it_IT/process/magic-number.rst
+++ b/Documentation/translations/it_IT/process/magic-number.rst
@@ -89,7 +89,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
-MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
index 911cdaeaf698..9780bf710eeb 100644
--- a/Documentation/translations/zh_CN/process/magic-number.rst
+++ b/Documentation/translations/zh_CN/process/magic-number.rst
@@ -72,7 +72,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
-MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
index ac87f188235f..933545e92137 100644
--- a/Documentation/translations/zh_TW/process/magic-number.rst
+++ b/Documentation/translations/zh_TW/process/magic-number.rst
@@ -75,7 +75,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
-MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index 9bc2a9265277..19e3dd470fc2 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -91,7 +91,6 @@ static char *driver_name = "SyncLink GT";
static char *slgt_driver_name = "synclink_gt";
static char *tty_dev_prefix = "ttySLG";
MODULE_LICENSE("GPL");
-#define MGSL_MAGIC 0x5401
#define MAX_DEVICES 32

static const struct pci_device_id pci_table[] = {
@@ -215,8 +214,6 @@ struct slgt_info {

struct slgt_info *next_device; /* device list link */

- int magic;
-
char device_name[25];
struct pci_dev *pdev;

@@ -554,10 +551,6 @@ static inline int sanity_check(struct slgt_info *info, char *devname, const char
printk("null struct slgt_info for (%s) in %s\n", devname, name);
return 1;
}
- if (info->magic != MGSL_MAGIC) {
- printk("bad magic number struct slgt_info (%s) in %s\n", devname, name);
- return 1;
- }
#else
if (!info)
return 1;
@@ -3498,7 +3491,6 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
} else {
tty_port_init(&info->port);
info->port.ops = &slgt_port_ops;
- info->magic = MGSL_MAGIC;
INIT_WORK(&info->task, bh_handler);
info->max_frame_size = 4096;
info->base_clock = 14745600;
--
2.30.2


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

2022-09-16 07:10:16

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 4/5] tty: synclink_gt: remove MGSL_MAGIC

On 16. 09. 22, 3:55, наб wrote:
> According to Greg, in the context of magic numbers as defined in
> magic-number.rst, "the tty layer should not need this and I'll gladly
> take patches"
>
> Ref: https://lore.kernel.org/linux-doc/[email protected]/
> Signed-off-by: Ahelenia Ziemiańska <[email protected]>

Acked-by: Jiri Slaby <[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/tty/synclink_gt.c | 8 --------
> 5 files changed, 12 deletions(-)
>
> diff --git a/Documentation/process/magic-number.rst b/Documentation/process/magic-number.rst
> index fdaa3e4b1953..2326c3be94fc 100644
> --- a/Documentation/process/magic-number.rst
> +++ b/Documentation/process/magic-number.rst
> @@ -83,7 +83,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
> STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
> SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
> AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
> -MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
> MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
> USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
> FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
> diff --git a/Documentation/translations/it_IT/process/magic-number.rst b/Documentation/translations/it_IT/process/magic-number.rst
> index 1898f98875de..1803497816f1 100644
> --- a/Documentation/translations/it_IT/process/magic-number.rst
> +++ b/Documentation/translations/it_IT/process/magic-number.rst
> @@ -89,7 +89,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
> STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
> SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
> AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
> -MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
> MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
> USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
> FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
> diff --git a/Documentation/translations/zh_CN/process/magic-number.rst b/Documentation/translations/zh_CN/process/magic-number.rst
> index 911cdaeaf698..9780bf710eeb 100644
> --- a/Documentation/translations/zh_CN/process/magic-number.rst
> +++ b/Documentation/translations/zh_CN/process/magic-number.rst
> @@ -72,7 +72,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
> STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
> SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
> AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
> -MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
> MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
> USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
> FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
> diff --git a/Documentation/translations/zh_TW/process/magic-number.rst b/Documentation/translations/zh_TW/process/magic-number.rst
> index ac87f188235f..933545e92137 100644
> --- a/Documentation/translations/zh_TW/process/magic-number.rst
> +++ b/Documentation/translations/zh_TW/process/magic-number.rst
> @@ -75,7 +75,6 @@ SLIP_MAGIC 0x5302 slip ``drivers/net/sl
> STRIP_MAGIC 0x5303 strip ``drivers/net/strip.c``
> SIXPACK_MAGIC 0x5304 sixpack ``drivers/net/hamradio/6pack.h``
> AX25_MAGIC 0x5316 ax_disp ``drivers/net/mkiss.h``
> -MGSL_MAGIC 0x5401 mgsl_info ``drivers/char/synclink.c``
> MGSLPC_MAGIC 0x5402 mgslpc_info ``drivers/char/pcmcia/synclink_cs.c``
> USB_SERIAL_MAGIC 0x6702 usb_serial ``drivers/usb/serial/usb-serial.h``
> FULL_DUPLEX_MAGIC 0x6969 ``drivers/net/ethernet/dec/tulip/de2104x.c``
> diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
> index 9bc2a9265277..19e3dd470fc2 100644
> --- a/drivers/tty/synclink_gt.c
> +++ b/drivers/tty/synclink_gt.c
> @@ -91,7 +91,6 @@ static char *driver_name = "SyncLink GT";
> static char *slgt_driver_name = "synclink_gt";
> static char *tty_dev_prefix = "ttySLG";
> MODULE_LICENSE("GPL");
> -#define MGSL_MAGIC 0x5401
> #define MAX_DEVICES 32
>
> static const struct pci_device_id pci_table[] = {
> @@ -215,8 +214,6 @@ struct slgt_info {
>
> struct slgt_info *next_device; /* device list link */
>
> - int magic;
> -
> char device_name[25];
> struct pci_dev *pdev;
>
> @@ -554,10 +551,6 @@ static inline int sanity_check(struct slgt_info *info, char *devname, const char
> printk("null struct slgt_info for (%s) in %s\n", devname, name);
> return 1;
> }
> - if (info->magic != MGSL_MAGIC) {
> - printk("bad magic number struct slgt_info (%s) in %s\n", devname, name);
> - return 1;
> - }
> #else
> if (!info)
> return 1;
> @@ -3498,7 +3491,6 @@ static struct slgt_info *alloc_dev(int adapter_num, int port_num, struct pci_dev
> } else {
> tty_port_init(&info->port);
> info->port.ops = &slgt_port_ops;
> - info->magic = MGSL_MAGIC;
> INIT_WORK(&info->task, bh_handler);
> info->max_frame_size = 4096;
> info->base_clock = 14745600;

--
js
suse labs