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 7034AC433FE for ; Fri, 18 Nov 2022 22:04:01 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:Cc:To:From :Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Foev2t+kmkvwfRqrLUc9PjgnPSrUCQRZlZrvWbiQYLs=; b=tZ54+91R12GWAmMBlqUL4CG7mU nqJzV6PlxbFHUdrGy1QcTTIjfHET2WdPDhQydCbfBytV0RAPdhlxDHKPdIzf97i7B/V4l8rHB3nCP TjYhIDQ89KDb1O4na9PQEK9pVW2hslT9N0SwEbNAXz4z7z+d44zbDejxu0FovbG+puDgNNeQKmXjk fJ8h2udbjvrKmvkwpJFZVS2i6WT6PbvYCfcT9RAaox+qHHzhxecY+lcexDtxHadcbViTvnU37M6XZ Bxbp6AA7qUpLv/kt/KcvKDCMTYFlGmbrQ9ehEP993ysxMPgAyrZjqtzGCIwKXbjqkRDpCepFWc3sI QSmOoVvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow9S2-008boN-4I; Fri, 18 Nov 2022 22:03:10 +0000 Received: from 0001.3ffe.de ([159.69.201.130] helo=mail.3ffe.de) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow9Ry-008bPd-Ka for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 22:03:08 +0000 Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (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 mail.3ffe.de (Postfix) with ESMTPSA id 907731CF7; Fri, 18 Nov 2022 23:03:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1668808981; 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: in-reply-to:in-reply-to:references:references; bh=z4PQjmkDf85oiVj5jD2DRQqNjG18C4b4h2V2WeJ5MY4=; b=ODR2yWN5w5w5jwnkgMSsMGDtcc1jiRvlZU7nscNfu4vmyW372rvY2OjguxtPMwN+0AXwD9 IgpZAq2d4HPPlrQj1crKVUFuDmdfvX49RLVOq0vIIXYTUBzraRb9xNf9+CZnOyHjbdc2QP FGk6AApmCy+2FKdn2dllv5KjMTuLTCXAIPtVBNVghhHhhBHOD0OputSfPEpZwySj6FkvSk JiwInVG9v6c9VMYE6edLifGKp8hhu3utaUVWqzeb/nYwjcOgv631461buoztEJ2cXzyeEh mYRrdKGzCYNUR/GoBN0NMvjtT9Jk8gV41sdicIOkLJGrsLcP5HxVLoo6vyhdGw== MIME-Version: 1.0 Date: Fri, 18 Nov 2022 23:03:01 +0100 From: Michael Walle To: Rob Herring Cc: Srinivas Kandagatla , Miquel Raynal , Frank Rowand , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: Re: [PATCH] of: property: special #nvmem-cell-cells handling In-Reply-To: References: <8b976cf546bad3aa159a6f05cd3c15d1@walle.cc> <20221118214036.1269005-1-michael@walle.cc> User-Agent: Roundcube Webmail/1.4.13 Message-ID: X-Sender: michael@walle.cc X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_140306_865126_BA6C28DA X-CRM114-Status: GOOD ( 15.28 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Am 2022-11-18 22:52, schrieb Rob Herring: > 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? You mean addding a new DEFINE_SIMPLE_PROP_OPTIONAL_ARGS()? -michael _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel