From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE3BAC433F5 for ; Fri, 22 Oct 2021 02:04:24 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC0C361186 for ; Fri, 22 Oct 2021 02:03:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BC0C361186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Hb71b3CMZz3c7N for ; Fri, 22 Oct 2021 13:03:47 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.a=rsa-sha256 header.s=thorn header.b=dTLcZyfB; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=bewilderbeest.net (client-ip=2605:2700:0:5::4713:9cab; helo=thorn.bewilderbeest.net; envelope-from=zev@bewilderbeest.net; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.a=rsa-sha256 header.s=thorn header.b=dTLcZyfB; dkim-atps=neutral Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Hb6yB2yCsz2y7X for ; Fri, 22 Oct 2021 13:00:49 +1100 (AEDT) Received: from hatter.bewilderbeest.net (71-212-29-146.tukw.qwest.net [71.212.29.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id AE5E572B; Thu, 21 Oct 2021 19:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1634868046; bh=2efYL9rwju5SdZ2gZO9Y+iw53j+3OthU+D9Ued9171A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTLcZyfB+o23zCieIixIk1iW6+CXajFlgYvk05xm6r1pcsOB3pmRsMCV71ZWfrEgS TfjbvVP5tlYDrYgv1hZIuIYw5QFffzYmZp35cfj/s+QelYfZ2PBZt6wxNGrkPv2WS1 qCOJbwjPa+skQ+phlmsd1hqHnkxdl1TXK1JgKTxg= From: Zev Weiss To: Frank Rowand , Greg Kroah-Hartman , Rob Herring Subject: [PATCH 2/5] device property: add fwnode_device_is_reserved() Date: Thu, 21 Oct 2021 19:00:29 -0700 Message-Id: <20211022020032.26980-3-zev@bewilderbeest.net> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211022020032.26980-1-zev@bewilderbeest.net> References: <20211022020032.26980-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Heikki Krogerus , Saravana Kannan , Zev Weiss , "Rafael J. Wysocki" , Andrew Jeffery , openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, Daniel Scally , linux-acpi@vger.kernel.org, Jeremy Kerr , Andy Shevchenko , Len Brown Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" This is the fwnode API corresponding to of_device_is_reserved(), which indicates that a device exists but may not be immediately accessible. Signed-off-by: Zev Weiss --- drivers/base/property.c | 16 ++++++++++++++++ include/linux/fwnode.h | 2 ++ include/linux/property.h | 1 + 3 files changed, 19 insertions(+) diff --git a/drivers/base/property.c b/drivers/base/property.c index 453918eb7390..7b70cb04531c 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -845,6 +845,22 @@ bool fwnode_device_is_available(const struct fwnode_handle *fwnode) } EXPORT_SYMBOL_GPL(fwnode_device_is_available); +/** + * fwnode_device_is_reserved - check if a device is reserved for use + * @fwnode: Pointer to the fwnode of the device. + * + * For fwnode node types that don't implement the .device_is_reserved() + * operation, this function returns false. + */ +bool fwnode_device_is_reserved(const struct fwnode_handle *fwnode) +{ + if (!fwnode_has_op(fwnode, device_is_reserved)) + return false; + + return fwnode_call_bool_op(fwnode, device_is_reserved); +} +EXPORT_SYMBOL_GPL(fwnode_device_is_reserved); + /** * device_get_child_node_count - return the number of child nodes for device * @dev: Device to cound the child nodes for diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 9f4ad719bfe3..1a9aefbe12f1 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -86,6 +86,7 @@ struct fwnode_reference_args { * @get: Get a reference to an fwnode. * @put: Put a reference to an fwnode. * @device_is_available: Return true if the device is available. + * @device_is_reserved: Return true if the device is reserved. * @device_get_match_data: Return the device driver match data. * @property_present: Return true if a property is present. * @property_read_int_array: Read an array of integer properties. Return zero on @@ -110,6 +111,7 @@ struct fwnode_operations { struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); void (*put)(struct fwnode_handle *fwnode); bool (*device_is_available)(const struct fwnode_handle *fwnode); + bool (*device_is_reserved)(const struct fwnode_handle *fwnode); const void *(*device_get_match_data)(const struct fwnode_handle *fwnode, const struct device *dev); bool (*property_present)(const struct fwnode_handle *fwnode, diff --git a/include/linux/property.h b/include/linux/property.h index 357513a977e5..455b022fa612 100644 --- a/include/linux/property.h +++ b/include/linux/property.h @@ -50,6 +50,7 @@ int device_property_match_string(struct device *dev, const char *propname, const char *string); bool fwnode_device_is_available(const struct fwnode_handle *fwnode); +bool fwnode_device_is_reserved(const struct fwnode_handle *fwnode); bool fwnode_property_present(const struct fwnode_handle *fwnode, const char *propname); int fwnode_property_read_u8_array(const struct fwnode_handle *fwnode, -- 2.33.1