Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2553206rdb; Mon, 4 Dec 2023 00:06:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaa0zh+60GX+ForGWzdDBcxJTYjdgq+SaiYNzBRVTF1zeNa1tNr/G1835YnfCmF6VRhSaX X-Received: by 2002:a05:6358:7e8a:b0:168:e8f8:c5cb with SMTP id o10-20020a0563587e8a00b00168e8f8c5cbmr4241447rwn.0.1701677179439; Mon, 04 Dec 2023 00:06:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701677179; cv=none; d=google.com; s=arc-20160816; b=fR1sz0Q9TXpGVjiqz3c62tt8L0DENx9fi4Q7V+SevnTQwBoPbnJaUKUvkIa7+1WwCY 9Nn4EcyvxFwdDgePzwzvEwsvCbuF1ZKXLi+99qjcIZ+nox/PMIZVZwrgMzf9VSzz0J2c EKOw5VZLnsqEGe6uTn+g1M8uzFqUIpO2boCXi7Mhtq5UnyJnbJZdcadEzal7c5+l4tqO WDYGTqctYzznhqiJqqMtNokQ52IjnR4Ayb2jBSufFN4R6lKICpj7b4jaobC1YTGmX4yS c/MNEn/2rTA/caV52KWw0+4WATxbbmecqcBZk36lN0XESUCAiaQ18L5WmlIEeadmoU1c KDYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=mQmyeYAKXR5sNCK52r1a6ZEMHQE3SqWqGZ+6/p6FiCQ=; fh=Fa/E5EnbUOZ83hvaxZ6/772HD84TK9lOqsdi0ORdVOY=; b=uADuDmQhoc+kC8bzedlkjWSOjx3JeM1sB54TyL6aDKhD0uk6nUjCpovD+4LpeV7v46 rOz6W/x5rsbg9BjjS+NgqHYwjpxhxmR4asulS4oXznOMKpIJOxsfASaPZdPbzqu6okSH cRFJ45N6hPWEzJYG0zPsuwdksor0PXnZGpa7nNS4ZT6urUQlZ83WV+a0e8WUljA+WrCq IQ8gnq4hFnj01emo3lBzrmP3qyrUkAKO8lwT9Ipj8s+e1NHP4pR9mZ+ma8eCLJvqyctV qsWBdHsFlpvMjzmi9pz2h9AaytDw7PrWpl5RuUhjafCfXAnbj088WI590XKlYHh59D4w cm6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=j6oD8z3R; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cm14-20020a056a020a0e00b005c679836faesi2445191pgb.785.2023.12.04.00.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 00:06:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=j6oD8z3R; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F0097805DC1C; Mon, 4 Dec 2023 00:06:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343786AbjLDIGA (ORCPT + 99 others); Mon, 4 Dec 2023 03:06:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343872AbjLDIFr (ORCPT ); Mon, 4 Dec 2023 03:05:47 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8A8AF2; Mon, 4 Dec 2023 00:05:49 -0800 (PST) Date: Mon, 4 Dec 2023 09:05:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1701677147; 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: in-reply-to:in-reply-to:references:references; bh=mQmyeYAKXR5sNCK52r1a6ZEMHQE3SqWqGZ+6/p6FiCQ=; b=j6oD8z3Rpoh+gYRI+/mo1ZjPafwzAfoW2xwyBrMGZNjaYQ0WtmxrIKKX3lymOmKdJX5grg lK/tz7LDqaTaobI7uhv1JlMDz8qty4Je0cfg56c6z6o1dMKn5MgF4kWUefF5w6TG6um+4j T0R22j7B40umPJk1kBvSvYypBxFj6pPvUGrXz8+CX8yGvwgUvBYvkG3WOapmwF+5lv2qZt 2t7DB56V5AExSE8bStkUB7BmWVsz+d/+gOEd59sbIAijz987Bfg9qu/d8yleyQmvjArUh/ 2nMMj9EWuTj1br7R8Y2SSifIf1tVz9xOw6U1TwiD6oMxek9MzuzpTGbwrJGFgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1701677147; 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: in-reply-to:in-reply-to:references:references; bh=mQmyeYAKXR5sNCK52r1a6ZEMHQE3SqWqGZ+6/p6FiCQ=; b=Oru0SiJ3hwLxBodXkETHIzVPdNq176mAy0HkpfNpAr6d3Q3ueQUnIXN4xVb0dU3G1gVWts EdWb+Kfw5z60tQCA== From: Nam Cao To: Emil Renner Berthing Cc: Emil Renner Berthing , Jianlong Huang , Hal Feng , Linus Walleij , Huan Feng , Andy Shevchenko , Drew Fustini , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 2/2] pinctrl: starfive: jh7100: ignore disabled device tree nodes Message-ID: <20231204080543.C8LyBqTM@linutronix.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 04 Dec 2023 00:06:18 -0800 (PST) Hi Emil, On Fri, Dec 01, 2023 at 03:28:27PM +0100, Emil Renner Berthing wrote: > Nam Cao wrote: > > diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c > > index 530fe340a9a1..561fd0c6b9b0 100644 > > --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c > > +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7100.c > > @@ -492,7 +492,7 @@ static int starfive_dt_node_to_map(struct pinctrl_dev *pctldev, > > > > nmaps = 0; > > ngroups = 0; > > - for_each_child_of_node(np, child) { > > + for_each_available_child_of_node(np, child) { > > Is this safe to do? I mean will the children considered "available" not change > as drivers are loaded during boot so this is racy? I think if node removal like this causes race condition, we would already have race condition with node addition too: "what if the nodes are added while the drivers are being loaded?" At least with U-Boot, the device tree overlay is "merged" into the base device tree, before the kernel even runs, so no race there. I don't know if there are any cases where the device tree overlay is not guaranteed to be applied before driver loading, but those cases do not sound sane to me: they would cause race condition, regardless of whether nodes are added or removed. > Also arguably this is not a bugfix, but a new feature. I'm not sure myself, I haven't seen official documentation/rules about this. But many people do consider this to be a bug: "Though you can add/override 'status' with 'status = "disabled";' which should be treated very similar to a node not being present. I say similar because it's a source of bugs for the OS to fail to pay attention to status property." - Rob Herring [1]. "Linux has widespread use of the "status" property to indicate that a node does not exist. (...). Expect efforts to fix the kernel code to respect the "status" property." - elinux.org [2]. And I do agree with them. When someone write a device tree with some nodes with "status = disabled" for whatever reasons, clearly they intend to exclude these nodes. Though I must admit that I am still quite new, so please correct me if my reasoning/understanding is flawed. Best regards, Nam [1] https://lore.kernel.org/lkml/CAL_JsqLV5d5cL3o3Dx=--zGD37c5O09rL9AXyRFmceTfBHt3Zg@mail.gmail.com/ [2] https://elinux.org/Device_Tree_Linux#status_property