Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2770739iog; Mon, 20 Jun 2022 04:33:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tDXwyk1uyoFQZEVzxlkUTjlPfHtgUQEnBE7wkW373/X93n1g522T/jijdCL/5cAHkG+qUh X-Received: by 2002:a05:6a00:134f:b0:51c:4c92:1dae with SMTP id k15-20020a056a00134f00b0051c4c921daemr24285687pfu.32.1655724830797; Mon, 20 Jun 2022 04:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655724830; cv=none; d=google.com; s=arc-20160816; b=W7IY9UFdK22DGierOYprAoCwdolNZITxzG/Hn3hyIgLYTvm/KDCYw2cbhd0h+CfoEa Z+c2TsJ6rLg6o3iteGBZ8mCjZScZ1fWvODwBhtUUrELmWGWnnsxvDoPbGF956SkNuplh KCCkOXAuYNhB77hXKlr8a2sOT8HTI2lZhiW7X44rfqws0FmsTQEXbNeVuDb9cfbRPx7G zvGr6znau/PUEvy1TmJy/mzw00EgaUxOqNPe7qLLlDyOgoFVlwiorkWroMPV16ew4aBH 2yWYHwxWF5qZgpNMPerZ+HchJ29p4rN6IUvEKTd16d3x1dtb4pRmsf8SD9bCNko9rDhb anXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8HmuiD0Wo+tdZIhp+vs0Aw78V+tuRHzEd0BRSRg3hb4=; b=XR0Q8gYxD/oaQiTlOy7ZuZebTXPUgXu2MbO36jKKh2zvuGOvF3os9MRRJyNW0zsS32 395cpFglqQDC4vX5NSTkoLqUquxSoxEUZIBV5bIDY3VukCrR8qy5lFsSrQFuweV24ePy Ujq6DqHBAq2RbP2iyAscepd1OnRvfyqSiqC1IjOAt2WRzUgHXqDLXebNOjoMiKJ1s2xz pDGlGxTiwPb/NnRkBMnhxIVLKnp47tB+xA1ZcIZlak4xZVOz8rBzJjS1iIlfgqPza/Z8 wPOZbO9m2rFN8S2OEBDnQXYKOBV9uhAd0urABB2x9qYY8PfApQXrYUwGNb+6U7WGnzfR gu2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CW8ekHH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d18-20020a170902b71200b00168b33be8c9si14092756pls.451.2022.06.20.04.33.35; Mon, 20 Jun 2022 04:33:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CW8ekHH7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239688AbiFTKnI (ORCPT + 99 others); Mon, 20 Jun 2022 06:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232170AbiFTKnH (ORCPT ); Mon, 20 Jun 2022 06:43:07 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA63211174; Mon, 20 Jun 2022 03:43:04 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 98C631C000D; Mon, 20 Jun 2022 10:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1655721783; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8HmuiD0Wo+tdZIhp+vs0Aw78V+tuRHzEd0BRSRg3hb4=; b=CW8ekHH70yp2UEX+lty3nRQ6qoZUUHMZTI1U2No9V7IL/svmi6QQJ/sHRHowZszQGjCCnm cjd6LjNohWfiQm6jNe+ahzKIVpUurR1lKSaJsYArLloWMsrFTMXGZDx1VSFS07QL2y0xLy kjDLz5EIRRO1vKdfOd0nR+6EUHPMYfS96ShrHY5BnIR+5pHymXC01UOIIMLB2u7z/I7ycP emM+j4fKyUXZkfe1L3bmcPUfI6cj04BsRrSFM2MY03EYZdujIigjYR4g1jTPbuiTmXmtbw gUdwW/hQIdmjSjjlW7GL496TRZ/T9ZxuzdvsjkqYr5Gqng3vKp7/hfwCnegYyQ== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Rob Herring , Frank Rowand , Nathan Lynch , Laurent Dufour , Daniel Henrique Barboza , David Gibson , Andrew Morton , David Hildenbrand , Ohhoon Kwon , "Aneesh Kumar K.V" , YueHaibing Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Bjorn Helgaas , Lizhi Hou Subject: [PATCH v3 0/5] of: add of_property_alloc/free() and of_node_alloc() Date: Mon, 20 Jun 2022 12:41:18 +0200 Message-Id: <20220620104123.341054-1-clement.leger@bootlin.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to be able to create new nodes and properties dynamically from drivers, add of_property_alloc/free() and of_node_alloc(). These functions can be used to create new nodes and properties flagged with OF_DYNAMIC and to free them. Some powerpc code was already doing such operations and thus, these functions have been used to replace the manual creation of nodes and properties. This code has been more than simply replaced to allow using of_node_put() rather than a manual deletion of the properties. Unfortunately, as I don't own a powerpc platform, it would need to be tested. --- Changes in V3: - Remove gfpflag attribute from of_node_alloc() and of_property_alloc(). - Removed allocflags from __of_node_dup(). - Rework powerpc code to only use of_node_put(). - Fix properties free using of_node_property in OF unittests. Changes in V2: - Remove of_node_free() - Rework property allocation to allocate both property and value with 1 allocation - Rework node allocation to allocate name at the same time the node is allocated - Remove extern from definitions - Remove of_property_alloc() value_len parameter and add more explanation for the arguments - Add a check in of_property_free to check OF_DYNAMIC flag - Add a commit which constify the property argument of of_property_check_flags() Clément Léger (5): of: constify of_property_check_flags() prop argument of: remove __of_node_dup() allocflags parameter of: dynamic: add of_property_alloc() and of_property_free() of: dynamic: add of_node_alloc() powerpc/pseries: use of_property_alloc/free() and of_node_alloc() arch/powerpc/platforms/pseries/dlpar.c | 62 +------- .../platforms/pseries/hotplug-memory.c | 21 +-- arch/powerpc/platforms/pseries/reconfig.c | 123 ++++++---------- drivers/of/dynamic.c | 137 ++++++++++++------ drivers/of/of_private.h | 19 ++- drivers/of/overlay.c | 2 +- drivers/of/unittest.c | 24 ++- include/linux/of.h | 24 ++- 8 files changed, 191 insertions(+), 221 deletions(-) -- 2.36.1