From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46DA43C1F for ; Wed, 11 Jun 2025 21:16:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749676566; cv=none; b=Ou1rZN6VRhqDJt/A6HetjIh7L028KNIdK3GoK15HBIqw2BcEtLomM68EXnMPEHhYLYvSH7PNqo/xSDhRSN3gUgyZUGC7TevfhxqI0GKD8e3Y0b+gLZ1CPovH5zxob00tZIMO606KPJPd1KGA6xNDky4mXzO1/zqd85ENlWVk9Q0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749676566; c=relaxed/simple; bh=34l1hncorS8+nkL26ZB/15dqnRBpVywFqIADeqMlHMU=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:In-Reply-To: Content-Type:References; b=vCkhu6IRsmREofBUyalXdZqXwwY8NT1FJPlYVNPuIkwwOb9jwd+sa6usMWETWbOhd0nL3sJcA/ni/xVejGF5BFW40iWZ/EztB/69KbfJdXIwDWvZhdEXba6Tn4DHRdTLIEd290I8E3M1yJvyBzsR6cPj5ZagIWscd/XWN+N1P+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=bp0W74Lh; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="bp0W74Lh" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250611211602euoutp023bee20c4792f3b3ba7ae08d8d1db2cb0~IGZA8FZDO3234732347euoutp02X for ; Wed, 11 Jun 2025 21:16:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250611211602euoutp023bee20c4792f3b3ba7ae08d8d1db2cb0~IGZA8FZDO3234732347euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1749676562; bh=gJSx6fFWCab1L0dG4hF/wx4spo5Eingwx2AqpslewPk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=bp0W74LhifQr+oDb85bFPnIvLOvQj11U4xNBK2Ctc3WQbNvMXWHlyVld+paX8aOnx jHUXOFqS4Gqc31gj9khxT2dS4yO5XFKlDvzNkeeaiVcPU7iuznz807UwDsOtlRhIGI wMx6yzURpEnZd1OPa2nu1tm7/icJkWPXwRhDOr4M= Received: from eusmtip1.samsung.com (unknown [203.254.199.221]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250611211600eucas1p13784b73e9c0257e670846320bca0a2f9~IGY-b_FYG1491714917eucas1p1X; Wed, 11 Jun 2025 21:16:00 +0000 (GMT) Received: from [192.168.1.44] (unknown [106.210.136.40]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20250611211558eusmtip17a546ce3e5256d611175ed66f1a5dc7a~IGY8xpr_31879718797eusmtip1c; Wed, 11 Jun 2025 21:15:57 +0000 (GMT) Message-ID: <02e480b9-68eb-47e7-97f5-54e49d259f84@samsung.com> Date: Wed, 11 Jun 2025 23:15:57 +0200 Precedence: bulk X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/7] pwm: Add Rust driver for T-HEAD TH1520 SoC From: Michal Wilczynski To: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Drew Fustini , Guo Ren , Fu Wei , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Marek Szyprowski , Benno Lossin , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org Content-Language: en-US In-Reply-To: <1d9bba9e-0f30-4039-812e-60b160271e6b@samsung.com> Content-Transfer-Encoding: 8bit X-CMS-MailID: 20250611211600eucas1p13784b73e9c0257e670846320bca0a2f9 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250610125333eucas1p16126b64a0f447a5e9a5ad553d9d7d79d X-EPHeader: CA X-CMS-RootMailID: 20250610125333eucas1p16126b64a0f447a5e9a5ad553d9d7d79d References: <20250610-rust-next-pwm-working-fan-for-sending-v2-0-753e2955f110@samsung.com> <20250610-rust-next-pwm-working-fan-for-sending-v2-2-753e2955f110@samsung.com> <1d9bba9e-0f30-4039-812e-60b160271e6b@samsung.com> On 6/11/25 22:04, Michal Wilczynski wrote: > > > On 6/11/25 08:58, Uwe Kleine-König wrote: >> Hello, >> >> >> What does .unwrap_or(0) do? You need to round up in this mul_div >> operation. Yeah and I'm thinking that the helper needs to be updated or new one added like mul_div_round_up, to do the rounding > > The .unwrap_or(0) is to handle the case where the mul_div helper returns > None, which can happen if the divisor (rate_hz) is zero. In that case, > the period becomes 0. The mul_div helper is introduced in this commit > [1]. > > [1] - https://lore.kernel.org/all/20250609-math-rust-v1-v1-1-285fac00031f@samsung.com/ > Best regards, -- Michal Wilczynski