From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 676551F4285; Tue, 1 Jul 2025 17:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751390085; cv=none; b=rpHLqhlvl0kbGuNjq+LjIDHCkU1kvkNcS2Brh4xa1XmCZQRRKiJYwQ8+bUk4Pipl5npvRvArU3gk0/kEdaBT0QDQFB5tcS6AAf2VS1TV5/t8ZcXCeS2YD7ZjRBOI5OZ4XyXnTMRvKL/L6a+INfcZ5FVleM2RxmJr8X7sdoq6Pyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751390085; c=relaxed/simple; bh=/nYOnOIIbrOV+84hpe4LR2uNAOY0fYnhNLgViKHOwaA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FDwQdUhbM/DOjSQNwGjKvFKLlrfv4hmITDnNvoEal1nbfShcTeXMm+GK+bNeD2+dGF9YG1jwSMy+bAkc0Ii3DN8WQeFKQHpXKyuESqLjlnPL80I09kmn9jKUQuoqCLUoJW7depxCSG7Fxpv5mMdgo3+MjPY8+a+Scd26k2+B8Ds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=opSQbVh6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="opSQbVh6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6540DC4CEEB; Tue, 1 Jul 2025 17:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751390084; bh=/nYOnOIIbrOV+84hpe4LR2uNAOY0fYnhNLgViKHOwaA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=opSQbVh63+1AG4gEDXtVjLecX5Ff/0yV6Pvs8ObQge9FVL2sDvLA4exzHD6w5Eiq4 oA0sEuYIT1FPtZzwuCIL/MFW3oLhmvSZ29YQ15I5N3swOVr5tDG9eGfOmNpTLw4Wjb 4/3FEXeATUtsv4d46vz5q9LkVVeArZBZuL4S68yVmPKAsVanB0nLbZIBQSQjmIr5HO PDl2Ag2K+yWjOZd08MnNcHXmJdxFT3ymSUawNTxpeSt4mmq27oaOliI690M5kSMjHp YU8hkAsAYkTjkXzWp3t20A9YIb0Cl+20RQu6g2QaOFNrW/kOb1Qqv1fDcfAIKk5H/1 JcOO8Yn5xhjOQ== Message-ID: Date: Tue, 1 Jul 2025 19:14:37 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 3/8] rust: pwm: Add core 'Device' and 'Chip' object wrappers To: Michal Wilczynski Cc: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl , Trevor Gross , 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 , Drew Fustini , 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 References: <20250701-rust-next-pwm-working-fan-for-sending-v6-0-2710932f6f6b@samsung.com> <20250701-rust-next-pwm-working-fan-for-sending-v6-3-2710932f6f6b@samsung.com> From: Danilo Krummrich Content-Language: en-US In-Reply-To: <20250701-rust-next-pwm-working-fan-for-sending-v6-3-2710932f6f6b@samsung.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 7/1/25 6:01 PM, Michal Wilczynski wrote: > + /// Returns a reference to the parent device of this PWM chip's device. > + pub fn parent_device(&self) -> Option<&device::Device> { > + self.device().parent() > + } I know what you use this for, i.e. to provide a &Device reference in your class device callbacks -- that's great! But please don't expose this to the public. I think what you want instead is a private unsafe method that returns you the &Device directly, since you also know that you set a valid parent device, hence no need to mess with the Option as well. And again, sorry for not catching it right away. - Danilo