From patchwork Mon Nov 13 13:30:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 164488 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp1201769vqg; Mon, 13 Nov 2023 05:31:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IE29jG4Y8EImr12r28gVuRQp6aWITQBnahXYOQaykSKD861cj4pLx4ddbNl/iLPAcENH5N9 X-Received: by 2002:a05:6a21:329f:b0:155:5c28:ea74 with SMTP id yt31-20020a056a21329f00b001555c28ea74mr4649682pzb.12.1699882309710; Mon, 13 Nov 2023 05:31:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699882309; cv=none; d=google.com; s=arc-20160816; b=npedIZMl3i/nOUTLNDVAGCPaLbwcuZUfCbkxPMukz7d67OvAA1SB1a+lZyAYLLrMWP rsRQw6UaGoxDv80yIykM5qlE23E6GpS5ygZDa0rM40sE/dDse0MlGUwZREpEAOdkkn1Q P6s5verntLkBT7lt/oasQIFd89u/+lmkUyvu3Ln84q0Ye+8WEa5C9+e4QlkDjFt7sGgp jGnk8EVzMLpFzofCHzDuEg/QMK8LRXeqlKJ2PMJI2drhI97AdTnWK0UDbpkuxageh0BI mEs4JT2n2UNXvpG3wPa/qgoRNzSV5NC9WMFHKQRyvbtKoBzMXja8yUixfTisCH50U+Oi FMhw== 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:dkim-signature; bh=Ii8+etSPHzTAe8bcWFf2RWURPKpC4OnFERtK3d3IciM=; fh=YQ+3yFO0Fo6peIMEqgrS60vnAE3S69xOrXlvAB5tsxM=; b=JdqJdzsu1Tvq3Kp++B+mmbeqDxNKaj9Il/njjDAtwocDWACX/Sa2df0PzzIPumECrc kBY3OvHpuEljZFKYNF34qaKe8t3npql6xfnW9MtlNg37ygovTDtstu+5QMAyYSTtrTHd 4B8A5lP+0tgtodbQCXPoTB1U6CXLp56VVtDSEDsiRURsuuF1CN01bk06TatWxaDIaLkA BHiaCx1c3FqwQQkpEMFmzxxfVePqpEDI/tYv0BhEqtJgrdaE+YbUyFng4PDjB4xqIDZL 4eb5BpPGkA+lRBxUCfVk0jAy5ak7BgaARq7BELJrDuK3RhRTZzEhj5JbvzbbIhJC697c YOiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fR+ULvXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f21-20020aa79695000000b0068a590d803csi5379901pfk.361.2023.11.13.05.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Nov 2023 05:31:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fR+ULvXq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 45F9B806CC21; Mon, 13 Nov 2023 05:31:00 -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 S231191AbjKMNay (ORCPT + 29 others); Mon, 13 Nov 2023 08:30:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjKMNax (ORCPT ); Mon, 13 Nov 2023 08:30:53 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43627D7E; Mon, 13 Nov 2023 05:30:49 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPA id 19D1AC0005; Mon, 13 Nov 2023 13:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1699882247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Ii8+etSPHzTAe8bcWFf2RWURPKpC4OnFERtK3d3IciM=; b=fR+ULvXqo6//waqmCqREZxa/7vwOQ8eUTpiQRwdogv0NjGQvN0cjQWy2zM5EYQONGVnYhb d4xAkj94uHYrxWZuNeiaqKhukFIMx4T3jaKH9aBmClx6KuFs0OSXZX/YtHaGIaVQFlV54B pU8PmuTpcSWqc7tiiLVGWzC2C6yc4urbYNn6pZ5K07Dw2uijkEs+f44nljE0UB2MKOZwqg e2jTxa/V7hsDzpDy1rPVXnUAOv6di2oR1LyYVmw9ZGLjFU3vEZQKT6RY/qQvwuDywbB07Y wULgHhYPKjA93troZkRyir3ilPFoADmdLS0tGXv3zgbJtPJu4EhWAu2K6wGJBA== From: Herve Codina To: Greg Kroah-Hartman , "Rafael J. Wysocki" , Saravana Kannan Cc: linux-kernel@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni , Herve Codina , stable@vger.kernel.org Subject: [PATCH v2 1/1] driver core: Keep the supplier fwnode consistent with the device Date: Mon, 13 Nov 2023 14:30:44 +0100 Message-ID: <20231113133044.55257-1-herve.codina@bootlin.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-GND-Sasl: herve.codina@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,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, 13 Nov 2023 05:31:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782203211537462856 X-GMAIL-MSGID: 1782455792709770925 The commit 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links") introduces the possibility to use the supplier's parent device instead of the supplier itself. In that case the supplier fwnode used is not updated and is no more consistent with the supplier device used. Update the fwnode used to be consistent with the supplier device used. Fixes: 3a2dbc510c43 ("driver core: fw_devlink: Don't purge child fwnode's consumer links") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina --- Changes v1 -> v2: Remove sup_handle check and related pr_debug() call as sup_handle cannot be invalid if sup_dev is valid. drivers/base/core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 4d8b315c48a1..2f6a21b908ec 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2076,6 +2076,13 @@ static int fw_devlink_create_devlink(struct device *con, sup_dev = get_dev_from_fwnode(sup_handle); if (sup_dev) { + /* + * The supplier device may have changed and so, the supplier + * fwnode maybe inconsistent. + * Update the supplier fwnode + */ + sup_handle = sup_dev->fwnode; + /* * If it's one of those drivers that don't actually bind to * their device using driver core, then don't wait on this