From nobody Mon Dec 15 21:27:12 2025 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 0A0C623A56D for ; Mon, 13 Jan 2025 11:23:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736767429; cv=none; b=nSqDXqa07hpxMNdH6iq7gpv790nTf/Znr6M1jBK+3mDoCr7lGEMUlPnlN+JHl939g9RzRSEAmhaRjqXkkRAqe+msbIPwyNEXKAzoTFX9E2/va6VskcnXo2By1IJGZQ5xIe9NOBdmTjcTRPJfTRi/dikZO+qP2E1Ks4eESWbmZtU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736767429; c=relaxed/simple; bh=qFjzLah+7k0bGLsf807G16R7Nl932aHbCVEztV18Qug=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kmnWg1DA4FptWzKzmwDILDsJEBwAD/87hmITG6lDrN/aMp7jJ3XE7hHKSwHUGlQpeh9WJh4kMS2vcUIGFFNfC97XIDOM6UMhsg9MqHyrfFjY2zGZH6Wn/09YRs5Tu4eRk0TIuTqGumtvDfxuu3BObJmk192t73UV7GDeq6wnTWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=whRU9Cfj; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="whRU9Cfj" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21675fd60feso94245385ad.2 for ; Mon, 13 Jan 2025 03:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736767427; x=1737372227; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Erl89OKGaS5TERvIe2o6tMzhWrw69h3Z1JOwTaxOJAQ=; b=whRU9CfjTnHWSyizQVtwhP59wdi9PnmXTxU0lGYVZ2iGN3hA10ZihH+eLtxU9PG1XH IH5HRO/Fi4Txp9Kv061J8jDSGnWBFnTnupIRUaxNaOIrUe3hDVa3pHCoKSoWlpOD+BYK 5taBS0fy3OpCTJ1BuhRd2GhQQDuX6X23Yaqa3XetPkLqrFIhCq3VVb0KCh6MrRJN65wx Q9J+IQY4lMrR8fD+lF/i2k7G8oeoiNhe3DxFfDQQwmWZoIgKGcdjEzrudnUfKB6qq2pN NbPg32wBec267vXW7RKS2id8FCkzgr9rSML4d55Fzs3T+dGCieQ5wN+OsuCtisjzkxrY 1/tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736767427; x=1737372227; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Erl89OKGaS5TERvIe2o6tMzhWrw69h3Z1JOwTaxOJAQ=; b=M7nLRUGqbo88WewPJ1BZ9Dd3u8FTKitt3tA+jcML82GUmfQuJqjuczMlUmUhGqz+u5 /rjX1t15Zd3vwSWBPMv7vS1cPCbCu6QHJMRv8l/IMb94n/KJumq3XB8jbSF8YmC3N6cO fAWzrkgZy5sEuOMf6E2FzY9nAETe7ZdeRlYFnljAKYWRa8fEOAYhu1dEnOy5Nw+WqNnP 5o1njaWN1p62FF2b1Sq7N+iCfu2IZz2lIyFyBwAsNydaYr7uKaiqUJBNIw6jpSYdNhx4 HL4xb6KCCzBzjC0ITCEUUXk13J1GV3P+ohaQLq8EgU2T7NBQ/+hpwiDDQrOEMNorAZpR Z54Q== X-Forwarded-Encrypted: i=1; AJvYcCUSy29kA4vhA//GK8owotYmbcliGm4sPwhiYkG5yWcMV0WlFB9HmRXYHDG5LsB1ccHVvaTO4M/3VdL5nj8=@vger.kernel.org X-Gm-Message-State: AOJu0Yyd1LROcNW9kiiieNhc2J+7kahnpNA/f+KKf9K2f2KriNe/vMwW 5vskPnCXs1o20Z6G4j7KbKd80jSgdXWITIWbRY6N4hmUMYf1t6Dn23X2JS58KRA= X-Gm-Gg: ASbGncuRYMK6CvqrlcrHU1QEqgK+tWm0A5kw8WAq4H/A7K1jy6U4CUlhLaBvHOSvB42 StRtTycAT4ijFJ384UmUgqLFlfJ0IDP04SIkbr5dKUmp6uSUVSQ72Q6cd7f5RPOGrd/39tUthUV JpQKLdodYMf55sUKleheznZmCBneRcBnnKb/WwsYgnlCyiJAHEbcU9q/L3ZJXfv0Nw14R6jrPzP 1N7kSCYAlIskuT559gQtNYfv6/tJLbdA/e1+CYJ4ek/m/W41R25Yso1ppk= X-Google-Smtp-Source: AGHT+IFwnNOadRELhgUS4RHnfHmljCOFqvDn5NHiGTae6Lam/bomtLxFMSA+qHltYXwddKyNK29zYg== X-Received: by 2002:a17:902:d2d0:b0:216:45b9:439b with SMTP id d9443c01a7336-21a8400a357mr316419915ad.50.1736767427451; Mon, 13 Jan 2025 03:23:47 -0800 (PST) Received: from localhost ([122.172.84.139]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a9f10dddfsm52432345ad.23.2025.01.13.03.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 03:23:47 -0800 (PST) From: Viresh Kumar To: "Rafael J. Wysocki" , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Greg Kroah-Hartman , Danilo Krummrich Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V7 04/16] rust: device: Add property_present() Date: Mon, 13 Jan 2025 16:52:59 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This implements Device::property_present(), which calls C APIs device_property_present() helper. The new helper will be used by Rust based cpufreq drivers. Signed-off-by: Viresh Kumar Acked-by: Greg Kroah-Hartman --- rust/bindings/bindings_helper.h | 1 + rust/kernel/device.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helpe= r.h index d63e7f6d10ea..fda1e0d8f376 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs index d5e6a19ff6b7..e8c4cda5aacc 100644 --- a/rust/kernel/device.rs +++ b/rust/kernel/device.rs @@ -6,6 +6,7 @@ =20 use crate::{ bindings, + str::CString, types::{ARef, Opaque}, }; use core::{fmt, ptr}; @@ -180,6 +181,12 @@ unsafe fn printk(&self, klevel: &[u8], msg: fmt::Argum= ents<'_>) { ) }; } + + /// Checks if property is present or not. + pub fn property_present(&self, name: &CString) -> bool { + // SAFETY: By the invariant of `CString`, `name` is null-terminate= d. + unsafe { bindings::device_property_present(self.as_raw().cast_cons= t(), name.as_ptr() as *const _) } + } } =20 // SAFETY: Instances of `Device` are always reference-counted. --=20 2.31.1.272.g89b43f80a514