Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2156771lqb; Mon, 27 May 2024 09:32:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVgiaLNVXlNnjUCYvdleIMZKglCvGYc76TCeZmM+feMmmxjLnmr/kppju9F4plDXKWXdGXs1rkw4sxHdFFZj5ocaG1jlVkuYawWNKOopA== X-Google-Smtp-Source: AGHT+IFaFsS6Ma0Dg0gXWkxIIGcbcTcb8AujbGjhUo4RZzrw7O+vR6XkweWeC9kDF6BQhVKOjSIC X-Received: by 2002:a05:6a00:90a9:b0:6f3:ee60:54bd with SMTP id d2e1a72fcca58-6f8f30847d3mr9967046b3a.8.1716827560105; Mon, 27 May 2024 09:32:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716827560; cv=pass; d=google.com; s=arc-20160816; b=Dsj7ZZRy/PDCZqygVu3Aiv521a5FyTe/1u6PTdpcyn6QBxrLZGV4TpvzpsO0WdQBvL t0GomCuBgx4ulzdHAE3axRi7X5XtzADs2aLPzT6xyzz9hnr6c3pPmvBy+Jwr+oF/NhRl /ZniuTvLeL0QCcigYb8aZU4MnU1mPb7HrTJQEXefRKAXZl5qAwtarQFiy80HnveUX06J X1jesfYgdox2hDeOy0Qujeomf6Ohzo/s5QAcMJyQSPwePupvpPgu6iT0pi3OufgkRXZD NllmcqGld8tdYMcHhiykFzWLZZDsuB6OZi4/SicHvptRR4bq+mjw24Cd5rY+8R4DdLKa tS6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=OKJZsAxNSsb/7pw9huzbORlG49qO99fnpLGyuR8WMG8=; fh=3YQ9Wn9iIS51y8NrdlOvPTQ4lFTakVN5LX1zxHYgQ/4=; b=ngw32zgo5VIxYTvJWi69IoZCjk15jhXqmRt7l6Y0wDhOgXI1ixyv1nJ+VX6FaJdxrC 7vFoi/bTGcPHgelVg0vJ2hAfcC3F7t+vLs4+dxmYW9x1gRv8lN4rqF8a2UHVBa8AW8mh UC2sfaS5+62sd5bsfqi1YdKH+B502Om4QQjyn6fNPHgWGYzzm7OixeUnRyr2DylrTCP/ gRN50gV2X/whxEWZ2ry01DsFuDSby+Minb//AQbHB4WQfwqwHPY1d0+g7M8Gk7F2vt/5 XoQx0fwPslC0MrZ2tEoUK8CQ9RZlYkN5lGxwzEloSyjvqGwVyQx+elnR8RRPByZTo+Pk qn8A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=l6qhSOfm; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-191226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fc04c932si6299043b3a.34.2024.05.27.09.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=l6qhSOfm; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-191226-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191226-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7EE47287ACD for ; Mon, 27 May 2024 16:25:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C685C16DEB4; Mon, 27 May 2024 16:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="l6qhSOfm" Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) (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 BB8A716D4C5; Mon, 27 May 2024 16:15:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716826529; cv=none; b=atSrGUKk+5Az8TA234JhUvyZjDzxzcWeahU7Eg2xDOTKaK0nnwioHilqdm5zAY3Klpy8Wn8mBPqR3bCwb4KMYYZv3XzuiGf+wiQEZ5MP8Qcc/EWdcJ94gn9xGLZ0gZj+bXXijHiQxdHf8mup+fatASxDKinoxbsYoRRUZCLnhuA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716826529; c=relaxed/simple; bh=TFHpjk5EIjM4ZgDHiMQQnW5vfs5uqYWd3y1N5tamdQw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kxrR7H7IdmtP7GJK3Y8EIgF2fIi+aHw3Jc9eOOYpd4ENeFh/LFQUIiPtgoZOa2cx+0Kv2GUQMmkiH2mFfvYnjkGK/crXr3C49O2Eoii/snSNFEVD/6SMCaCno8Ps5YBt41LSjglE9Bowi9eeqeut4PKUS2ono1lFsUsd0cJfxsQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=l6qhSOfm; arc=none smtp.client-ip=217.70.183.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id E6986FF80A; Mon, 27 May 2024 16:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1716826525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OKJZsAxNSsb/7pw9huzbORlG49qO99fnpLGyuR8WMG8=; b=l6qhSOfmmCXe0Qy9DLq9Czxf2AYRZaR1NFx56gJZsppXR1JNfWwdVvM4h0bFoPEs9g3f3e YYQpuiWsBfvyK1dWaYru8sGEFvMsvpyXkFgfmLQwA6Wy1Mmg6dkIzb97tVi6H15t3CmbvL hhZ03dmeb63YfefyctlUwYK51rMwTX9ZgHuGC3e4A/NJeUwV00D8KTel7R3HvxvgfnugZ9 oJneBRXp0MBGOS7zM1MXeXu1DoAAWAgWKIcF/JNVDb/jWUZaoC0MriAfQPoO7g/5tZZvMC Y2XOYLWZX9P1z0VlLrARtoLiuLviaeP77d31lMOI7tC8XvFjHkAq5o1fK54kOg== From: Herve Codina To: Simon Horman , Sai Krishna Gajula , Herve Codina , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Lee Jones , Arnd Bergmann , Horatiu Vultur , UNGLinuxDriver@microchip.com, Andrew Lunn , Heiner Kallweit , Russell King , Saravana Kannan , Bjorn Helgaas , Philipp Zabel , Lars Povlsen , Steen Hegelund , Daniel Machon , Alexandre Belloni Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Allan Nielsen , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: [PATCH v2 15/19] of: dynamic: Introduce of_changeset_add_prop_bool() Date: Mon, 27 May 2024 18:14:42 +0200 Message-ID: <20240527161450.326615-16-herve.codina@bootlin.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240527161450.326615-1-herve.codina@bootlin.com> References: <20240527161450.326615-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: herve.codina@bootlin.com APIs to add some properties in a changeset exist but nothing to add a DT boolean property (i.e. a property without any values). Fill this lack with of_changeset_add_prop_bool(). Signed-off-by: Herve Codina --- drivers/of/dynamic.c | 25 +++++++++++++++++++++++++ include/linux/of.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 70011a98c500..110104a936d9 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c @@ -1047,3 +1047,28 @@ int of_changeset_add_prop_u32_array(struct of_changeset *ocs, return of_changeset_add_prop_helper(ocs, np, &prop); } EXPORT_SYMBOL_GPL(of_changeset_add_prop_u32_array); + +/** + * of_changeset_add_prop_bool - Add a boolean property (i.e. a property without + * any values) to a changeset. + * + * @ocs: changeset pointer + * @np: device node pointer + * @prop_name: name of the property to be added + * + * Create a boolean property and add it to a changeset. + * + * Return: 0 on success, a negative error value in case of an error. + */ +int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np, + const char *prop_name) +{ + struct property prop; + + prop.name = (char *)prop_name; + prop.length = 0; + prop.value = NULL; + + return of_changeset_add_prop_helper(ocs, np, &prop); +} +EXPORT_SYMBOL_GPL(of_changeset_add_prop_bool); diff --git a/include/linux/of.h b/include/linux/of.h index ee9a385a13db..13cf7a43b473 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -1652,6 +1652,9 @@ static inline int of_changeset_add_prop_u32(struct of_changeset *ocs, return of_changeset_add_prop_u32_array(ocs, np, prop_name, &val, 1); } +int of_changeset_add_prop_bool(struct of_changeset *ocs, struct device_node *np, + const char *prop_name); + #else /* CONFIG_OF_DYNAMIC */ static inline int of_reconfig_notifier_register(struct notifier_block *nb) { -- 2.45.0