Skip to contentSkip to conversation

tty: remove casts from tty->disc_data

PATCH In review Jiri Slaby (SUSE) 5 participants 10 messages Aug 1, 2023 – Aug 3, 2023

Subsystems (6)
lore
Share & tools
lore

Jiri Slaby (SUSE)

author maintainer
#0 lore raw

cover tty: remove casts from tty->disc_data

There are still two "casters" remaining. Fix them.

Jiri Slaby (SUSE) (2):
can: can327: remove casts from tty->disc_data
net: nfc: remove casts from tty->disc_data

 drivers/net/can/can327.c | 8 ++++----
 net/nfc/nci/uart.c       | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/2 can: can327: remove casts from tty->disc_data

tty->disc_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly.

Cc Max Staudt <[email protected]>
Cc Wolfgang Grandegger <[email protected]>
Cc Marc Kleine-Budde <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Dario Binacchi <[email protected]>
---
 drivers/net/can/can327.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/can327.c +4 -4
index dc7192ecb001..ee8a977acc8d 100644
@@ -888,7 +888,7 @@ static bool can327_is_valid_rx_char(u8 c)
 static void can327_ldisc_rx(struct tty_struct *tty, const unsigned char *cp,
 			    const char *fp, int count)
 {
-	struct can327 *elm = (struct can327 *)tty->disc_data;
+	struct can327 *elm = tty->disc_data;
 	size_t first_new_char_idx;
 
 	if (elm->uart_side_failure)
@@ -990,7 +990,7 @@ static void can327_ldisc_tx_worker(struct work_struct *work)
 /* Called by the driver when there's room for more data. */
 static void can327_ldisc_tx_wakeup(struct tty_struct *tty)
 {
-	struct can327 *elm = (struct can327 *)tty->disc_data;
+	struct can327 *elm = tty->disc_data;
 
 	schedule_work(&elm->tx_work);
 }
@@ -1067,7 +1067,7 @@ static int can327_ldisc_open(struct tty_struct *tty)
  */
 static void can327_ldisc_close(struct tty_struct *tty)
 {
-	struct can327 *elm = (struct can327 *)tty->disc_data;
+	struct can327 *elm = tty->disc_data;
 
 	/* unregister_netdev() calls .ndo_stop() so we don't have to. */
 	unregister_candev(elm->dev);
@@ -1092,7 +1092,7 @@ static void can327_ldisc_close(struct tty_struct *tty)
 static int can327_ldisc_ioctl(struct tty_struct *tty, unsigned int cmd,
 			      unsigned long arg)
 {
-	struct can327 *elm = (struct can327 *)tty->disc_data;
+	struct can327 *elm = tty->disc_data;
 	unsigned int tmp;
 
 	switch (cmd) {
Signature · 1 line
2.41.0
author maintainer
#4 lore raw

PATCH 2/2 net: nfc: remove casts from tty->disc_data

In reply to Jiri Slaby (SUSE)

tty->disc_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly.

Cc Max Staudt <[email protected]>
Cc Wolfgang Grandegger <[email protected]>
Cc Marc Kleine-Budde <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
---
 net/nfc/nci/uart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
net/nfc/nci/uart.c +4 -4
index cc8fa9e36159..082f94be0996 100644
@@ -172,7 +172,7 @@ static int nci_uart_tty_open(struct tty_struct *tty)
  */
 static void nci_uart_tty_close(struct tty_struct *tty)
 {
-	struct nci_uart *nu = (void *)tty->disc_data;
+	struct nci_uart *nu = tty->disc_data;
 
 	/* Detach from the tty */
 	tty->disc_data = NULL;
@@ -204,7 +204,7 @@ static void nci_uart_tty_close(struct tty_struct *tty)
  */
 static void nci_uart_tty_wakeup(struct tty_struct *tty)
 {
-	struct nci_uart *nu = (void *)tty->disc_data;
+	struct nci_uart *nu = tty->disc_data;
 
 	if (!nu)
 		return;
@@ -298,7 +298,7 @@ static int nci_uart_default_recv_buf(struct nci_uart *nu, const u8 *data,
 static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
 				 const char *flags, int count)
 {
-	struct nci_uart *nu = (void *)tty->disc_data;
+	struct nci_uart *nu = tty->disc_data;
 
 	if (!nu || tty != nu->tty)
 		return;
@@ -325,7 +325,7 @@ static void nci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
 static int nci_uart_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
 			      unsigned long arg)
 {
-	struct nci_uart *nu = (void *)tty->disc_data;
+	struct nci_uart *nu = tty->disc_data;
 	int err = 0;
 
 	switch (cmd) {
Signature · 1 line
2.41.0
maintainer
#7 lore raw

Re: [PATCH 2/2] net: nfc: remove casts from tty->disc_data

In reply to Jiri Slaby (SUSE)
Quoted 2 lines · On Tue, 1 Aug 2023 08:22:37 +0200 Jiri Slaby (SUSE) wrote:

tty->disc_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly.

Which tree are these expected to flow thru?

author maintainer
#8 lore raw

Re: [PATCH 2/2] net: nfc: remove casts from tty->disc_data

Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Tue, 1 Aug 2023 08:22:37 +0200 Jiri Slaby (SUSE) wrote:

tty->disc_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly.

Which tree are these expected to flow thru?

The intention was through the tty tree. But I don't mind either way -- it's up to you Greg.

thanks,

Signature · 2 lines
js
suse labs
maintainer
#9 lore raw

Re: [PATCH 2/2] net: nfc: remove casts from tty->disc_data

Quoted 9 lines · Jiri Slaby
Quoted 5 lines · Jakub Kicinski
Quoted 2 lines · On Tue, 1 Aug 2023 08:22:37 +0200 Jiri Slaby (SUSE) wrote:

tty->disc_data is 'void *', so there is no need to cast from that. Therefore remove the casts and assign the pointer directly.

Which tree are these expected to flow thru?

The intention was through the tty tree. But I don't mind either way -- it's up to you Greg.

I'll take them, thanks!

greg k-h