Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <ukleinek@kernel.org>
To: FUJITA Tomonori <tomo@flapping.org>
Cc: fustini@kernel.org, guoren@kernel.org, wefu@redhat.com,
	 a.hindborg@kernel.org, acourbot@nvidia.com,
	aliceryhl@google.com,  bjorn3_gh@protonmail.com,
	boqun@kernel.org, dakr@kernel.org, daniel.almeida@collabora.com,
	 gary@garyguo.net, linux-riscv@lists.infradead.org,
	lossin@kernel.org,  m.wilczynski@samsung.com, ojeda@kernel.org,
	tamird@kernel.org, tmgross@umich.edu,  work@onurozkan.dev,
	linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org,
	 fujita.tomonori@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH v2] pwm: th1520: Fix 32-bit build with COMPILE_TEST
Date: Thu, 1 Oct 2026 08:27:45 +0200	[thread overview]
Message-ID: <ar38qq0q8f2Vecuw@monoceros> (raw)
In-Reply-To: <20261001.070215.521963012921142699.tomo@flapping.org>


[-- Attachment #1.1: Type: text/plain, Size: 1800 bytes --]

Hello,

On Thu, Oct 01, 2026 at 07:02:15AM +0900, FUJITA Tomonori wrote:
> On Wed, 30 Sep 2026 13:57:31 +0200
> Uwe Kleine-König <ukleinek@kernel.org> wrote:
> 
> >> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> >> index 729776086879..abecd95b0c3c 100644
> >> --- a/drivers/pwm/Kconfig
> >> +++ b/drivers/pwm/Kconfig
> >> @@ -772,7 +772,7 @@ config PWM_TEGRA
> >>  
> >>  config PWM_TH1520
> >>  	tristate "TH1520 PWM support"
> >> -	depends on ARCH_THEAD || COMPILE_TEST
> >> +	depends on ARCH_THEAD || (COMPILE_TEST && 64BIT)
> >>  	depends on RUST
> >>  	depends on HAS_IOMEM && COMMON_CLK
> >>  	select RUST_PWM_ABSTRACTIONS
> > 
> > Can't we do better than that? For C code the right thing to do is to use
> > one of the div helpers instead of a plain / for types bigger than long.
> 
> Indeed. Rust code already uses some div helpers. However, the kernel
> crate does not have Rust wrappers for the helpers this driver needs,
> such as mul_u64_u64_div_u64(), so we need to add them first. The
> changes would be too large for stable.
> 
> So how about merging this as a fix? I will work on patches to use div
> helpers in the driver.

Fine, then let me just wonder about the expression you chose, that makes
it look as if 64BIT was only needed for COMPILE_TEST.

How about making this

diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 729776086879..4cc2911a0673 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -774,6 +774,7 @@ config PWM_TH1520
 	tristate "TH1520 PWM support"
 	depends on ARCH_THEAD || COMPILE_TEST
 	depends on RUST
+	depends on 64BIT # no 64bit division available on 32 bit builds
 	depends on HAS_IOMEM && COMMON_CLK
 	select RUST_PWM_ABSTRACTIONS
 	help

instead?

Best regards
Uwe

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

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

  reply	other threads:[~2026-10-01  6:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20260930101334eucas1p2ec64abcf499a296767711f13ad70c486@eucas1p2.samsung.com>
2026-09-30 10:12 ` [PATCH v2] pwm: th1520: Fix 32-bit build with COMPILE_TEST FUJITA Tomonori
2026-09-30 10:27   ` Miguel Ojeda
2026-09-30 10:33   ` Michal Wilczynski
2026-09-30 11:57   ` Uwe Kleine-König
2026-09-30 22:02     ` FUJITA Tomonori
2026-10-01  6:27       ` Uwe Kleine-König [this message]
2026-10-01  9:07         ` FUJITA Tomonori

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=ar38qq0q8f2Vecuw@monoceros \
    --to=ukleinek@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=fustini@kernel.org \
    --cc=gary@garyguo.net \
    --cc=guoren@kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lossin@kernel.org \
    --cc=m.wilczynski@samsung.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=tomo@flapping.org \
    --cc=wefu@redhat.com \
    --cc=work@onurozkan.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox