From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (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 69D9263B8; Sun, 7 Apr 2024 09:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712483669; cv=none; b=Gi2l03KCUg/sTFvOfseSqjb1L8/XSV3lXg44QjozEhkL/CtqUPL7XBM36pwbpV6Uss0y1bxdrlkqkrK+gl5rPqosLj97973HSfIkcgUcCuCCewjBAYDgT1tHodiVwKK4ifF80OthwwOiC2oGQ01YaBd0Vlyg+SHPBiRf/PWwPGQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712483669; c=relaxed/simple; bh=rJcdmdSVaCU80ztqbZrjQkcR0aAJtLC4psVNrXmv+os=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OFPc0+FDsN9+4zNOShUvZD7Ce16JPl1XDWNQWlaWZoEQmaHO14lt73u3ahfPTmb6B2J9Y6jYf/auIrrWjsMG/qroatZ5Q98HpEEmm+cEJBusAJ3eU+zsYJA9uZWuVXZRjjvXM6UkCiahSvvu0+UjV26VzF0Ni311HM5Kqdxmsxo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=MYK1Z1b2; arc=none smtp.client-ip=185.70.43.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="MYK1Z1b2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1712483666; x=1712742866; bh=8YZS8eu/oWRcKM7mzkufE33UHJldzqwP/IUT97Ck+U8=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=MYK1Z1b2S7tyd+lWOKFF1lJUt5Nf0YKgLQis4kkW0p0q3IGOs263WaOyQAJFKuCO+ U0Pwn5PPgZ0CpQKxJICDRSoa0nr6hrnYBgXUztWL35ZHiGJBxvojxRDNPLpIiDQ/Ep d9RJY7NqWtRYfqZSuXBxMuEIIryPMP6WCbmMZkYbK6WPhXdTS9xosvMi95FkEIZHbN kjTwMtbzo+XSbSobQDoX6+i3+NfslCtKPb4toLrlWdYXcICviA/RBLY1nnJUa6vtrs 2p8fjvGMvtPuO5B+UNLXWCOoDITUXsVf4E18RCeHMWfbCitY/WzRGheZEBkuMP3463 bzpeG9vAp0VSw== Date: Sun, 07 Apr 2024 09:54:22 +0000 To: Viresh Kumar , "Rafael J. Wysocki" , Miguel Ojeda , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Alice Ryhl From: Benno Lossin Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , rust-for-linux@vger.kernel.org, Manos Pitsidianakis , Erik Schilling , =?utf-8?Q?Alex_Benn=C3=A9e?= , Joakim Bech , linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 3/3] cpufreq: Add Rust based cpufreq-dt driver Message-ID: <4ff5f30b-f2b8-4625-b3cd-ac08e4ffb068@proton.me> In-Reply-To: <1792467a772b7a8355c6d0cb0cbacfbffff08afd.1712314032.git.viresh.kumar@linaro.org> References: <1792467a772b7a8355c6d0cb0cbacfbffff08afd.1712314032.git.viresh.kumar@linaro.org> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05.04.24 13:09, Viresh Kumar wrote: > +// Finds exact supply name from the OF node. > +fn find_supply_name_exact(np: *mut bindings::device_node, name: &str) ->= Option { > + let sname =3D CString::try_from_fmt(fmt!("{}-supply", name)).ok()?; > + > + // SAFETY: The OF node is guaranteed by the C code to be valid. > + let pp =3D unsafe { bindings::of_find_property(np, sname.as_ptr() as= *mut _, ptr::null_mut()) }; Drivers should avoid calling `unsafe` code as much as possible. They also should not be calling `bindings` code directly. Please write (or find) abstractions for these `unsafe` calls. --=20 Cheers, Benno > + if pp.is_null() { > + None > + } else { > + CString::try_from_fmt(fmt!("{}", name)).ok() > + } > +}