Message ID | 20231025142609.2869769-1-vamshigajjela@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2641025vqx; Wed, 25 Oct 2023 07:27:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGmTTnw0UrSqjvrt6tCcaP3R08E8cMBhx6lY6masnXy29eMV8MMQQ06Yo/24q4WpNt6xz2y X-Received: by 2002:a81:91d5:0:b0:5a7:bc79:9618 with SMTP id i204-20020a8191d5000000b005a7bc799618mr16382268ywg.12.1698244034398; Wed, 25 Oct 2023 07:27:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698244034; cv=none; d=google.com; s=arc-20160816; b=dj0yKcTojvBUxXfxTOvO8ZhdX3ELXJBPiW9SKQYa5vVsHhgBqHY93RIJzeG1y2iK86 C8X1EhhoUrwD4bH0a27q+IL958QLfJItpUqv9IxR/lqUqEzot/ibyNny7CX+anKh+BMh nUQKrjsP5cDZaldp3tTKYLHvmArb7dUtyVxdRnRxM5aFOQpZAyU9xQjHkL01cy+rbghW 8yE0uZT8mISzwvbdnIh0E9BFLW6+Kom4jE3ggxnyNQC6jOciXDUdXuFlErhK4rVVHQtS lSNTnBqQ8utVBTFn7mEyae3qQZBKjN3/PNOXHiBehIGD0wmSXWjERGtg2zyDZjLseERe aFzA== 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:mime-version:date :dkim-signature; bh=6GAV3+HGX/GSuMk9leWi7r46JVl0NQ2JAhtg14sSj10=; fh=4iPUH3SCaUeHRPwZInlqPLZI8cmh/b74OgcORLvvuVM=; b=p6sw8BhbPfXSz7hZGbjN0cc7HoxHpKYz32eQTb2OGn1VHCMOmshJU+pIOdYlLFzYiZ NBCDkvPwmfAfeQlybahUg+xnfbNy9sabVcqvbq2ynoADEySUxJscHLthEQsj8IpM1+WB VtnTfjr3U3sAaMgTJx6dpTz312U9QpNsEAgwmM8d57LE+b5GLF6fvCyo4LlxwMK9eAv6 i9F1TZrJIkKt5cOXQ1vkC2oEzcQhOpgTQ8myH3l8n/O9Y1WGIWz00HI976q3M8v752z9 wmO9OySALFuvGI34CjSxmNHP+SvIn2k8LUC6CHPd8p0q5NHVwYf1kygROvcZWscI1BzB mErA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uC+OcpNu; 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 g201-20020a0dddd2000000b005a7b95a19a6si11790680ywe.20.2023.10.25.07.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:27:14 -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=uC+OcpNu; 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 9F56F8116E73; Wed, 25 Oct 2023 07:27:11 -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 S1344917AbjJYO0n (ORCPT <rfc822;aposhian.dev@gmail.com> + 26 others); Wed, 25 Oct 2023 10:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345103AbjJYO02 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 25 Oct 2023 10:26:28 -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 0629810E3 for <linux-kernel@vger.kernel.org>; Wed, 25 Oct 2023 07:26:18 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d9ab7badadeso6090564276.1 for <linux-kernel@vger.kernel.org>; Wed, 25 Oct 2023 07:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698243978; x=1698848778; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=6GAV3+HGX/GSuMk9leWi7r46JVl0NQ2JAhtg14sSj10=; b=uC+OcpNuVUcrcaigHU4roLYmXYrONduaPE/A7YesAErqV8JX5eb0ddpAcKj9dsjS1n GINsk4UipHmNxmY+sMyLDSaH9HyejG0y9twMSOEjYMvaiit3XahrrhNEYSpZ8QKB57w3 0OK7seifXAJs0qZER7QoKNHxNcQnHDehniyiQQRHBw5ZdCa0j2vSQvBFwMuWmmhVcOLl G7pmjPB74kd1e/OEyPC0TI1trHSM86Wpy6WOMa2ePGQ50++rdieGSk+mu6YXPcY7hwmU RjC5urbynxAi3AabwmmQz7CLCxmMtZXRilvVAF3iPpcVx/Q9fPinWbfKhK3EnpnGi2cW 6xAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698243978; x=1698848778; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=6GAV3+HGX/GSuMk9leWi7r46JVl0NQ2JAhtg14sSj10=; b=u+Uf5YnXSqp7E/Soixe92vXheAkRxeQ76Ddo00H3tbmxMKsY96CHadSBaJQElQoExT IPmmaIo4okAO5TbxFVncJwcRBpE6iPVLABcZl5duanPimEJgaqS6vG0C9K7CY+dfZGbY 72IIo8IOrynB4YyBU9XxsAha7TCEwvmpjKmDfRRiMfU2vMpmN7JRRNdZqw1LCO/7mDTy mi2hWwPLssvQcPUcwIRYqgycickpP6S13UQ7e6JeVPj0lR8b6l/uKsqFHA+5nVUo3ps9 bimaPNZ2CVjzCepS/64s+uEXQE7dDEhRCRSnbTah9E0+5ro+6MS0QL46N54psSzkkYpZ 0LDw== X-Gm-Message-State: AOJu0YzS00nIjaPXGFH+o/E4NxwOO5kK86flTwZMwZnULRvBb/smvIVC POg21/aCqppAvxUrNiFi75b+jtl6EaWGTEqkDTWv X-Received: from vamshig51.c.googlers.com ([fda3:e722:ac3:cc00:3:22c1:c0a8:70c]) (user=vamshigajjela job=sendgmr) by 2002:a25:211:0:b0:d9a:c3a2:48a3 with SMTP id 17-20020a250211000000b00d9ac3a248a3mr285649ybc.6.1698243978033; Wed, 25 Oct 2023 07:26:18 -0700 (PDT) Date: Wed, 25 Oct 2023 19:56:09 +0530 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Message-ID: <20231025142609.2869769-1-vamshigajjela@google.com> Subject: [PATCH v2 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long From: Vamshi Gajjela <vamshigajjela@google.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Jiri Slaby <jirislaby@kernel.org>, ilpo.jarvinen@linux.intel.com Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, manugautam@google.com, Subhash Jadavani <sjadavani@google.com>, Channa Kadabi <kadabi@google.com>, VAMSHI GAJJELA <vamshigajjela@google.com> 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: <linux-kernel.vger.kernel.org> 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]); Wed, 25 Oct 2023 07:27:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780737936598364815 X-GMAIL-MSGID: 1780737936598364815 |
Series |
None
|
|
Commit Message
Vamshi Gajjela
Oct. 25, 2023, 2:26 p.m. UTC
From: VAMSHI GAJJELA <vamshigajjela@google.com> The function uart_fifo_timeout() returns an unsigned long value, which is the number of jiffies. Therefore, the function uart_poll_timeout() has been modified to use an unsigned long type for timeout values instead of an int and to avoid truncation. The return type of the function uart_poll_timeout() has also been changed from int to unsigned long to be consistent with the type of timeout values. Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com> --- 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(-)
Comments
On 25. 10. 23, 16:26, Vamshi Gajjela wrote: > From: VAMSHI GAJJELA <vamshigajjela@google.com> > > The function uart_fifo_timeout() returns an unsigned long value, which is > the number of jiffies. Therefore, the function uart_poll_timeout() has been > modified to use an unsigned long type for timeout values instead of an int > and to avoid truncation. Hi, there is no truncation possible, right? > The return type of the function uart_poll_timeout() has also been changed > from int to unsigned long to be consistent with the type of timeout values. > > Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com> > --- > 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; > }
On Thu, 26 Oct 2023, Jiri Slaby wrote: > On 25. 10. 23, 16:26, Vamshi Gajjela wrote: > > From: VAMSHI GAJJELA <vamshigajjela@google.com> > > > > The function uart_fifo_timeout() returns an unsigned long value, which is > > the number of jiffies. Therefore, the function uart_poll_timeout() has been > > modified to use an unsigned long type for timeout values instead of an int > > and to avoid truncation. > > Hi, > > there is no truncation possible, right? That's very likely true (I didn't run the calculations), thus it's correct to not have Fixes tag. It's more about having consistent typing since we're talking about jiffies, so unsigned long as usual. > > The return type of the function uart_poll_timeout() has also been changed > > from int to unsigned long to be consistent with the type of timeout values. Don't write changes you make in the patch in the past tense. Just say: Change the return type of uart_poll_timeout() from ... The comment also applies to the other sentence above this one.
On 26. 10. 23, 11:24, Ilpo Järvinen wrote: > On Thu, 26 Oct 2023, Jiri Slaby wrote: > >> On 25. 10. 23, 16:26, Vamshi Gajjela wrote: >>> From: VAMSHI GAJJELA <vamshigajjela@google.com> >>> >>> The function uart_fifo_timeout() returns an unsigned long value, which is >>> the number of jiffies. Therefore, the function uart_poll_timeout() has been >>> modified to use an unsigned long type for timeout values instead of an int >>> and to avoid truncation. >> >> Hi, >> >> there is no truncation possible, right? > > That's very likely true (I didn't run the calculations), thus it's correct > to not have Fixes tag. Good. I would remove that "and to avoid truncation" completely from the commit log. I would only say that we are getting things consistent. "avoid truncation" can lead to -> we should backport it to stable. And neither is true. > It's more about having consistent typing since > we're talking about jiffies, so unsigned long as usual. Yeah and that's of course fine by me. thanks,
On Thu, Oct 26, 2023 at 2:54 PM Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote: > > On Thu, 26 Oct 2023, Jiri Slaby wrote: > > > On 25. 10. 23, 16:26, Vamshi Gajjela wrote: > > > From: VAMSHI GAJJELA <vamshigajjela@google.com> > > > > > > The function uart_fifo_timeout() returns an unsigned long value, which is > > > the number of jiffies. Therefore, the function uart_poll_timeout() has been > > > modified to use an unsigned long type for timeout values instead of an int > > > and to avoid truncation. > > > > Hi, > > > > there is no truncation possible, right? > > That's very likely true (I didn't run the calculations), thus it's correct > to not have Fixes tag. It's more about having consistent typing since > we're talking about jiffies, so unsigned long as usual. > > > > The return type of the function uart_poll_timeout() has also been changed > > > from int to unsigned long to be consistent with the type of timeout values. > > Don't write changes you make in the patch in the past tense. Just say: > > Change the return type of uart_poll_timeout() from ... > > The comment also applies to the other sentence above this one. Sure, will update commit message. > > -- > i. > > > > Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com> > > > --- > > > 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; > > > } > > > >
On Thu, Oct 26, 2023 at 3:19 PM Jiri Slaby <jirislaby@kernel.org> wrote: > > On 26. 10. 23, 11:24, Ilpo Järvinen wrote: > > On Thu, 26 Oct 2023, Jiri Slaby wrote: > > > >> On 25. 10. 23, 16:26, Vamshi Gajjela wrote: > >>> From: VAMSHI GAJJELA <vamshigajjela@google.com> > >>> > >>> The function uart_fifo_timeout() returns an unsigned long value, which is > >>> the number of jiffies. Therefore, the function uart_poll_timeout() has been > >>> modified to use an unsigned long type for timeout values instead of an int > >>> and to avoid truncation. > >> > >> Hi, > >> > >> there is no truncation possible, right? > > > > That's very likely true (I didn't run the calculations), thus it's correct > > to not have Fixes tag. > > Good. I would remove that "and to avoid truncation" completely from the > commit log. I would only say that we are getting things consistent. > > "avoid truncation" can lead to -> we should backport it to stable. And > neither is true. I will drop "and to avoid truncation". > > > It's more about having consistent typing since > > we're talking about jiffies, so unsigned long as usual. > > Yeah and that's of course fine by me. > > thanks, > -- > js > suse labs >
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; }