From patchwork Mon Oct 30 07:35:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vamshi Gajjela X-Patchwork-Id: 159547 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2038475vqb; Mon, 30 Oct 2023 00:36:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF8ynPjsAakjQVPlKOlf2c7WUT+W/WJN/YMeF2i5yo1ggBSqEbm4aaDvz9cReU2g/Leh1/Y X-Received: by 2002:a17:902:cac4:b0:1bb:598a:14e5 with SMTP id y4-20020a170902cac400b001bb598a14e5mr8172348pld.43.1698651389864; Mon, 30 Oct 2023 00:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698651389; cv=none; d=google.com; s=arc-20160816; b=qpScgs0b2wc7OELvfLLKg1WLZDcbJIiVIjKWBc1i4eIqzz7eyXo7PL98SLsEpmbcIt tVhra2cJGFdgaMbnxu8GLMQxIj92sGSKeyJwMVX/374EBPv6tlwgCoAG00gmLnVeY1Nf ZS5eqe5qzxG9EGWCAmSyU0Hw3ekf5k4GPUZV1JTd6IdzCWOEsBB3Fi4zyXT8LOT1PGVe M1vNySUIFPWIf133mJOoYNo8hulhZd96uEd8+9nX9huPHgG4ZclKB0fH/oFzik1Z+75q lFo1MkYgWh7hfqU36H6ZV/w2ZmL+aeGJZS/k9tUca+CajUAjha/Q8+S57vcfiLrHONQT mM1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=+7qdvEqH9UQsG0XvkLdIs7iHiJPjbaVFxlERbYdwdFA=; fh=Ws+G2RLMFRfpE0Jj9T2OymJKcfnhuU2My4BZfo0fXLE=; b=Z01f56MUGCWWE8p8qtjiWKqJkq+IwHCQ0So2Jq8WnCY5YoLCW6X+ZDQixHc2ri9xbP e1dDDGWQkTAn640DXr3d0xc6jSbLdU6Qu+Bz1Uu4qn0w2qPktGTL0rziZon46KuhsBtr 8OEcq+9IFGxeVWygTRcSkxvB4O6SPvO1fFzQLhHAlk2uTPNngnGQWc+wDzfN2E9a8HwL ToQlX2nyhD4tUhV77u8BxWGQb+9TOGWsOOZkx7+9PoNpzhJ0Un/GcGgJrNKIR4oU3An/ YV48haZr9oBVoGVTHaf6wqk85qa3MSP4SpPU3th1MMJrAMOl4ho3xiqkxWWDZCpVM/8V 9r8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yGlGjCtz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id cp10-20020a170902e78a00b001bdafae4b7dsi4587022plb.43.2023.10.30.00.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 00:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yGlGjCtz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id E26E380A4415; Mon, 30 Oct 2023 00:36:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232125AbjJ3HgD (ORCPT + 32 others); Mon, 30 Oct 2023 03:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231752AbjJ3Hf5 (ORCPT ); Mon, 30 Oct 2023 03:35:57 -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 6DDB1BD for ; Mon, 30 Oct 2023 00:35:55 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5afa77f9a33so28138037b3.0 for ; Mon, 30 Oct 2023 00:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698651354; x=1699256154; 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=+7qdvEqH9UQsG0XvkLdIs7iHiJPjbaVFxlERbYdwdFA=; b=yGlGjCtzcTwGQw5JyaI6KGo0AWun2Q8LefN3Yl1A7nL/t1Bcpf20YlYdVF/NntJL7r JgCDQxAI6daFerTQlw1rjltEjj+xiM5kCWHHqlgqshfXtW7lzCu5we95ByeML6rEGdLM qLgguYIuAhBEg/1ANr1a8zcmrB4BGe1h6uRo9BGvPc2lFBrTOGLUT6R6LMVPon4bp3yU 6ZnLKVWXG+xhKZrzoCKKPC46l6WM7RovGNhCfTGe+JzIjDg4JfFi02goqLlBC2SnvoQy zy0oD/QsWX2ReMOtGiejPqRiLHba+o+XsUOK3QCb1Xk3F2q8wsiK7ya/cj5ZbxR9X1Ze cKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698651354; x=1699256154; 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=+7qdvEqH9UQsG0XvkLdIs7iHiJPjbaVFxlERbYdwdFA=; b=qIGz8TGeeOBpZh0oWtXSgUnIaEJcRcmmSvwB3mZn7tGz85seHDRalVanQni2EoJ+MK bDdJjgr97sU/JAX9vEUo4LjIgQ3TFdhErNQXkXvjT4SK/hJO7wEXNdIqDvl1lptaeniD EyvMBMEP89OVrVKaqOvLoENTmWP/JG9U4XmP2ify99x5O8SwyVJ/r8uIY8B0AwwY4iqI sYTjgSSdW+EzhPwlLWcqv9q+MF1Iu7dlq+Z4dLZm/6YCHGbjSmvqUy4DI3Yk7A2hXjGA 1JZ8FfzoUZv4PxEonj3cJfAMr12ekP72jYNLp1wsO5CVs1nRA1t7CsMC7sVg55hTS4N0 v4jw== X-Gm-Message-State: AOJu0YxeMkB86smQfLPoPVtefs8xQnQvV0b02mEegppCvCUYX3/PhfOY cYcBhO8cCO81vqhSrSgRVpvTNz11WvRdaStXNvb3 X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a81:6cc5:0:b0:5a7:ad67:b4b6 with SMTP id h188-20020a816cc5000000b005a7ad67b4b6mr174772ywc.2.1698651354698; Mon, 30 Oct 2023 00:35:54 -0700 (PDT) Date: Mon, 30 Oct 2023 13:05:41 +0530 In-Reply-To: <20231030073542.251281-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231030073542.251281-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231030073542.251281-2-vamshigajjela@google.com> Subject: [PATCH v5 1/2] serial: core: Update uart_poll_timeout() function to return unsigned long 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 X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 30 Oct 2023 00:36:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781165079437693474 X-GMAIL-MSGID: 1781165079437693474 The function uart_fifo_timeout() returns an unsigned long value, which is the number of jiffies. Therefore, change the variable timeout in the function uart_poll_timeout() from int to unsigned long. Change the return type of the function uart_poll_timeout() from int to unsigned long to be consistent with the type of timeout values. Signed-off-by: Vamshi Gajjela Reviewed-by: Ilpo Järvinen --- v5: - no change. Consistent version for series v4: - author name in capitals to lowercase v3: - updated description v2: - unsigned long instead of unsigned int - added () after function name in short log - updated description 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 bb6f073bc159..6916a1d7e477 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 long uart_poll_timeout(struct uart_port *port) { - int timeout = uart_fifo_timeout(port); + unsigned long timeout = uart_fifo_timeout(port); return timeout > 6 ? (timeout / 2 - 2) : 1; } From patchwork Mon Oct 30 07:35: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: 159548 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp2038527vqb; Mon, 30 Oct 2023 00:36:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKuqnpDLEYtRZDqCDZalMQCVXxOYwYYjWPkQMjoPMymBWXa/Av+sF+9JccC+VbDltn18Sy X-Received: by 2002:aca:1b07:0:b0:3b2:f4ff:d3c4 with SMTP id b7-20020aca1b07000000b003b2f4ffd3c4mr9089549oib.2.1698651395977; Mon, 30 Oct 2023 00:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698651395; cv=none; d=google.com; s=arc-20160816; b=PCdUG/DECanApK9y4yX2w/3s/b4kqxQ3KsHmqR0BmcRNKMJpxMYIn8dja6C1LLrm0r iDIqVl72wR6IgZA9RPOIuficz8nCnNwi5L2MpiGA+R7Elr2t6nCK/f3QtEFqLVFQIfk+ QMgjEen2TAHIZLAfT2fsWjvZil/GXmFbp6Ogn7RgtAfq0G/BCNEB4lX37TDuo0ogjPt3 InF1nsK4iOSV2IACAb+b665xdghw1GWNnk8/lAV8yX5K9Ud1OLXaiX5BU/TBgT7QgQzU CBZ8vbG16boGV0c3XpwFVWLZmx7aRpi6u79xofjNWY+z0xRNXuSnEezD6WFxS7ByMbcx s2gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=MJYRMGz5Km6YdZ6S41UQtlr9nImkATltc1KA9WGy+hA=; fh=Ws+G2RLMFRfpE0Jj9T2OymJKcfnhuU2My4BZfo0fXLE=; b=eu01ajI81ZOlao338oz56cZkzAe63cvJiixjwefkVT8g2+wld+FFjJsyotgtFpmq/K OT2o5Fl1idQzrAa1ijqY2Bl4mK8RTsi2vDRYqlgOVXVOaAB4UJCX66pJi0sgD/o1U/7t OwNj3WOMfxmQ+aRXsvSjS6ErCibjMkeLAcwPHivA2S/l/dKCDHC9BN80g69jZWDAbpV0 6r+FLO5JjDs3n3nlCBVFXdleI43W+FilfLy2Bs2/1Wsj+hdQbYWZMNE3QPP4Ja/t/9Bm IkROwm03h7wMzmovGU9pmHAmZtGo9k9hX5M0yoHo/Kn+GkLE9UyEqlxwEKqFAo8p286M F7lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yI67vC9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j1-20020a056a00130100b006bf1f9bb921si4668773pfu.120.2023.10.30.00.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 00:36:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yI67vC9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id D485380972BD; Mon, 30 Oct 2023 00:36:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232165AbjJ3HgM (ORCPT + 32 others); Mon, 30 Oct 2023 03:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjJ3HgE (ORCPT ); Mon, 30 Oct 2023 03:36:04 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06694E6 for ; Mon, 30 Oct 2023 00:36:01 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5a7ed6903a6so42309287b3.2 for ; Mon, 30 Oct 2023 00:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698651360; x=1699256160; 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=MJYRMGz5Km6YdZ6S41UQtlr9nImkATltc1KA9WGy+hA=; b=yI67vC9fqrQEeXKZsIIS1FL+y29Hx2GYVD96oofZiRfIwyPbry7HG7w5KQqvm8TtYG d2dYUpJfgL7nZvgsJ6Yvl1n1BfHIfd4NLC7l4tJG/E0n3XyBy1OHSXbqSkqejesnBgpS 61OvFzVx+v9TH63rL/bOtCZ8ujOeDhVbnm1acE0YidnFr+AHx6SQUsHPv49k8j5Ky3a9 PHGc+Iytv8PXBACnIPRGj/jc0x6jqXFQRTw0SfMz7GXFjAcPtc1NyPogYpRz3F/zEa3O 7U70Pkr8/jjEBz3LeNu46vA7C7wt2ZJ9P39lWq7B6seQz+pITVm9jta4cmNPU0AGqs7d AGkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698651360; x=1699256160; 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=MJYRMGz5Km6YdZ6S41UQtlr9nImkATltc1KA9WGy+hA=; b=iCdsLNxzp9OOvkk0cTjkzTCaRLmv9T0tulCB/mXVf5y1f5lJat+u7sSDJLohBpVqc3 HOW5RWdf0Vx+4BLQndutlW3VgToG/ucxSUyynjPjJdwgOn6m2muuKcSbKB9sqNFZCQpo nc9SLSg7R75VMdzzK/3F59vENfQHtZ2kzWY3SLjGzUpFLRSMdbLv9JOLOKDGsJlzhukM yYUdcIaqQYvL5DrPvB9XCUp9h9jz3nXuNTEv7fugtrZ4BVw82cLG8ncODWM/T3/YrvCH E1RoK8GDzSCBksA8Do0prBbTZZi0CAVZAT/BQKXrNJ+4PZ5QyCEtka9DoTJyx7vEs7GB QF1w== X-Gm-Message-State: AOJu0YxvPuBUd8L5DiE9OHayYw7S7LvKawIBMqcudn/vXdpDA40CCBN3 3h/YK1aMs9TD5/8K8GU8uewLnFNUuhLrm1/Kr8vd X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a05:690c:2a45:b0:5af:a9ab:e131 with SMTP id ej5-20020a05690c2a4500b005afa9abe131mr155448ywb.1.1698651360172; Mon, 30 Oct 2023 00:36:00 -0700 (PDT) Date: Mon, 30 Oct 2023 13:05:42 +0530 In-Reply-To: <20231030073542.251281-1-vamshigajjela@google.com> Mime-Version: 1.0 References: <20231030073542.251281-1-vamshigajjela@google.com> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog Message-ID: <20231030073542.251281-3-vamshigajjela@google.com> Subject: [PATCH v5 2/2] serial: core: Clean up uart_update_timeout() function 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 X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 30 Oct 2023 00:36:33 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781165086071992383 X-GMAIL-MSGID: 1781165086071992383 Rename the variable size to temp and change its data type from unsigned int to u64 to avoid type casting in multiplication. Remove the intermediate variable frame_time and use temp instead to accommodate the nanoseconds. port->frame_time is an unsigned int, therefore an explicit cast is used to improve readability. Signed-off-by: Vamshi Gajjela --- v5: - shortlog changed from "serial: core: Make local variable size to u64" to "Clean up uart_update_timeout() function" - renamed local variable size to temp, generic name - removed intermediate variable frame_time - added typecast "unsigned int" while assigning to port->frame_time v4: - no change, not submitted with series v3: - no change, not submitted with series v2: - no change, not submitted with series drivers/tty/serial/serial_core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 7bdc21d5e13b..21d345a9812a 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -410,11 +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 frame_time; + u64 temp = tty_get_frame_size(cflag); - frame_time = (u64)size * NSEC_PER_SEC; - port->frame_time = DIV64_U64_ROUND_UP(frame_time, baud); + temp *= NSEC_PER_SEC; + port->frame_time = (unsigned int)DIV64_U64_ROUND_UP(temp, baud); } EXPORT_SYMBOL(uart_update_timeout);