From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A3CD325721 for ; Mon, 9 Feb 2026 08:56:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770627385; cv=none; b=XwWeK8v0/fKLJ2ikCWhhkeStiKGiF1z7SWfyqoGhTNQv1aZOleRroEFWsAJrrQ/YaFPmjCkF+Tkmi9v8YBw+4UZF+7KxQx96MpjJmaiL9WDiYcft9tcCaj8z0JGgeNuZFrfaTON9Wgej+9rqApbXEP+YYnlvc9aqwhuEk7M3zqY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770627385; c=relaxed/simple; bh=345KCBHXVz0ZEx4i499l02tPXQld7swNF78syM+F1Y4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gKZ/4Gz+YO3HSyKe7lys+eElUzMsbi8IJgPK7Sj3vAarg2mKAJuyuWikaI0KXnfr2iUCBwmzcjwsBlHexZ6JzN/ks2jUma9//ctXFgPWGSCssY2ZpHrZxLph5D1qWLDo3aDl4Z0dLLggxDslXz6i4uqCrM5HT6FDU9HcesF9dio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=Hm28XDGZ; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="Hm28XDGZ" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-48039fdc8aeso25441605e9.3 for ; Mon, 09 Feb 2026 00:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1770627384; x=1771232184; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jU1e6cGfVovzfgBd9x95W/1mOj66I3de/7vGBXXyBSg=; b=Hm28XDGZmnpAayfYirrKHLg1QZBqBufymRvPBD1qjIFmhtZvmUnUQqAiSSB0n3rDgD QWG/OsM5hpxWUO3jeoBYDYECHznEyM3BCliangxoXtIXKCHokBNp3NXsqI86RLfJnxk8 NCrXSwtR07nKoNIfW1V7Iq6KV7FJrMZK/cJT8IM11DvZtqeS1CFjgS3892EEx1ga0/l/ m0O56SYcBjwDBr/0KoXFIxIvcpFPrW39aYBAWrCN4rvRhQHWifUTlsvsc6fQxG1U+2u8 2qDbR1bU8q6GRSRSw6S9Ye8Fh2hgyFMDmxh8NLl2q6Jh9KOOxAzItiy0SevGxwIjdNQe dKqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770627384; x=1771232184; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jU1e6cGfVovzfgBd9x95W/1mOj66I3de/7vGBXXyBSg=; b=dmiitJfi/+ox7nj8nwoFiR65si8rqgHMCoa4Dux9WmGQcGO+JZIVY6bxppnd1MD8/K yFtDnM8y9shQefXqe7RFgJqrsOR98IvgMW2DZtBEHFtA/35jc5iEoo4NATo5eKlbM+aq Ey0hKv6dqf1V2ymFVAtcK27Ph8WKdyDT24xUqb9LeB2pRTEDODlcwMxY2XrX+t9e5Zlb FTSU5YeMkjju/4yH12A5VyCkwLT64gnuwdrR+xC0SY0/unWykqpUrV3AjiAifQvRruyn 64tCKtkjP6MOo2/3EacjrlpK8BLcMurRLeqcwTO25qv0MJlALpPCu0U/cRIiTRoqiRJu w8Pw== X-Forwarded-Encrypted: i=1; AJvYcCWLKR3LLSx8HV17qfHasJjfRg2NA14jGfFLGBg6rICrQfhaoU1i5DfKSu1eU+xK5Kax4S1vnTNiEYrlKEBr5g==@vger.kernel.org X-Gm-Message-State: AOJu0YxNu55OWEA9GhlamL6wj+FXPNBGDWIgl6AXQK2lW+7Ihf5y086z nDYjQpVWv4SThDpZqOV4GL/teeVo5e6TztKklhwH7kBYrN6Yl7anEH57jhSK1roptAI= X-Gm-Gg: AZuq6aLrQNlyOJ+KF7rYdaIjIq2n/aDYu/NwrFFFobL/0nh8ipbnE51z0VbGH1j5uJ4 FApaD0F2o4L5llaksviHV1+eh0EiAu5hS41hu48hk3XkY3q6odAWziPXP+rS7fm82hzU929+lSa bzYJ6OXiU0sRCoe73GovrmqYhv4g9fpPgDFtkh8wSjlWf2coomEaj7ApBD8CkE0Q5/4RlLZz6+5 0n8MIA/IJtWwywQ72j0H+9bh0Wm4cW85/GSKrerWAKHndFbdyu8WyDh/imaEhx1Oj/OLJgG10SS mAPBVCuDGHx9RqmFPTgl/yAh34ob2MFjAqA1vJg4XeLjOW0Jwp8lohMdYHDVjvQACT6MtAn6QEG 6vMWFF3AyteTJ08UKqMuq3/CX+FvXO2U+8jl4hWww9+OF4sCvUq+zBAVBRYz1wyAIUQkmnawIUT DXAfRMmVFpQ8Tlg95VJHZhMy6vHOGdwwv7JT+gnwLXamvHQsoxU0/FGMLp/OsPR0i31n0BWR1lX nk= X-Received: by 2002:a05:600c:3b23:b0:47f:8c05:786b with SMTP id 5b1f17b1804b1-4832021eae9mr148505945e9.28.1770627383577; Mon, 09 Feb 2026 00:56:23 -0800 (PST) Received: from localhost (p200300f65f20eb04869299441cec46c1.dip0.t-ipconnect.de. [2003:f6:5f20:eb04:8692:9944:1cec:46c1]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-436296bd1c9sm24833439f8f.15.2026.02.09.00.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Feb 2026 00:56:22 -0800 (PST) Date: Mon, 9 Feb 2026 09:56:22 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Miguel Ojeda , Michal Wilczynski Cc: Drew Fustini , Guo Ren , Fu Wei , linux-riscv@lists.infradead.org, Boqun Feng , Gary Guo , =?utf-8?B?QmrDtnJu?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, Mark Brown , linux-pwm@vger.kernel.org Subject: Re: [PATCH] pwm: th1520: fix `CLIPPY=1` warning Message-ID: References: <20260121183719.71659-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ry77kcf6b3keyw4r" Content-Disposition: inline In-Reply-To: <20260121183719.71659-1-ojeda@kernel.org> --ry77kcf6b3keyw4r Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] pwm: th1520: fix `CLIPPY=1` warning MIME-Version: 1.0 Hello Miguel, On Wed, Jan 21, 2026 at 07:37:19PM +0100, Miguel Ojeda wrote: > The Rust kernel code should be kept `CLIPPY=3D1`-clean [1]. >=20 > Clippy reports: >=20 > error: this pattern reimplements `Option::unwrap_or` > --> drivers/pwm/pwm_th1520.rs:64:5 > | > 64 | / (match ns.checked_mul(rate_hz) { > 65 | | Some(product) =3D> product, > 66 | | None =3D> u64::MAX, > 67 | | }) / NSEC_PER_SEC_U64 > | |______^ help: replace with: `ns.checked_mul(rate_hz).unwrap_or(= u64::MAX)` > | > =3D help: for further information visit https://rust-lang.github.i= o/rust-clippy/rust-1.92.0/index.html#manual_unwrap_or > =3D note: `-D clippy::manual-unwrap-or` implied by `-D warnings` > =3D help: to override `-D warnings` add `#[allow(clippy::manual_un= wrap_or)]` >=20 > Applying the suggestion then triggers: >=20 > error: manual saturating arithmetic > --> drivers/pwm/pwm_th1520.rs:64:5 > | > 64 | ns.checked_mul(rate_hz).unwrap_or(u64::MAX) / NSEC_PER_SEC_U= 64 > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider u= sing `saturating_mul`: `ns.saturating_mul(rate_hz)` > | > =3D help: for further information visit https://rust-lang.github.i= o/rust-clippy/rust-1.92.0/index.html#manual_saturating_arithmetic > =3D note: `-D clippy::manual-saturating-arithmetic` implied by `-D= warnings` > =3D help: to override `-D warnings` add `#[allow(clippy::manual_sa= turating_arithmetic)]` >=20 > Thus fix it by using saturating arithmatic, which simplifies the code > as well. >=20 > Link: https://rust-for-linux.com/contributing#submit-checklist-addendum [= 1] > Fixes: e03724aac758 ("pwm: Add Rust driver for T-HEAD TH1520 SoC") > Signed-off-by: Miguel Ojeda > --- Looks good to me. I'll wait for Michal to add his blessing and then when picking it up tend to drop the Fixes line. Or do we also care about CLIPPY-cleanness in stable? Best regards Uwe --ry77kcf6b3keyw4r Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmmJoTMACgkQj4D7WH0S /k4zeAf/XYGAKk/eo6iDxvksTOmu3h5TkJUmEfcgxwPtvFEjikx0NKtlrbr5z5Pg FPa/A+qSRAoxsR8Igwk8Y266YgdRS+4EwmmeKUupEY+SJFcfb+AVXx1q/Upy0B2E jh5VCVD3VYDDM0gbaX7oEndU2edusd/Thag3PVdz8UoIpk1rEQPCV1Jz/NcCGoLU uAw2lwAWG5YUSufm9QUCd1nu+4iH+rgGXr8844D3wK7B+6JJ91wJaFHWjFfXpNTA wPJLf004PxvX3aVVGZVZk/jtMHKIVE+0rOKdnoPbUyu3flk4W+qJaXtV+jYZ32BT xpbO4ij+bh7NNur4IAy8OSBPnEk+cQ== =5cZO -----END PGP SIGNATURE----- --ry77kcf6b3keyw4r--