From patchwork Wed Aug 7 11:58:19 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: 13756182 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 7B583C3DA7F for ; Wed, 7 Aug 2024 12:00:19 +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=ob/dMG7ffpu5CnJb/3jC4P+DU5cPyh8uWCPmQu8UZIQ=; b=C5wmmo6bHZpqnVGSy7ZvTL+EZl rOq9klZjB8F8Uzbi8Mov4LgTkMeC2BbOtxqx4H997Ry1XyjMwKj80bUB4Xeom9U5MgN5uAve64jRj yFWDTDKYdTV+f95q1dLNsnkpvu3siuHbi5U3RKkAaY7343ba/pR2kKQXyQB9a9iCEvOPo7Yusltuo R7cUX7l7IpH71XRplJK1eUJLLuoJ5YSy8+JP/rtWLV2HIBsynsYft3CGGbhQf3tBDYTo4/2JlsAB1 OhygZlJCOvmLK21KYqOmfaw08ZVJdXVwTJTcKHCsrlkz/SetxPH51tGwCxHa8EdqT7zBKcHpWaCUp q62x+h9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbfKk-00000004w7A-3D0L; Wed, 07 Aug 2024 12:00:02 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbfJ7-00000004vnB-1X71 for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2024 11:58:23 +0000 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52f025bc147so2302890e87.3 for ; Wed, 07 Aug 2024 04:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723031900; x=1723636700; 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=ob/dMG7ffpu5CnJb/3jC4P+DU5cPyh8uWCPmQu8UZIQ=; b=XVxPwydGNOGUqmoEDGe3gBDeqdZ0raRBhWc+7CIiC0iCrZhmZRJyYTbokwip/LZCMV RHYkVCahABB0HmeZ6FV/02koKE85T2wQDLSx5snPZRBmW634uJEdF2ACivQvDwV+g5eR KmaoJKyzoGd2tGwC4NouQa6q9VUNiYMgQBR9aPekPVBfFBYskcfQzc+JsP9M8hU59iY2 Jzq/BGfP5bGfwkFxwlX/ssS0maoOPMyvll6XxEcnpF6qz5XKBEx6Y9DKIPURT6YtvtcN xAlzzvhhpzyYS0MCobrYq0YCAZUhmrJGegYPonv9uYIKxzTemC4YLGDAflTvY0sHSurj Pmkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723031900; x=1723636700; 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=ob/dMG7ffpu5CnJb/3jC4P+DU5cPyh8uWCPmQu8UZIQ=; b=CdYxN3LqQIDLM6XlBI+cXEtG8HNr8irz5XqV8cETqyRE1lHMwbIQS8ue6cdYHj+FtI rK4JhFvzAYniZOMv/4uEMerrbkmR0decTXeaRP7+5kXDLi3DruWvQbA1Re7FYg5ITSH3 oksTUh0+Gd8shxCE5o6BDzl+TMidwXkbdqlXEAq1qJ1WBzvrrZyYjAmxzomoHXlZWVRN jf1j4Acq7dZrqH7E7m/ye+7pATz3G80yuU9VeEduLFTth8KXcAa11ACZVNfrRH2TIZpY LCpm5XvmxB6KXoQ1l7gz7xk7x/lr6GxsHsr0Ugy0A8TJbWHPLmLpfhA12Mmwa0624oKF YypQ== X-Forwarded-Encrypted: i=1; AJvYcCVV13q8Gt0oZRc/cHFKiPPgAOyqqNoi12fSBguKHIKjurJolpQ4EsXshZ+brhZY65/K/cnu3+j865JBD3X2L5kIJFW74pQEXEQx8qqGl6V5/+7oWFk= X-Gm-Message-State: AOJu0Yx/7s8XtDPL7/n8BJgWWu3P6dwMBZZlDqw1rBIhuku1ma3erUy4 +jW0+V6bMusVQq35imezhXRVPmSG6Ac5RjAGxZ4Vmex49XwI/j2Zu7lQvr10sfGVoHfFTU0tst1 b0Qrt2w== X-Google-Smtp-Source: AGHT+IGDZqmOeN0Q0y0tQSs0UlBctnHvqqnA7n65bihl/RZDrjmhHLw+CXjoDWECICYBe/4UovaLeQ== X-Received: by 2002:a05:6512:b8d:b0:52c:d80e:55a5 with SMTP id 2adb3069b0e04-530bb395e1cmr11925471e87.41.1723031899218; Wed, 07 Aug 2024 04:58:19 -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-a7dc9d45239sm631017466b.119.2024.08.07.04.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 04:58:18 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Wed, 07 Aug 2024 12:58:19 +0100 Subject: [PATCH v2 2/2] tty: serial: samsung_tty: cast the interrupt's void *id just once MIME-Version: 1.0 Message-Id: <20240807-samsung-tty-cleanup-v2-2-1db5afc9d41b@linaro.org> References: <20240807-samsung-tty-cleanup-v2-0-1db5afc9d41b@linaro.org> In-Reply-To: <20240807-samsung-tty-cleanup-v2-0-1db5afc9d41b@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-20240807_045821_427087_BF3277D0 X-CRM114-Status: GOOD ( 13.42 ) 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 --- v2: fix -Wdiscarded-qualifiers, sorry --- drivers/tty/serial/samsung_tty.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c index 1c6d0ffe5649..951e16c87471 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; - const struct uart_port *port = &ourport->port; + struct s3c24xx_uart_port *ourport = id; + 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,19 +958,19 @@ 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; - const struct uart_port *port = &ourport->port; + struct s3c24xx_uart_port *ourport = id; + struct uart_port *port = &ourport->port; u32 pend = rd_regl(port, S3C2410_UTRSTAT); irqreturn_t ret = IRQ_NONE; 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;