Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1410337rdb; Sun, 8 Oct 2023 06:39:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFx0fd73ZoQy/cTvpgZ4WL1vl5UGvpznKfQRLQKLY/8OzUTEczWnLU3D07EYn/cO96pCXa8 X-Received: by 2002:a05:6a20:3d85:b0:133:f0b9:856d with SMTP id s5-20020a056a203d8500b00133f0b9856dmr15561404pzi.17.1696772392487; Sun, 08 Oct 2023 06:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696772392; cv=none; d=google.com; s=arc-20160816; b=on3xR3OVCCvaL5wVzoag0HWtoW32Hity32sajSL1gUOBRgUjUKVQPqwj9AoX1K94Fj whc3C2zb5gL4HYwsVCLfqMjJN2ecpmrh1wGlbFGnRXv8PjHRcjwQQdt9fOoDqmg9ql3a BS8ocMe6NMSyOMP+kCU1dpZ53Vryjs7Dk/r9zMkuh4J5PGqjj6fiHag32RaxegPXy1HF ASXLNohY9s5+fdlQcePVgfzHwr53zzzSOHM9zEJRNAyuXzFeW0ajwdkbYY9euEASycDe MkfNzHhGLYkhebYZ+aetsfexMpKawtH13KVyvrREB/Qbuikq9kVlOHN1/niFUT5SnohF 3i0A== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=IBXkYS6fQ5HNeBmYBLasOhlEeE8uByHUo5jMn0E96xE=; fh=e+QVSRLHJFZOJden4SsPYiQ/aNDYGD0MdcUxARBoEIg=; b=cieWPI6vjWY52CWdQHt3cQj8LREj8aC15xBZn4RRCP+NA6164Muz+MNlZmk+TVtLj+ XvA74moRzgslTS7hOwST9650JRnW/VOiV7cVrNtlCsLg1LDAUxrr/BHqzlgPhOZgkJu+ fzlDSLc+QfCqSjSCxtq79YN9GEjhWVTQd032PGd6QUzSIa+UEvUU5ehsoF0fHXwxFgUS /g+wdHfNuiJfqCe1I1kgwttAyIzzIOmyzJ1rzPjzAB/xJmJOAEO71aKltN7vR+/9AkGh DM3l9MUzoPlXCXzNSQ3lgYjnKy+p9IdTFwvkEXh1RUFYDJUndILitoqaBEeGnohm+MBS LGGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=m0v2eknn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s8-20020a637708000000b00578cc8d2599si7600248pgc.211.2023.10.08.06.39.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Oct 2023 06:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=m0v2eknn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 354FF80B6307; Sun, 8 Oct 2023 06:39:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344810AbjJHNjf (ORCPT + 99 others); Sun, 8 Oct 2023 09:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344799AbjJHNjf (ORCPT ); Sun, 8 Oct 2023 09:39:35 -0400 Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2BEAD6; Sun, 8 Oct 2023 06:39:30 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 66CEB60004; Sun, 8 Oct 2023 13:39:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1696772367; 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=IBXkYS6fQ5HNeBmYBLasOhlEeE8uByHUo5jMn0E96xE=; b=m0v2eknngWwC18FYvgvuMt5MCXsPIUxJRHrztGTLfHwS+Z1Ev3pCEv42Z8kGipcBBTr03q j9B1DeYbgnQfE5Xz0vCrqj/eDoZmzf9AutJqKT7VNL5t3b7489ikRDP36zjga6RXO3Wk3S e0Yjcl34c+c0t88shUPRUgBlI1bBNvs4Xo4RrIJqXC3pTXtWwGLuZJQ+seSmb3mmR/5pz3 /s7Bifn5Y5EyRJHzpVw4WJ1u4dWdvkajnkdhapk7E10HqTjqCan4tlLmzvWl3629YWicbs mXjGCGCTrhY4jCdknbMfbBSUR/tyr3wh/NsMAlkkWgROrTtefrVwoMaezgCUeg== Date: Sun, 8 Oct 2023 15:39:19 +0200 From: Miquel Raynal To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Michael Walle , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle Subject: Re: [PATCH v12 2/7] nvmem: Clarify the situation when there is no DT node available Message-ID: <20231008153919.5b8e2562@xps-13> In-Reply-To: <2e3ea6a4e63e0c6bebf4c18b165250e5@milecki.pl> References: <20231005155907.2701706-1-miquel.raynal@bootlin.com> <20231005155907.2701706-3-miquel.raynal@bootlin.com> <05cd4592d0cfe0fb86aeb24db01de547@milecki.pl> <20231006183229.51cd8e60@xps-13> <2e3ea6a4e63e0c6bebf4c18b165250e5@milecki.pl> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 08 Oct 2023 06:39:50 -0700 (PDT) X-Spam-Level: ** Hi Rafa=C5=82, rafal@milecki.pl wrote on Sat, 07 Oct 2023 18:09:06 +0200: > One comment below >=20 > On 2023-10-06 18:32, Miquel Raynal wrote: > > rafal@milecki.pl wrote on Fri, 06 Oct 2023 13:41:52 +0200: > > =20 > >> On 2023-10-05 17:59, Miquel Raynal wrote: =20 > >> > At a first look it might seem that the presence of the of_node point= er > >> > in the nvmem device does not matter much, but in practice, after > l= ooking > >> > deep into the DT core, nvmem_add_cells_from_dt() will simply and alw= ays > >> > return NULL if this field is not provided. As most mtd devices don't > >> > populate this field (this could evolve later), it means none of their > >> > children cells will be populated unless no_of_node is explicitly set= to > >> > false. In order to clarify the logic, let's add clear check at the > >> > beginning of this helper. =20 > >> >> I'm somehow confused by above explanation and code too. I read it = =20 > >> carefully 5 times but I can't see what exactly this change helps with.= =20 > >> >> At first look at nvmem_add_cells_from_legacy_of() I can see it uses= =20 > >> "of_node" so I don't really agree with "it might seem that the >> pres= ence > >> of the of_node pointer in the nvmem device does not matter much". =20 > >> >> You really don't need to look deep into DT core (actually you don't= >> have =20 > >> to look into it at all) to understand that nvmem_add_cells_from_dt() > >> will return 0 (nitpicking: not NULL) for a NULL pointer. It's all made > >> of for_each_child_of_node(). Obviously it does nothing if there is > >> nothing to loop over. =20 > >=20 > > That was not obvious to me as I thought it would start from /, which I > > think some other function do when you don't provide a start node. =20 >=20 > What about documenting that function instead of adding redundant code? Yeah would work as well. But I will just get rid of this, with your other patch that solves the fact that of_node will be there with mtd devices, it's no longer relevant. Thanks, Miqu=C3=A8l