Skip to contentSkip to conversation

tty: remove unused structure members

PATCH In review Jiri Slaby (SUSE) 5 participants 11 messages Nov 21, 2023

Subsystems (4)
lore
Share & tools
lore

Jiri Slaby (SUSE)

author maintainer
#0 lore raw

cover 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 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(-)
Signature · 1 line
2.42.1
author maintainer
#1 lore raw

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

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]>
---
 drivers/s390/char/con3215.c | 1 -
 1 file changed, 1 deletion(-)
drivers/s390/char/con3215.c +0 -1
index 99361618c31f..34bc343dcfcc 100644
@@ -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 */
Signature · 1 line
2.42.1
author maintainer
#3 lore raw

PATCH 2/6 tty: ipwireless: remove unused ipw_dev::attribute_memory

In reply to Jiri Slaby (SUSE)

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

---
 drivers/tty/ipwireless/main.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/tty/ipwireless/main.h +0 -3
index 73818bb64416..a5728a5b3f83 100644
@@ -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 */
Signature · 1 line
2.42.1
author maintainer
#6 lore raw

PATCH 3/6 tty: jsm: remove unused members from struct board_ops

In reply to Jiri Slaby (SUSE)

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

---
 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(-)
drivers/tty/serial/jsm/jsm.h +0 -2
index 8489c07f4cd5..08a42f045ec8 100644
@@ -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);
 };
 
 
drivers/tty/serial/jsm/jsm_cls.c +0 -36
index 3fd57ac3ad81..1eda48964c0b 100644
@@ -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
 };
 
drivers/tty/serial/jsm/jsm_neo.c +0 -40
index 2bd640428970..1fa10f19368f 100644
@@ -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
 };
Signature · 1 line
2.42.1
author maintainer
#7 lore raw

PATCH 4/6 tty: jsm: remove unused struct jsm_board members

In reply to Jiri Slaby (SUSE)

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

---
 drivers/tty/serial/jsm/jsm.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/tty/serial/jsm/jsm.h +0 -3
index 08a42f045ec8..df55e5dc5afc 100644
@@ -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;
 };
 
 /************************************************************************
Signature · 1 line
2.42.1
author maintainer
#8 lore raw

PATCH 5/6 tty: rp2: remove unused rp2_uart_port::ignore_rx

In reply to Jiri Slaby (SUSE)

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

---
 drivers/tty/serial/rp2.c | 1 -
 1 file changed, 1 deletion(-)
drivers/tty/serial/rp2.c +0 -1
index d46a81cddfcd..4132fcff7d4e 100644
@@ -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;
Signature · 1 line
2.42.1
author maintainer
#9 lore raw

PATCH 6/6 tty: serial_cs: remove unused struct serial_cfg_mem

In reply to Jiri Slaby (SUSE)

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

---
 drivers/tty/serial/8250/serial_cs.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/tty/serial/8250/serial_cs.c +0 -6
index dc2ef05a10eb..2056aed46688 100644
@@ -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
Signature · 1 line
2.42.1
Acked-by on v1 2/6
#4 lore raw

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

In reply to Jiri Slaby (SUSE)
Quoted 8 lines · Jiri Slaby (SUSE)

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

FWIW

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
Reviewed-by on the v1 series
#10 lore raw
In reply to Jiri Slaby (SUSE)
Quoted 11 lines · Jiri Slaby (SUSE)

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,

Signature · 1 line
 i.
maintainer Acked-by on v1 1/6
#2 lore raw

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

In reply to Jiri Slaby (SUSE)
Quoted 22 lines · Jiri Slaby (SUSE)

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

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]>
---
 drivers/s390/char/con3215.c | 1 -
 1 file changed, 1 deletion(-)
drivers/s390/char/con3215.c +0 -0
index 99361618c31f..34bc343dcfcc 100644

drivers/s390/char/con3215.c struct raw3215_info { · line 94

Quoted 7 lines
drivers/s390/char/con3215.c +0 -1
@@ -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 on v1 2/6
#5 lore raw

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

In reply to Jiri Slaby (SUSE)
Quoted 9 lines · Jiri Slaby (SUSE)

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