Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp199850pxu; Thu, 22 Oct 2020 20:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydh3KrgSskeA7dsmfmduMYqGl6udlYVVzROIZMyIeejFcrSYIUTZs0+mZh7I4eeyyAwMzi X-Received: by 2002:aa7:dcc7:: with SMTP id w7mr369934edu.80.1603424162792; Thu, 22 Oct 2020 20:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603424162; cv=none; d=google.com; s=arc-20160816; b=yn680gtoxgggpaxma9qNSED9cuw1yW+Jg4auQMBJj9U6qMatNyzDCGYitWaUqw8ZSw nuOCx1gv+/qngsq3GUVWPlZhAnhLBcwwKpjHogChzBOW3XZ/Ars9TYLRz58sYAhJDtWh ZOaqJActOcqttkVDn3+NrSkkZX9T16bBXIip4kXyBEZwg9LqhRXNoW41GWf/zsrAsDB8 J2guZBxxuHh/j3i/z/BEg6AL+BXNDlQDqG8BBEGlyvVr+BbTBaYI2DrEr/U+z+XVtenF +4tHpSE5jzzC9l0fpbbJEbioF5AzGsn+Y/km+jhVEkdjFoaPW5q0re/T8CTzLwTqlv4r OHUw== 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:ironport-sdr:ironport-sdr; bh=/XOd2OyqU+EGoAUD75M44DUt5dujFCmZE20sVI1yI90=; b=QMHxfwNTBlg1a/24NBYC3ExbO6bFhXYy9X4Acz4XlM72X+SUcQ9lcN68pFzMUKZyT6 oMNnS+9l9gEUKrB0i0SBik9CSo5BKmGl0YfyVRcSzcgIBvb4g8kmqxtl/60uKDw1xKtZ s405CoeF9mY6YcPwaT//FPGgZUEB6ew6mZBa1w1y14c7kiibGfzUbOMJrdWvQDhUGl4Y X67En2vWt+biWy2V/WW2w9cg+hRI7PrVLfcVvGYyV8Dl3vgieJvEgW3nhObQworpAENg vPT3dFUAKJ4VL25SCWBJ1pEmr41KZsv4Aup7zPWteVJHLyDI/QF5XOBcW05BVmXDCZpa iQdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm22si13515edb.382.2020.10.22.20.35.40; Thu, 22 Oct 2020 20:36:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S369727AbgJVSlG (ORCPT + 99 others); Thu, 22 Oct 2020 14:41:06 -0400 Received: from mga12.intel.com ([192.55.52.136]:27682 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508547AbgJVSlF (ORCPT ); Thu, 22 Oct 2020 14:41:05 -0400 IronPort-SDR: d5beLKTj8r6NGfBCzDUJhXFWmxB0g+veuvIvl2A4rKIu+poV+yPfZIP/SGL/Ony3EZ+FQK9M41 sBiQyWxZPkDw== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="146868811" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="146868811" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 11:41:04 -0700 IronPort-SDR: NCBHGHbo+kfepfXk4T6LK4GcCSAFHyc6OtB5xm31DPHZOES2k00d5BlkCU0ygBQjmNl9CrAQk3 loZRUJI2o2SA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="302516299" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 22 Oct 2020 11:41:03 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 44DA811E; Thu, 22 Oct 2020 21:41:02 +0300 (EEST) From: Andy Shevchenko To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Saravana Kannan , linux-acpi@vger.kernel.org, "Rafael J. Wysocki" , Heikki Krogerus Cc: Andy Shevchenko , Ferry Toth Subject: [PATCH v1 1/2] device property: Keep secondary firmware node secondary by type Date: Thu, 22 Oct 2020 21:40:59 +0300 Message-Id: <20201022184100.71659-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Behind primary and secondary we understand the type of the nodes which might define their ordering. However, if primary node gone, we can't maintain the ordering by definition of the linked list. Thus, by ordering secondary node becomes first in the list. But in this case the meaning of it is still secondary (or auxiliary). The type of the node is maintained by the secondary pointer in it: secondary pointer Meaning NULL or valid primary node ERR_PTR(-ENODEV) secondary node So, if by some reason we do the following sequence of calls set_primary_fwnode(dev, NULL); set_primary_fwnode(dev, primary); we should preserve secondary node. This concept is supported by the description of set_primary_fwnode() along with implementation of set_secondary_fwnode(). Hence, fix the commit c15e1bdda436 to follow this as well. Fixes: c15e1bdda436 ("device property: Fix the secondary firmware node handling in set_primary_fwnode()") Cc: Ferry Toth Signed-off-by: Andy Shevchenko --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index c852f16c111b..41feab679fa1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4278,7 +4278,7 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) } else { if (fwnode_is_primary(fn)) { dev->fwnode = fn->secondary; - fn->secondary = NULL; + fn->secondary = ERR_PTR(-ENODEV); } else { dev->fwnode = NULL; } -- 2.28.0