From 56c8583c46837636f3ab9b180ef177871c2909ab Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 29 Dec 2022 07:46:43 -0500 Subject: [PATCH] Fixes for 6.0 Signed-off-by: Sasha Levin --- queue-6.0/pwm-tegra-fix-32-bit-build.patch | 47 ++++++++++++++++++++++ queue-6.0/series | 1 + 2 files changed, 48 insertions(+) create mode 100644 queue-6.0/pwm-tegra-fix-32-bit-build.patch diff --git a/queue-6.0/pwm-tegra-fix-32-bit-build.patch b/queue-6.0/pwm-tegra-fix-32-bit-build.patch new file mode 100644 index 00000000000..6c4fa9cb952 --- /dev/null +++ b/queue-6.0/pwm-tegra-fix-32-bit-build.patch @@ -0,0 +1,47 @@ +From 12cdebc1f14b11f2860640403d63351d785e027f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Nov 2022 11:45:48 +0000 +Subject: pwm: tegra: Fix 32 bit build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Steven Price + +[ Upstream commit dd1f1da4ada5d8ac774c2ebe97230637820b3323 ] + +The value of NSEC_PER_SEC << PWM_DUTY_WIDTH doesn't fix within a 32 bit +integer causing a build warning/error (and the value truncated): + + drivers/pwm/pwm-tegra.c: In function ‘tegra_pwm_config’: + drivers/pwm/pwm-tegra.c:148:53: error: result of ‘1000000000 << 8’ requires 39 bits to represent, but ‘long int’ only has 32 bits [-Werror=shift-overflow=] + 148 | required_clk_rate = DIV_ROUND_UP_ULL(NSEC_PER_SEC << PWM_DUTY_WIDTH, + | ^~ + +Explicitly cast to a u64 to ensure the correct result. + +Fixes: cfcb68817fb3 ("pwm: tegra: Improve required rate calculation") +Signed-off-by: Steven Price +Reviewed-by: Uwe Kleine-König +Reviewed-by: Jon Hunter +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-tegra.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c +index 6fc4b69a3ba7..249dc0193297 100644 +--- a/drivers/pwm/pwm-tegra.c ++++ b/drivers/pwm/pwm-tegra.c +@@ -145,7 +145,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, + * source clock rate as required_clk_rate, PWM controller will + * be able to configure the requested period. + */ +- required_clk_rate = DIV_ROUND_UP_ULL(NSEC_PER_SEC << PWM_DUTY_WIDTH, ++ required_clk_rate = DIV_ROUND_UP_ULL((u64)NSEC_PER_SEC << PWM_DUTY_WIDTH, + period_ns); + + if (required_clk_rate > clk_round_rate(pc->clk, required_clk_rate)) +-- +2.35.1 + diff --git a/queue-6.0/series b/queue-6.0/series index 51188a0b852..c4b3c397e45 100644 --- a/queue-6.0/series +++ b/queue-6.0/series @@ -1072,3 +1072,4 @@ cifs-fix-xid-leak-in-cifs_get_file_info_unix.patch cifs-fix-memory-leaks-in-session-setup.patch cifs-fix-use-after-free-on-the-link-name.patch mfd-qcom_rpm-use-devm_of_platform_populate-to-simpli.patch +pwm-tegra-fix-32-bit-build.patch -- 2.47.3