2023-11-21 10:37:10

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 0/6] tty: remove unused structure members

I wrote a little indexer at https://github.com/jirislaby/clang-struct.
And it found there are few unused structure members inside tty. This
series removes them.

Cc: Alexander Gordeev <[email protected]>
Cc: David Sterba <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Kevin Cernekee <[email protected]>
Cc: [email protected]
Cc: Sven Schnelle <[email protected]>
Cc: Vasily Gorbik <[email protected]>

Jiri Slaby (SUSE) (6):
tty: con3215: drop raw3215_info::ubuffer
tty: ipwireless: remove unused ipw_dev::attribute_memory
tty: jsm: remove unused members from struct board_ops
tty: jsm: remove unused struct jsm_board members
tty: rp2: remove unused rp2_uart_port::ignore_rx
tty: serial_cs: remove unused struct serial_cfg_mem

drivers/s390/char/con3215.c | 1 -
drivers/tty/ipwireless/main.h | 3 ---
drivers/tty/serial/8250/serial_cs.c | 6 -----
drivers/tty/serial/jsm/jsm.h | 5 ----
drivers/tty/serial/jsm/jsm_cls.c | 36 --------------------------
drivers/tty/serial/jsm/jsm_neo.c | 40 -----------------------------
drivers/tty/serial/rp2.c | 1 -
7 files changed, 92 deletions(-)

--
2.42.1


2023-11-21 10:37:18

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 1/6] tty: con3215: drop raw3215_info::ubuffer

clang-struct [1] found raw3215_info::ubuffer unused.

It's actually not used since 2004 when we switched to kernel buffers.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: Sven Schnelle <[email protected]>
Cc: [email protected]
---
drivers/s390/char/con3215.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 99361618c31f..34bc343dcfcc 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -89,7 +89,6 @@ struct raw3215_info {
wait_queue_head_t empty_wait; /* wait queue for flushing */
struct timer_list timer; /* timer for delayed output */
int line_pos; /* position on the line (for tabs) */
- char ubuffer[80]; /* copy_from_user buffer */
};

/* array of 3215 devices structures */
--
2.42.1

2023-11-21 10:37:37

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 3/6] tty: jsm: remove unused members from struct board_ops

clang-struct [1] found board_ops::get_uart_bytes_left() and
::send_immediate_char() unused.

Both are only set but never called. And it has been like that since the
git history, so drop both the members along with the cls+neo
implementations.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
drivers/tty/serial/jsm/jsm.h | 2 --
drivers/tty/serial/jsm/jsm_cls.c | 36 ----------------------------
drivers/tty/serial/jsm/jsm_neo.c | 40 --------------------------------
3 files changed, 78 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm.h b/drivers/tty/serial/jsm/jsm.h
index 8489c07f4cd5..08a42f045ec8 100644
--- a/drivers/tty/serial/jsm/jsm.h
+++ b/drivers/tty/serial/jsm/jsm.h
@@ -115,8 +115,6 @@ struct board_ops {
void (*send_start_character)(struct jsm_channel *ch);
void (*send_stop_character)(struct jsm_channel *ch);
void (*copy_data_from_queue_to_uart)(struct jsm_channel *ch);
- u32 (*get_uart_bytes_left)(struct jsm_channel *ch);
- void (*send_immediate_char)(struct jsm_channel *ch, unsigned char);
};


diff --git a/drivers/tty/serial/jsm/jsm_cls.c b/drivers/tty/serial/jsm/jsm_cls.c
index 3fd57ac3ad81..1eda48964c0b 100644
--- a/drivers/tty/serial/jsm/jsm_cls.c
+++ b/drivers/tty/serial/jsm/jsm_cls.c
@@ -877,28 +877,6 @@ static void cls_uart_off(struct jsm_channel *ch)
writeb(0, &ch->ch_cls_uart->ier);
}

-/*
- * cls_get_uarts_bytes_left.
- * Returns 0 is nothing left in the FIFO, returns 1 otherwise.
- *
- * The channel lock MUST be held by the calling function.
- */
-static u32 cls_get_uart_bytes_left(struct jsm_channel *ch)
-{
- u8 left = 0;
- u8 lsr = readb(&ch->ch_cls_uart->lsr);
-
- /* Determine whether the Transmitter is empty or not */
- if (!(lsr & UART_LSR_TEMT))
- left = 1;
- else {
- ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
- left = 0;
- }
-
- return left;
-}
-
/*
* cls_send_break.
* Starts sending a break thru the UART.
@@ -916,18 +894,6 @@ static void cls_send_break(struct jsm_channel *ch)
}
}

-/*
- * cls_send_immediate_char.
- * Sends a specific character as soon as possible to the UART,
- * jumping over any bytes that might be in the write queue.
- *
- * The channel lock MUST be held by the calling function.
- */
-static void cls_send_immediate_char(struct jsm_channel *ch, unsigned char c)
-{
- writeb(c, &ch->ch_cls_uart->txrx);
-}
-
struct board_ops jsm_cls_ops = {
.intr = cls_intr,
.uart_init = cls_uart_init,
@@ -943,7 +909,5 @@ struct board_ops jsm_cls_ops = {
.send_start_character = cls_send_start_character,
.send_stop_character = cls_send_stop_character,
.copy_data_from_queue_to_uart = cls_copy_data_from_queue_to_uart,
- .get_uart_bytes_left = cls_get_uart_bytes_left,
- .send_immediate_char = cls_send_immediate_char
};

diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index 2bd640428970..1fa10f19368f 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -1309,25 +1309,6 @@ static void neo_uart_off(struct jsm_channel *ch)
writeb(0, &ch->ch_neo_uart->ier);
}

-static u32 neo_get_uart_bytes_left(struct jsm_channel *ch)
-{
- u8 left = 0;
- u8 lsr = readb(&ch->ch_neo_uart->lsr);
-
- /* We must cache the LSR as some of the bits get reset once read... */
- ch->ch_cached_lsr |= lsr;
-
- /* Determine whether the Transmitter is empty or not */
- if (!(lsr & UART_LSR_TEMT))
- left = 1;
- else {
- ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
- left = 0;
- }
-
- return left;
-}
-
/* Channel lock MUST be held by the calling function! */
static void neo_send_break(struct jsm_channel *ch)
{
@@ -1348,25 +1329,6 @@ static void neo_send_break(struct jsm_channel *ch)
}
}

-/*
- * neo_send_immediate_char.
- *
- * Sends a specific character as soon as possible to the UART,
- * jumping over any bytes that might be in the write queue.
- *
- * The channel lock MUST be held by the calling function.
- */
-static void neo_send_immediate_char(struct jsm_channel *ch, unsigned char c)
-{
- if (!ch)
- return;
-
- writeb(c, &ch->ch_neo_uart->txrx);
-
- /* flush write operation */
- neo_pci_posting_flush(ch->ch_bd);
-}
-
struct board_ops jsm_neo_ops = {
.intr = neo_intr,
.uart_init = neo_uart_init,
@@ -1382,6 +1344,4 @@ struct board_ops jsm_neo_ops = {
.send_start_character = neo_send_start_character,
.send_stop_character = neo_send_stop_character,
.copy_data_from_queue_to_uart = neo_copy_data_from_queue_to_uart,
- .get_uart_bytes_left = neo_get_uart_bytes_left,
- .send_immediate_char = neo_send_immediate_char
};
--
2.42.1

2023-11-21 10:37:55

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 6/6] tty: serial_cs: remove unused struct serial_cfg_mem

clang-struct [1] found struct serial_cfg_mem's members unused.

In fact, the whole structure is unused since commit 6ae3b84d9793
("serial_cs: use pcmcia_loop_config() and pre-determined values"). Drop
it completely.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
drivers/tty/serial/8250/serial_cs.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/drivers/tty/serial/8250/serial_cs.c b/drivers/tty/serial/8250/serial_cs.c
index dc2ef05a10eb..2056aed46688 100644
--- a/drivers/tty/serial/8250/serial_cs.c
+++ b/drivers/tty/serial/8250/serial_cs.c
@@ -90,12 +90,6 @@ struct serial_info {
const struct serial_quirk *quirk;
};

-struct serial_cfg_mem {
- tuple_t tuple;
- cisparse_t parse;
- u_char buf[256];
-};
-
/*
* vers_1 5.0, "Brain Boxes", "2-Port RS232 card", "r6"
* manfid 0x0160, 0x0104
--
2.42.1

2023-11-21 10:38:01

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 4/6] tty: jsm: remove unused struct jsm_board members

clang-struct [1] found jsm_board::type and ::jsm_board_entry unused.

::jsm_board_entry is unused since 614a7d6a76b7 ("fix up newly added jsm driver")
::type was never used as far as I can tell. Even when the driver was
introduced in the pre-git era.

Remove them both.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
---
drivers/tty/serial/jsm/jsm.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/tty/serial/jsm/jsm.h b/drivers/tty/serial/jsm/jsm.h
index 08a42f045ec8..df55e5dc5afc 100644
--- a/drivers/tty/serial/jsm/jsm.h
+++ b/drivers/tty/serial/jsm/jsm.h
@@ -125,7 +125,6 @@ struct jsm_board
{
int boardnum; /* Board number: 0-32 */

- int type; /* Type of board */
u8 rev; /* PCI revision ID */
struct pci_dev *pci_dev;
u32 maxports; /* MAX ports this board can handle */
@@ -153,8 +152,6 @@ struct jsm_board
u32 bd_dividend; /* Board/UARTs specific dividend */

struct board_ops *bd_ops;
-
- struct list_head jsm_board_entry;
};

/************************************************************************
--
2.42.1

2023-11-21 10:38:37

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 2/6] tty: ipwireless: remove unused ipw_dev::attribute_memory

clang-struct [1] found ipw_dev::attribute_memory unused.

As far as I can see it was never used since the driver merge. Drop it.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: David Sterba <[email protected]>
---
drivers/tty/ipwireless/main.h | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/tty/ipwireless/main.h b/drivers/tty/ipwireless/main.h
index 73818bb64416..a5728a5b3f83 100644
--- a/drivers/tty/ipwireless/main.h
+++ b/drivers/tty/ipwireless/main.h
@@ -49,9 +49,6 @@ struct ipw_dev {

void __iomem *common_memory;

- /* Reference to attribute memory, containing CIS data */
- void *attribute_memory;
-
/* Hardware context */
struct ipw_hardware *hardware;
/* Network layer context */
--
2.42.1

2023-11-21 10:38:47

by Jiri Slaby

[permalink] [raw]
Subject: [PATCH 5/6] tty: rp2: remove unused rp2_uart_port::ignore_rx

clang-struct [1] found rp2_uart_port::ignore_rx unused.

It was actually never used. Not even in introductory commit 7d9f49afa451
("serial: rp2: New driver for Comtrol RocketPort 2 cards").

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Kevin Cernekee <[email protected]>
---
drivers/tty/serial/rp2.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/tty/serial/rp2.c b/drivers/tty/serial/rp2.c
index d46a81cddfcd..4132fcff7d4e 100644
--- a/drivers/tty/serial/rp2.c
+++ b/drivers/tty/serial/rp2.c
@@ -178,7 +178,6 @@ struct rp2_card;
struct rp2_uart_port {
struct uart_port port;
int idx;
- int ignore_rx;
struct rp2_card *card;
void __iomem *asic_base;
void __iomem *base;
--
2.42.1

2023-11-21 12:19:36

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 2/6] tty: ipwireless: remove unused ipw_dev::attribute_memory

On Tue, 21 Nov 2023, Jiri Slaby (SUSE) wrote:

> clang-struct [1] found ipw_dev::attribute_memory unused.
>
> As far as I can see it was never used since the driver merge. Drop it.
>
> [1] https://github.com/jirislaby/clang-struct
>
> Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
> Cc: Jiri Kosina <[email protected]>

FWIW

Acked-by: Jiri Kosina <[email protected]>

Thanks,

--
Jiri Kosina
SUSE Labs

2023-11-21 15:35:24

by Ilpo Järvinen

[permalink] [raw]
Subject: Re: [PATCH 0/6] tty: remove unused structure members

On Tue, 21 Nov 2023, Jiri Slaby (SUSE) wrote:

> I wrote a little indexer at https://github.com/jirislaby/clang-struct.
> And it found there are few unused structure members inside tty. This
> series removes them.

> Jiri Slaby (SUSE) (6):
> tty: con3215: drop raw3215_info::ubuffer
> tty: ipwireless: remove unused ipw_dev::attribute_memory
> tty: jsm: remove unused members from struct board_ops
> tty: jsm: remove unused struct jsm_board members
> tty: rp2: remove unused rp2_uart_port::ignore_rx
> tty: serial_cs: remove unused struct serial_cfg_mem

For the whole series,

Reviewed-by: Ilpo J?rvinen <[email protected]>

--
i.

2023-11-21 16:39:31

by Alexander Gordeev

[permalink] [raw]
Subject: Re: [PATCH 1/6] tty: con3215: drop raw3215_info::ubuffer

On Tue, Nov 21, 2023 at 11:36:21AM +0100, Jiri Slaby (SUSE) wrote:
> clang-struct [1] found raw3215_info::ubuffer unused.
>
> It's actually not used since 2004 when we switched to kernel buffers.
>
> [1] https://github.com/jirislaby/clang-struct
>
> Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
> Cc: Heiko Carstens <[email protected]>
> Cc: Vasily Gorbik <[email protected]>
> Cc: Alexander Gordeev <[email protected]>
> Cc: Christian Borntraeger <[email protected]>
> Cc: Sven Schnelle <[email protected]>
> Cc: [email protected]
> ---
> drivers/s390/char/con3215.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
> index 99361618c31f..34bc343dcfcc 100644
> --- a/drivers/s390/char/con3215.c
> +++ b/drivers/s390/char/con3215.c
> @@ -89,7 +89,6 @@ struct raw3215_info {
> wait_queue_head_t empty_wait; /* wait queue for flushing */
> struct timer_list timer; /* timer for delayed output */
> int line_pos; /* position on the line (for tabs) */
> - char ubuffer[80]; /* copy_from_user buffer */
> };
>
> /* array of 3215 devices structures */

Acked-by: Alexander Gordeev <[email protected]>

2023-11-21 18:38:36

by David Sterba

[permalink] [raw]
Subject: Re: [PATCH 2/6] tty: ipwireless: remove unused ipw_dev::attribute_memory

On Tue, Nov 21, 2023 at 11:36:22AM +0100, Jiri Slaby (SUSE) wrote:
> clang-struct [1] found ipw_dev::attribute_memory unused.
>
> As far as I can see it was never used since the driver merge. Drop it.
>
> [1] https://github.com/jirislaby/clang-struct
>
> Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
> Cc: Jiri Kosina <[email protected]>
> Cc: David Sterba <[email protected]>

Acked-by: David Sterba <[email protected]>