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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF08FC433FE for ; Fri, 18 Nov 2022 21:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kybgP4e2J3CY/d+Wdmoi9HL5D1e3MqsE1GmZ7Krea9Q=; b=ZIxL5nQN71dmXu SQ1ndOJW1noNB6WI8hKGu7Mf1HafJMEGlb1q/TxTKxIN1JJUuManQgInyD/ldwDePbdw1td+fRD6X u1e4exFkZs6NhrfMtK1bonsEMjB3DO+M0GqsMtF0RBwuFbn7pXtxIMNl98GOJ8eJscdSMeg7SMUXW sbnBbUZ0xLCkQXLTJs0rron3Mkn57DfGk63vCA4UHUKlJvS3eqCjW6ZK3EwkxkDp26l+9clbjm/PW xBWwd6245R915KQANAHEqZQUJ1NvDXvfuuMdEc+bSffsPQiq4Ox1ONLRhuhOasPaYiNdsZsPfmLR+ uALPk1BPEYdNnFpJ4PcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow9Hf-008RbZ-2Y; Fri, 18 Nov 2022 21:52:27 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow9Hc-008RXQ-2T for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 21:52:25 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9CF0EB8255D for ; Fri, 18 Nov 2022 21:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53B2CC433D6 for ; Fri, 18 Nov 2022 21:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668808340; bh=0cxrDpCwAMLk20jFMUHD/+u3L6thMq/hKuFlsCzqPWQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=f3fGrrFzwpkh+5okDDUnpw4F6fUgoDBavKgkQdikAfgCdvvbjc4DqYjVsNXNXfeJG wEfxFdszGHyCeJ0mJBpjBz5DkP9GIWfBtiv1pwOaMctD/mGl5/kR6CppBKbOQkoKiN zDTovMqZWT67X6sLU2lrW96HaslsX9PFxXeHEhmklPS8nIH5Vzg1+pMyBISPfYy1Bf pg2Qb1osaxU+BMw5k4j3SUuHPmgHC5xQffVkgHM8ZhQ3g8AYcxzrde1zpof8JMtME2 NW5XmNFpTl3aKB9uh8qzXBJIkzNxq+8D1Y7PnTsjZnG4vj2T2SDvkUwyo9rjyzGwf8 l8vtbIBGiNvGA== Received: by mail-lj1-f181.google.com with SMTP id s24so8369821ljs.11 for ; Fri, 18 Nov 2022 13:52:20 -0800 (PST) X-Gm-Message-State: ANoB5pl5fBM2kADw/EJL0RZrXSKJwD6yc8I6JRGQkQytgaUWml6gVbxI 2YK5Uj9kTU+VoRStE3pGBgn8tzmJuwOBIq0jVg== X-Google-Smtp-Source: AA0mqf4XaC3HUFYd0cpd8pfENTYkpLT+rDEu5EqRwsFJTg0pPxnLvsBb4Mty+XHF8EMEDzaHvnlaXxXsyxQJDrZYtTI= X-Received: by 2002:a05:651c:12ca:b0:277:a9d:9355 with SMTP id 10-20020a05651c12ca00b002770a9d9355mr2838505lje.102.1668808338344; Fri, 18 Nov 2022 13:52:18 -0800 (PST) MIME-Version: 1.0 References: <8b976cf546bad3aa159a6f05cd3c15d1@walle.cc> <20221118214036.1269005-1-michael@walle.cc> In-Reply-To: <20221118214036.1269005-1-michael@walle.cc> From: Rob Herring Date: Fri, 18 Nov 2022 15:52:09 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] of: property: special #nvmem-cell-cells handling To: Michael Walle Cc: Srinivas Kandagatla , Miquel Raynal , Frank Rowand , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_135224_426751_89CA4806 X-CRM114-Status: GOOD ( 21.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 18, 2022 at 3:40 PM Michael Walle wrote: > > Since recently, there is a new #nvmem-cell-cells. To be backwards > compatible this is optional. Therefore, we need special handling and > cannot use DEFINE_SIMPLE_PROP() anymore. > > Signed-off-by: Michael Walle > --- > This patch will be part of the following series: > https://lore.kernel.org/linux-arm-kernel/20221118185118.1190044-1-michael@walle.cc/ > > drivers/of/property.c | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index 967f79b59016..93c0ea662336 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1305,7 +1305,6 @@ DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-cells") > DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") > DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") > DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) > -DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) > DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") > DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) > DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) > @@ -1381,6 +1380,22 @@ static struct device_node *parse_interrupts(struct device_node *np, > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > } > > +static struct device_node *parse_nvmem_cells(struct device_node *np, > + const char *prop_name, int index) > +{ > + struct of_phandle_args sup_args; > + > + if (strcmp(prop_name, "nvmem-cells")) > + return NULL; > + > + if (of_parse_phandle_with_optional_args(np, prop_name, > + "#nvmem-cell-cells", index, > + &sup_args)) > + return NULL; > + > + return sup_args.np; > +} There's a couple of other cases like that (MSI IIRC), so can we generalize this to work in more than 1 case? Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel