From patchwork Thu Aug 8 08:11:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13757106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1F5FAC52D73 for ; Thu, 8 Aug 2024 08:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CqxEVbtlJAYIU2G7koLN0SZSQulPINd9bO5ddzhKZmM=; b=GekOlIk+797SemZPVtCgJ5mXZQ push+w6dW63kvqfSrqq2c+a/mOP1zqVVqD/ZkyuowG/ADE7sLQTlQ5KmZpsnGKiaOpR3YsLhiWn3n LW+7Z5zkGzwgK/2HJBhkN0A7F6NBCNU7173dlE2H/DNU6TFC9+qLl1MuQ2eoqRGW8b1AGoNve+Zdt wMNmAOlO/w0Hgw0ww+sWgwyPKdLxBtEfpPEvHY23nJbaaRYRzDre+P9lpaRtwLWh6MwRdTNbaVIp9 a6kqR4q9OIi7nhH2n8saUH8KYdxEaZ1CRwND0Vk+KP8U3Ctm21oKDBQYAZ2762vSk8IMpBfwxW5zY F/tJLAhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbyHk-00000007YDO-0KBb; Thu, 08 Aug 2024 08:14:12 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbyFW-00000007XhE-3kQb for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2024 08:12:10 +0000 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a7aada2358fso284314866b.0 for ; Thu, 08 Aug 2024 01:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723104713; x=1723709513; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=CqxEVbtlJAYIU2G7koLN0SZSQulPINd9bO5ddzhKZmM=; b=XI8cqCxVbHOcPqXRqjmjtOJBppJWa9DkDVVRsP0lxuAw/ypCo6+2fDEvgAc+RH81DP IOq6AVZlUsk4KRjttdL+4iPPbr9RNBV6bwFcNHkLpfGHAvtYbtCFfMsBV4Xiy+saWfK0 JbKFwjFpGwAssbUTUWWapB2XzZVICFjSPx5dAeGlnxFcUF3MlIzek89YU8Xk28VagVUN FVcdALhP0gHoxIbGKn4BZSuVS3G2S4M7ry765TB1KXXdOGeuD5gZ2l7N4vJt+AI2lxJS 2iJYNb1BwPQk7aq33gnbkKXx3ttb2/TUaXJzfaiG8/shKbcYWwFDqFZUxlR6ERxnY8tL M6lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723104713; x=1723709513; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CqxEVbtlJAYIU2G7koLN0SZSQulPINd9bO5ddzhKZmM=; b=IpHetRzL4CPkFy8+0tgoPOlU4ISxHWw1J0YOJx90XSIHfWW3WwJacPIjhu1yP+e3lM BUsD/Pizj8ggpyofSx7sg3Yed7VBSWMI3WiQTUPFeooFFi6k1x2yPdOoxTqekCDzQgls 0VL2PrlvayDAO1i5DB6UztVrp+ZdZA5/J1+9LSTNUiBhl8v9Sew+2rHUbDbxBdZ1bxJH vH3D7zgHCp36fpo61fOAl3q/fg0QNZqjo7BdsZgpnEs47l3+DVEDWE6xFrcBkJ2q0jfG ZC524vUK1UjBzcmaD7Mz0PwtBXBQ5gTB075+BOkiLHb7Ieweo4XVsTiXjmV72oTl4zBX 6rVg== X-Forwarded-Encrypted: i=1; AJvYcCU8wrOLyd3rOTX1MT0R1tryOwN7waRvIjaXHBKI+P59imJrN5slF0P0ecLiiYsIRuHx7346qqst/2HMR2rdCORLuENWHtT1UAmq1G40F+T5hqxeFks= X-Gm-Message-State: AOJu0Ywu0BBSRF6UG2v0RrGIz82kYawk4wfzAmqcf/itvn69ojyfDx7k NVOx9N17dkHmQR6Rd9ccm1SUeASUR/kZ2tI263gcUAz/ojO/+wuEw2aSU0jhMPQ= X-Google-Smtp-Source: AGHT+IGHGZjdFmV3eFGqC8FJHxVC9D1wSPHpGQgKUM7hRt/4kJ1eWwU/AAaASzthWd/iCBjPMuERUg== X-Received: by 2002:a17:906:b15a:b0:a7a:b26d:fb5 with SMTP id a640c23a62f3a-a8091f1eb5dmr68212166b.19.1723104712714; Thu, 08 Aug 2024 01:11:52 -0700 (PDT) Received: from puffmais.c.googlers.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7dc9c0c578sm716931166b.73.2024.08.08.01.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Aug 2024 01:11:52 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Thu, 08 Aug 2024 09:11:52 +0100 Subject: [PATCH v3 2/2] tty: serial: samsung_tty: cast the interrupt's void *id just once MIME-Version: 1.0 Message-Id: <20240808-samsung-tty-cleanup-v3-2-494412f49f4b@linaro.org> References: <20240808-samsung-tty-cleanup-v3-0-494412f49f4b@linaro.org> In-Reply-To: <20240808-samsung-tty-cleanup-v3-0-494412f49f4b@linaro.org> To: Krzysztof Kozlowski , Alim Akhtar , Greg Kroah-Hartman , Jiri Slaby Cc: Peter Griffin , Tudor Ambarus , Will McVicker , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240808_011154_954514_39FA7F81 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Signed-off-by: André Draszik Reviewed-by: Jiri Slaby --- v3: undo too eager removal of 'const' where unnecessary (Jiri) v2: fix -Wdiscarded-qualifiers, sorry --- drivers/tty/serial/samsung_tty.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 1c6d0ffe5649..c4f2ac9518aa 100644 --- a/drivers/tty/serial/samsung_tty.c +++ b/drivers/tty/serial/samsung_tty.c @@ -707,9 +707,8 @@ static void enable_rx_pio(struct s3c24xx_uart_port *ourport) static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport); -static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) +static irqreturn_t s3c24xx_serial_rx_chars_dma(struct s3c24xx_uart_port *ourport) { - struct s3c24xx_uart_port *ourport = dev_id; struct uart_port *port = &ourport->port; struct s3c24xx_uart_dma *dma = ourport->dma; 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) tty_flip_buffer_push(&port->state->port); } -static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id) +static irqreturn_t s3c24xx_serial_rx_chars_pio(struct s3c24xx_uart_port *ourport) { - struct s3c24xx_uart_port *ourport = dev_id; struct uart_port *port = &ourport->port; uart_port_lock(port); @@ -855,13 +853,11 @@ static irqreturn_t s3c24xx_serial_rx_chars_pio(void *dev_id) return IRQ_HANDLED; } -static irqreturn_t s3c24xx_serial_rx_irq(void *dev_id) +static irqreturn_t s3c24xx_serial_rx_irq(struct s3c24xx_uart_port *ourport) { - struct s3c24xx_uart_port *ourport = dev_id; - if (ourport->dma && ourport->dma->rx_chan) - return s3c24xx_serial_rx_chars_dma(dev_id); - return s3c24xx_serial_rx_chars_pio(dev_id); + return s3c24xx_serial_rx_chars_dma(ourport); + return s3c24xx_serial_rx_chars_pio(ourport); } 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) s3c24xx_serial_stop_tx(port); } -static irqreturn_t s3c24xx_serial_tx_irq(void *id) +static irqreturn_t s3c24xx_serial_tx_irq(struct s3c24xx_uart_port *ourport) { - struct s3c24xx_uart_port *ourport = id; struct uart_port *port = &ourport->port; uart_port_lock(port); @@ -944,17 +939,17 @@ static irqreturn_t s3c24xx_serial_tx_irq(void *id) /* interrupt handler for s3c64xx and later SoC's.*/ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id) { - const struct s3c24xx_uart_port *ourport = id; + struct s3c24xx_uart_port *ourport = id; const struct uart_port *port = &ourport->port; u32 pend = rd_regl(port, S3C64XX_UINTP); irqreturn_t ret = IRQ_HANDLED; if (pend & S3C64XX_UINTM_RXD_MSK) { - ret = s3c24xx_serial_rx_irq(id); + ret = s3c24xx_serial_rx_irq(ourport); wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_RXD_MSK); } if (pend & S3C64XX_UINTM_TXD_MSK) { - ret = s3c24xx_serial_tx_irq(id); + ret = s3c24xx_serial_tx_irq(ourport); wr_regl(port, S3C64XX_UINTP, S3C64XX_UINTM_TXD_MSK); } return ret; @@ -963,7 +958,7 @@ static irqreturn_t s3c64xx_serial_handle_irq(int irq, void *id) /* interrupt handler for Apple SoC's.*/ static irqreturn_t apple_serial_handle_irq(int irq, void *id) { - const struct s3c24xx_uart_port *ourport = id; + struct s3c24xx_uart_port *ourport = id; const struct uart_port *port = &ourport->port; u32 pend = rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret = IRQ_NONE; @@ -971,11 +966,11 @@ static irqreturn_t apple_serial_handle_irq(int irq, void *id) if (pend & (APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO)) { wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_RXTHRESH | APPLE_S5L_UTRSTAT_RXTO); - ret = s3c24xx_serial_rx_irq(id); + ret = s3c24xx_serial_rx_irq(ourport); } if (pend & APPLE_S5L_UTRSTAT_TXTHRESH) { wr_regl(port, S3C2410_UTRSTAT, APPLE_S5L_UTRSTAT_TXTHRESH); - ret = s3c24xx_serial_tx_irq(id); + ret = s3c24xx_serial_tx_irq(ourport); } return ret;