From nobody Sat Feb 7 18:16:05 2026 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 3E2472F6196; Mon, 20 Oct 2025 13:07:29 +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=1760965650; cv=none; b=MIk/s1xLmgzNr0YIAnK8x5urhesm91cX2EmNG/AP3FVXFw6McQiTlhPPfjqzGvdEGb0p6k+uPn2LHZSt8qgZ1vU/16MnryjBImEvkswx3PUoidjaEkKb3cXKkIfqY5qvBjhluW9eOlILALiNWTxMiUVuJP04Hu5scej30Mz3XA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965650; c=relaxed/simple; bh=84ijlBcIXDyj2XxLW1M/v22FZDomhnAZOpBhwWY+gj8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=MeoRqyyaXJPkExVPcQQeA4jh5LJTpcqam8tdTCOrR41QXL+KfI+qVzRFVKHX9T3ij9FC60dyhEMpPMOBz3Cz52bg9EHSwbKt3i0Tx22goF3sV3VEPvSvE4zP64sm1fFlhuhFTiXoXnEv/+86cnqT85qfdY3ymb3dj+rzk5uaz/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J+G04tYc; 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="J+G04tYc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 125E1C4CEF9; Mon, 20 Oct 2025 13:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760965649; bh=84ijlBcIXDyj2XxLW1M/v22FZDomhnAZOpBhwWY+gj8=; h=From:Date:Subject:To:Cc:From; b=J+G04tYckYKTK5Fv7opz/ARIwtEcpd1Me7sAxQb80crCGS/FF/ITXqC3DPVs/XH9j VaAWQZV8BEjj3yusnRMMb1GQBDUJ7oADlIX09X4ihVNIc7loysdtraUaIeFg47JlED XqvTqs9/cHF8dq5Fc+COhUL3f6wUCHm6+m0GbMP0gXeaYVJGEDCiqLhoI4Aui6jsIh Xe3C1NzeO7/7Pk6sUq8VJqxVlgdy7LNh3R5aEhQs1W0S3HztVbN0dhlfMnGusb86E/ i+UctN8VRIOyvrIcCHmcJ97jz0nFgqt+bP+8m07lsnYVvMTIz4vl0l0etr9l9APkyC DnHeQwf9qWSfg== From: Tamir Duberstein Date: Mon, 20 Oct 2025 09:07:22 -0400 Subject: [PATCH] rust: opp: simplify callers of `to_c_str_array` Precedence: bulk X-Mailing-List: linux-kernel@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 Message-Id: <20251020-opp-simpler-code-v1-1-04f7f447712f@kernel.org> X-B4-Tracking: v=1; b=H4sIAAk09mgC/x3MQQqAIBBA0avIrBtQKYuuEi1KpxqoFIUIxLsnL d/i/wyJIlOCUWSI9HBif1eoRoA9lnsnZFcNWupOSTWgDwETX+GkiNY7wm4wRluj+3VroWYh0sb vv5zmUj5a6oWMYgAAAA== X-Change-ID: 20251018-opp-simpler-code-58662c627bf4 To: Viresh Kumar , Nishanth Menon , Stephen Boyd , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich Cc: linux-pm@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Tamir Duberstein X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openssh-sha256; t=1760965647; l=1850; i=tamird@kernel.org; h=from:subject:message-id; bh=84ijlBcIXDyj2XxLW1M/v22FZDomhnAZOpBhwWY+gj8=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgtYz36g7iDMSkY5K7Ab51ksGX7hJgs MRt+XVZTrIzMVIAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QHFqjXyc3WyeybzGTMB6Px+KBZWl1fyMKfCJf97ch3/b5poABmNTmH423TIyOELROATh2hm8hsT tGJnVm37i5ww= X-Developer-Key: i=tamird@kernel.org; a=openssh; fpr=SHA256:264rPmnnrb+ERkS7DDS3tuwqcJss/zevJRzoylqMsbc Use `Option` combinators to make this a bit less noisy. Signed-off-by: Tamir Duberstein --- rust/kernel/opp.rs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/rust/kernel/opp.rs b/rust/kernel/opp.rs index 9d6c58178a6f..b84786f45522 100644 --- a/rust/kernel/opp.rs +++ b/rust/kernel/opp.rs @@ -443,23 +443,14 @@ pub fn set_supported_hw(mut self, hw: KVec) -> R= esult { /// /// The returned [`ConfigToken`] will remove the configuration when dr= opped. pub fn set(self, dev: &Device) -> Result { - let (_clk_list, clk_names) =3D match &self.clk_names { - Some(x) =3D> { - let list =3D to_c_str_array(x)?; - let ptr =3D list.as_ptr(); - (Some(list), ptr) - } - None =3D> (None, ptr::null()), - }; - - let (_regulator_list, regulator_names) =3D match &self.regulator_n= ames { - Some(x) =3D> { - let list =3D to_c_str_array(x)?; - let ptr =3D list.as_ptr(); - (Some(list), ptr) - } - None =3D> (None, ptr::null()), - }; + let clk_names =3D self.clk_names.as_deref().map(to_c_str_array).tr= anspose()?; + let clk_names =3D clk_names.map_or(ptr::null(), |c| c.as_ptr()); + let regulator_names =3D self + .regulator_names + .as_deref() + .map(to_c_str_array) + .transpose()?; + let regulator_names =3D regulator_names.map_or(ptr::null(), |c| c.= as_ptr()); =20 let prop_name =3D self .prop_name --- base-commit: a1ec674cd709fec213acbb567e699c5f6f58cb60 change-id: 20251018-opp-simpler-code-58662c627bf4 Best regards, -- =20 Tamir Duberstein