All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ye Zhang <ye.zhang@rock-chips.com>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	mika.westerberg@linux.intel.com, tao.huang@rock-chips.com,
	finley.xiao@rock-chips.com, tim.chen@rock-chips.com,
	elaine.zhang@rock-chips.com
Subject: Re: [PATCH v2] gpio: rockchip: resolve overflow issues
Date: Fri, 23 Aug 2024 17:48:03 +0300	[thread overview]
Message-ID: <ZsihI71S8ep7j_Ke@smile.fi.intel.com> (raw)
In-Reply-To: <20240823034314.62305-4-ye.zhang@rock-chips.com>

On Fri, Aug 23, 2024 at 11:43:06AM +0800, Ye Zhang wrote:
> Prevent overflow issues when performing debounce-related calculations.

...

> -		max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
> +		div = (u64)(GENMASK(23, 0) + 1) * 2 * 1000000;

You probably want to use HZ_PER_MHZ from units.h or so?

-- 
With Best Regards,
Andy Shevchenko



WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Ye Zhang <ye.zhang@rock-chips.com>
Cc: linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de,
	linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	mika.westerberg@linux.intel.com, tao.huang@rock-chips.com,
	finley.xiao@rock-chips.com, tim.chen@rock-chips.com,
	elaine.zhang@rock-chips.com
Subject: Re: [PATCH v2] gpio: rockchip: resolve overflow issues
Date: Fri, 23 Aug 2024 17:48:03 +0300	[thread overview]
Message-ID: <ZsihI71S8ep7j_Ke@smile.fi.intel.com> (raw)
In-Reply-To: <20240823034314.62305-4-ye.zhang@rock-chips.com>

On Fri, Aug 23, 2024 at 11:43:06AM +0800, Ye Zhang wrote:
> Prevent overflow issues when performing debounce-related calculations.

...

> -		max_debounce = (GENMASK(23, 0) + 1) * 2 * 1000000 / freq;
> +		div = (u64)(GENMASK(23, 0) + 1) * 2 * 1000000;

You probably want to use HZ_PER_MHZ from units.h or so?

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2024-08-23 14:48 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  3:43 [PATCH v2] gpio: rockchip: Update the GPIO driver Ye Zhang
2024-08-23  3:43 ` Ye Zhang
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: avoid division by zero Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  9:27   ` Heiko Stübner
2024-08-23  9:27     ` Heiko Stübner
2024-08-23 14:45   ` Andy Shevchenko
2024-08-23 14:45     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: release reference to device node Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  9:28   ` Heiko Stübner
2024-08-23  9:28     ` Heiko Stübner
2024-08-23 10:52   ` Shawn Lin
2024-08-23 10:52     ` Shawn Lin
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: resolve overflow issues Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  9:34   ` Heiko Stübner
2024-08-23  9:34     ` Heiko Stübner
2024-08-23 10:59   ` Shawn Lin
2024-08-23 10:59     ` Shawn Lin
2024-08-23 14:49     ` Andy Shevchenko
2024-08-23 14:49       ` Andy Shevchenko
2024-08-23 14:48   ` Andy Shevchenko [this message]
2024-08-23 14:48     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: resolve underflow issue Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23 14:51   ` Andy Shevchenko
2024-08-23 14:51     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: fix debounce calculate Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: Update debounce config function Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: support 'clock-names' from dt nodes Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23 14:56   ` Andy Shevchenko
2024-08-23 14:56     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: support new version gpio Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23 13:32   ` Sebastian Reichel
2024-08-23 13:32     ` Sebastian Reichel
2024-08-23 15:05   ` Andy Shevchenko
2024-08-23 15:05     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: Set input direction when request irq Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23 14:59   ` Andy Shevchenko
2024-08-23 14:59     ` Andy Shevchenko
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: support ACPI Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  5:27   ` Mika Westerberg
2024-08-23  5:27     ` Mika Westerberg
2024-08-23  3:43 ` [PATCH v2] gpio: rockchip: driver works without pinctrl device Ye Zhang
2024-08-23  3:43   ` Ye Zhang
2024-08-23  7:03 ` [PATCH v2] gpio: rockchip: Update the GPIO driver Bartosz Golaszewski
2024-08-23  7:03   ` Bartosz Golaszewski
2024-08-23  7:06 ` Dragan Simic
2024-08-23  7:06   ` Dragan Simic
2024-08-23 15:07   ` Andy Shevchenko
2024-08-23 15:07     ` Andy Shevchenko
2024-08-23  9:33 ` Heiko Stübner
2024-08-23  9:33   ` Heiko Stübner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZsihI71S8ep7j_Ke@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=elaine.zhang@rock-chips.com \
    --cc=finley.xiao@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=tao.huang@rock-chips.com \
    --cc=tim.chen@rock-chips.com \
    --cc=ye.zhang@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.