Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2568281rdh; Mon, 30 Oct 2023 00:36:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSD0787fKMG+8m0IeXvnBMemceowVTWbUIgFzLjUy7kWu5pqPLMA5IkLeCcdfnLflL0d7y X-Received: by 2002:a05:6358:5928:b0:168:e917:e075 with SMTP id g40-20020a056358592800b00168e917e075mr9014038rwf.1.1698651386672; Mon, 30 Oct 2023 00:36:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698651386; cv=none; d=google.com; s=arc-20160816; b=HO/bmJnM61Ly0Mhs8Aqotr7zhSmkjQ0OqDiiYPgRsCLBwMAMW4pVFejyYN4CjMPVOK 2IaJPQ2Gm4fR2Zl5R3n8n0XMbI8z+Haj9G2XwBuF1/CO/77vgvSXN8GgvTNmXyUgYmGt WF2o0wqIJOCdopu9omqJ7p4XbphfSj+GRujY4gQ+6BE2uEFFKyfOe0QTe4MHP5Ul+1Bf gvz55+vwyKVWYiPIBlaoYZmmMt25FNBy8JS3k50JTMKXuGsfsXd3ecmRdXqkNoR3PZ43 xe3XpNrn27+PSMPnsahsxcH/1RdF4swkUATwKM3u4TZTdy6adKvt7Nwe2+zBN30h2bTi yT1g== 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 Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j184-20020a638bc1000000b00584e65212d4si4629553pge.609.2023.10.30.00.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 00:36:26 -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 02BEE80972B0; Mon, 30 Oct 2023 00:36:24 -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 S232164AbjJ3HgL (ORCPT + 99 others); Mon, 30 Oct 2023 03:36:11 -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 Content-Type: text/plain; charset="UTF-8" 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:24 -0700 (PDT) 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); -- 2.42.0.820.g83a721a137-goog