Skip to content

Commit 6554efd

Browse files
andredjannau
authored andcommitted
tty: serial: samsung_tty: cast the interrupt's void *id just once
The interrupt handler routines and helpers are casting the 'void *' pointer to 'struct exynos_uart_port *' all over the place. There is no need for that, we can do the casting once and keep passing the 'struct exynos_uart_port *', simplifying the code and saving a few lines of code. No functional changes. Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: André Draszik <andre.draszik@linaro.org> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20240808-samsung-tty-cleanup-v3-2-494412f49f4b@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3070d3e commit 6554efd

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

drivers/tty/serial/samsung_tty.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport)
707707

708708
static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport);
709709

710-
static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
710+
static irqreturn_t s3c24xx_serial_rx_chars_dma(struct s3c24xx_uart_port *ourport)
711711
{
712-
struct s3c24xx_uart_port *ourport = dev_id;
713712
struct uart_port *port = &ourport->port;
714713
struct s3c24xx_uart_dma *dma = ourport->dma;
715714
struct tty_struct *tty = tty_port_tty_get(&ourport->port.state->port);
@@ -843,9 +842,8 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
843842
tty_flip_buffer_push(&port->state->port);
844843
}
845844

846-
static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id)
845+
static irqreturn_t s3c24xx_serial_rx_chars_pio(struct s3c24xx_uart_port *ourport)
847846
{
848-
struct s3c24xx_uart_port *ourport = dev_id;
849847
struct uart_port *port = &ourport->port;
850848

851849
uart_port_lock(port);
@@ -855,13 +853,11 @@ static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id)
855853
return IRQ_HANDLED;
856854
}
857855

858-
static irqreturn_t s3c24xx_serial_rx_irq(void *dev_id)
856+
static irqreturn_t s3c24xx_serial_rx_irq(struct s3c24xx_uart_port *ourport)
859857
{
860-
struct s3c24xx_uart_port *ourport = dev_id;
861-
862858
if (ourport->dma && ourport->dma->rx_chan)
863-
return s3c24xx_serial_rx_chars_dma(dev_id);
864-
return s3c24xx_serial_rx_chars_pio(dev_id);
859+
return s3c24xx_serial_rx_chars_dma(ourport);
860+
return s3c24xx_serial_rx_chars_pio(ourport);
865861
}
866862

867863
static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
@@ -928,9 +924,8 @@ static void s3c24xx_serial_tx_chars(struct s3c24xx_uart_port *ourport)
928924
s3c24xx_serial_stop_tx(port);
929925
}
930926

931-
static irqreturn_t s3c24xx_serial_tx_irq(void *id)
927+
static irqreturn_t s3c24xx_serial_tx_irq(struct s3c24xx_uart_port *ourport)
932928
{
933-
struct s3c24xx_uart_port *ourport = id;
934929
struct uart_port *port = &ourport->port;
935930

936931
uart_port_lock(port);
@@ -944,17 +939,17 @@ static irqreturn_t s3c24xx_serial_tx_irq(void *id)
944939
/* interrupt handler for s3c64xx and later SoC's.*/
945940
static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id)
946941
{
947-
const struct s3c24xx_uart_port *ourport = id;
942+
struct s3c24xx_uart_port *ourport = id;
948943
const struct uart_port *port = &ourport->port;
949944
u32 pend = rd_regl(port, S3C64XX_UINTP);
950945
irqreturn_t ret = IRQ_HANDLED;
951946

952947
if (pend & S3C64XX_UINTM_RXD_MSK) {
953-
ret = s3c24xx_serial_rx_irq(id);
948+
ret = s3c24xx_serial_rx_irq(ourport);
954949
wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_RXD_MSK);
955950
}
956951
if (pend & S3C64XX_UINTM_TXD_MSK) {
957-
ret = s3c24xx_serial_tx_irq(id);
952+
ret = s3c24xx_serial_tx_irq(ourport);
958953
wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_TXD_MSK);
959954
}
960955
return ret;
@@ -963,19 +958,19 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id)
963958
/* interrupt handler for Apple SoC's.*/
964959
static irqreturn_t apple_serial_handle_irq(int irq, void *id)
965960
{
966-
const struct s3c24xx_uart_port *ourport = id;
961+
struct s3c24xx_uart_port *ourport = id;
967962
const struct uart_port *port = &ourport->port;
968963
u32 pend = rd_regl(port, S3C2410_UTRSTAT);
969964
irqreturn_t ret = IRQ_NONE;
970965

971966
if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO)) {
972967
wr_regl(port, S3C2410_UTRSTAT,
973968
APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO);
974-
ret = s3c24xx_serial_rx_irq(id);
969+
ret = s3c24xx_serial_rx_irq(ourport);
975970
}
976971
if (pend & APPLE_S5L_UTRSTAT_TXTHRESH) {
977972
wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_TXTHRESH);
978-
ret = s3c24xx_serial_tx_irq(id);
973+
ret = s3c24xx_serial_tx_irq(ourport);
979974
}
980975

981976
return ret;

0 commit comments

Comments
 (0)