From patchwork Sat Oct 14 10:49:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 733840 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB45BCDB465 for ; Sat, 14 Oct 2023 10:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233151AbjJNKuP (ORCPT ); Sat, 14 Oct 2023 06:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233189AbjJNKuM (ORCPT ); Sat, 14 Oct 2023 06:50:12 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8162AB3 for ; Sat, 14 Oct 2023 03:50:10 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5a836d49eeaso15407757b3.0 for ; Sat, 14 Oct 2023 03:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697280609; x=1697885409; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=I0MUXgCgPp7gRv8+WcNEgYQP5+7MSeABFPYxMKK1EzU=; b=FL36PbjdncuCHtvIiTjirmj8Y1uHygRUSEiSeK5NjGaW8kAni8c6BvB7VTxYgtO3GY mzzL1GlB7/TlqO/jV99WqnBvAt8nm1wBKYUwLZz1CiBCeD/oT8HQWTgtWKW0wzTNaqvM MKEh7aczALaYKVEMwOMq4hIrfdhPorxcAyvMV61i5+CCOIO86PbJG7EfkpWplE4GWkle 3OHU1MyjtgDDdxc5GH6Uc7vOcMd7xT+w8Rm9gB733C0nYG1qf4YLn9jd9Eut/37YdaDG Lp7rlqLFOgoQ2pCRBuJMDkkNl+Fq8u1V0c9MLt3/+gP7odqA/QMl4AOSsUXYnHb9jmrK 5u6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697280609; x=1697885409; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=I0MUXgCgPp7gRv8+WcNEgYQP5+7MSeABFPYxMKK1EzU=; b=c1vEp8iSJ5R5KY6aJGOSwNnlg/DZtkwguOTxMC17OURC+F/XIqNGws8XMpJcQR/WY5 DSBCXimehiKKQv7PxDWtcAJn/ZVlI6UwVGQCuLQLsy84wZyIPZmVmzTNW8ioaA90stDu pHN/NYp51xhIsU5alGoHuxtm1N5msNTg2TUJTw/4arSLvi9z1D3dUHzW/xL4wANgU09H Mf5xiJGF507oUb4/e98IxoC7hdsu1+RBG0rrAUNTtkhFPq/I6wxBrnym/Ib99NYpcTQf GegTKGvDcT+WvanWq0Ad7YeiHHMhnuRkXkanFDLZev2jlEDce7MQOJkzE448f6586oPi tzKg== X-Gm-Message-State: AOJu0Yz9B/+xwfv6x2jJaCBgMSBgnzWpRBfbNLPDPUa+2W5COMx8FvQm Gq28uxHF4mhqkNZzNhdtv8BA4jQdFGW14qE8D0YA X-Google-Smtp-Source: AGHT+IECLjqnFxKwrfPtqN+hEWvDFTlsXiuek3R1asZ71+QVKuJMwQOlvflW0rK1xzYnt9ijnM15rGIZTBn4lcBdA8Wq X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a05:690c:4086:b0:5a4:f657:36d9 with SMTP id gb6-20020a05690c408600b005a4f65736d9mr522763ywb.9.1697280609769; Sat, 14 Oct 2023 03:50:09 -0700 (PDT) Date: Sat, 14 Oct 2023 16:19:41 +0530 In-Reply-To: <20231014104942.856152-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231014104942.856152-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231014104942.856152-3-vamshigajjela@google.com> Subject: [PATCH 2/3] serial: core: Make local variable size to u64 From: Vamshi Gajjela To: Greg Kroah-Hartman , Jiri Slaby , ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani , Channa Kadabi , VAMSHI GAJJELA Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: VAMSHI GAJJELA The variable size has been changed from u32 to u64 to accommodate a larger range of values without the need for explicit typecasting. Signed-off-by: VAMSHI GAJJELA --- drivers/tty/serial/serial_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7bdc21d5e13b..fb4696d17a8b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -410,10 +410,10 @@ void uart_update_timeout(struct uart_port *port, unsigned int cflag, unsigned int baud) { - unsigned int size = tty_get_frame_size(cflag); + u64 size = tty_get_frame_size(cflag); u64 frame_time; - frame_time = (u64)size * NSEC_PER_SEC; + frame_time = size * NSEC_PER_SEC; port->frame_time = DIV64_U64_ROUND_UP(frame_time, baud); } EXPORT_SYMBOL(uart_update_timeout); From patchwork Sat Oct 14 10:49:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 733994 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAA7ACDB465 for ; Sat, 14 Oct 2023 10:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233183AbjJNKuW (ORCPT ); Sat, 14 Oct 2023 06:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232977AbjJNKuR (ORCPT ); Sat, 14 Oct 2023 06:50:17 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5616DE for ; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d9a39444700so3462928276.0 for ; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697280615; x=1697885415; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=ZYCXn3ElgcmgyYLbM76CHob0tkZSwXwvOlTaEhXB7SM=; b=etTkr53JSOwwe+9PYrUPt0fKjQzkeRwQurPJYvFu50+iJS82nIAp2OZH0BGPIDKSte wzXIM+FLJpCsDRsWttk2BJWWujVK9/25j6b156OUkm048163j6yefEzyTrg+qveQQYqC 3Qg07eYL9toqsF4l6ffl3K25Mz18P4/JFfUWjSnYCIzmHmLINxv2WZ8o9kgb76HyQLDt p2sMbBJWwGReTttyu+gJPJc5DmMCGzClQWa+oimYx2iFZ1taBk2haJvLSKb5zS4qQKQO X1o6zQ93FKkn8PEDfJDF+d0DzMp4Y9SD0YAS3aCq9erFGKfAnMhDXYBPKmjat7aCtStn sxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697280615; x=1697885415; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZYCXn3ElgcmgyYLbM76CHob0tkZSwXwvOlTaEhXB7SM=; b=UMwS6N7N52YC85iBVjkz4KXUjuKt6ryoB1PrQKuiTR8g/O5Ij38Fbk9+0mw42/rF41 HtGGvHajyZnSPYCIgzUjAcXeaCKOZGCs2H/ECls72fCCrkB6Z9aKphazaJXWGdeumdAF yi5lCH/znvU/6lO586NfR3tJ9M1ZQplvVfi73OsfDUWthdorNBizOTEm9AyCy9ZEW7Ay ljFy5plO43SdB0NH/4h6LOgasXUMuv1wjF5DSJvp/1tUDKlrKwMrlLNeyGWalCpblxD7 kE3AS0gozxhM1n1DXvTUB3BzfPW6PFAD/uhmofF8qp42UbIBVeQ4xmFjXADhvAgHk1nI 7rMw== X-Gm-Message-State: AOJu0YyoL+BXJUNSw76dg9Lzu0Ks5MEtK2p9n5yny+tGKA558xAvYXX2 ufWcZLxmfPGH9Qp/H6GGQHI1Cm9zEM67oAs6qto9 X-Google-Smtp-Source: AGHT+IFVE7RAEJUGf8YGFcAVvRgkulAAOaL0R9FyNAXbNStbKMo++OMbut/K3NfJyNBOOqWXBW0gNNZv5PLmsODNykx3 X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a25:aa83:0:b0:d8a:fcdb:d670 with SMTP id t3-20020a25aa83000000b00d8afcdbd670mr78496ybi.1.1697280615084; Sat, 14 Oct 2023 03:50:15 -0700 (PDT) Date: Sat, 14 Oct 2023 16:19:42 +0530 In-Reply-To: <20231014104942.856152-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231014104942.856152-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog Message-ID: <20231014104942.856152-4-vamshigajjela@google.com> Subject: [PATCH 3/3] serial: core: Update uart_poll_timeout function to return unsigned int From: Vamshi Gajjela To: Greg Kroah-Hartman , Jiri Slaby , ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani , Channa Kadabi , VAMSHI GAJJELA Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: VAMSHI GAJJELA uart_fifo_timeout() returns unsigned value, hence the function uart_poll_timeout has been modified to use an unsigned int type for timeout values instead of a signed int. The return type of the function has been changed from int to unsigned int for consistency with the type of timeout values. The result of uart_fifo_timeout() is cast to u32, indicating that the value is truncated. Signed-off-by: VAMSHI GAJJELA --- include/linux/serial_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index b128513b009a..445a1ff7e502 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port) } /* Base timer interval for polling */ -static inline int uart_poll_timeout(struct uart_port *port) +static inline unsigned int uart_poll_timeout(struct uart_port *port) { - int timeout = uart_fifo_timeout(port); + unsigned int timeout = (u32)uart_fifo_timeout(port); return timeout > 6 ? (timeout / 2 - 2) : 1; }