Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755478Ab3DVOh3 (ORCPT ); Mon, 22 Apr 2013 10:37:29 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51619 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754984Ab3DVOaS (ORCPT ); Mon, 22 Apr 2013 10:30:18 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Grant Likely" , "Jean-Christophe PLAGNIOL-VILLARD" , "Arnd Bergmann" , "Rob Herring" Date: Mon, 22 Apr 2013 15:25:59 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [45/75] of: introduce helper to manage boolean In-Reply-To: X-SA-Exim-Connect-IP: 2001:470:1f08:1539:6834:ff73:7553:7f84 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1728 Lines: 53 3.2.44-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jean-Christophe PLAGNIOL-VILLARD commit fa4d34ccd0914ac87336ea2c17e9370dfecef286 upstream. of_property_read_bool Search for a property in a device node. Returns true if the property exist false otherwise. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Acked-by: Rob Herring Acked-by: Arnd Bergmann Acked-by: Grant Likely Signed-off-by: Ben Hutchings --- include/linux/of.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/include/linux/of.h +++ b/include/linux/of.h @@ -336,6 +336,22 @@ static inline int of_machine_is_compatib #define of_match_node(_matches, _node) NULL #endif /* CONFIG_OF */ +/** + * of_property_read_bool - Findfrom a property + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * + * Search for a property in a device node. + * Returns true if the property exist false otherwise. + */ +static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) +{ + struct property *prop = of_find_property(np, propname, NULL); + + return prop ? true : false; +} + static inline int of_property_read_u32(const struct device_node *np, const char *propname, u32 *out_value) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/