From patchwork Fri Nov 10 07:55:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 163910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp1308081vqs; Fri, 10 Nov 2023 10:37:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbyyA12yQ3DO6rK8WetpVRDyVsM/0ZkRUc5uzvMWzCJyFldOMr9TPpG47JxCYCyjxGyorD X-Received: by 2002:a05:6a20:1443:b0:185:b9d8:9882 with SMTP id a3-20020a056a20144300b00185b9d89882mr2477003pzi.25.1699641429219; Fri, 10 Nov 2023 10:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699641429; cv=none; d=google.com; s=arc-20160816; b=FVcL10icgInJcGZ52hXpPODqdyQrFhphlZ1uQLZTZnT4wMgL2MEXPK6ifwLbrgL/S0 e3EW4kvapePDZrUamWYbkvTXKSvx2uY0tlzHRZQXk6cO/OgZoq5lqpU5WwLv8dK5P9+E mREK1oV1mPCuprChnSaxQ7ojL74wx1BA4GTfz1l1obRtYQpts2g3/Mn5/3lO13o6G4xP PPB7bmnR5FMt0YMYoZEPZsObEDvjAC2zZkJWy/+8mWH47as2kELTmruzlOyv2Xe3SIGA bZORSssp2JsCx/kbOXYTO7hQsEduZfIrDBNG1r+6iYt3KU0X6H3FvVX5EBZ7Uh9MRNOI A+Jw== 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=21zxqA6JvOISJe3ZnIEum9hlx3V56G+DUdHtSQWR7rs=; fh=YQ+3yFO0Fo6peIMEqgrS60vnAE3S69xOrXlvAB5tsxM=; b=L0NV23JPdc533W9YfgzM8FALeiFuyzwD1uCT7jhJ9A9wSLrPqlA/utZ4S265iB1qhZ Awk4qZVp/th4UnHa6hBBIKZQ/Eqzuzk7LpbMJAK8C/CdYAKQ3ti1XgLj9lprwT4BOwAZ EWlUi6scgkOSawohWOhYBeOsCl7TGdVPnalg2GwAzqsCmSCt+Q5SxkMH95KnhEhiY7te AzpgQm1ZVtd/2MF/AofBsndDAAG9hJdLHwNwD6APFVaLnq0VwjtSGUyfDLMTUyzxuGZs 5FXnV4JVtEAf8vwDoBH+8TyQmeJoNbNTWWe2XhgMPJWOdjo4YzsaD5SqgFbbsAU1L/T0 YugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="pQ/je16H"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i6-20020a17090adc0600b002800ab6f85asi4707965pjv.119.2023.11.10.10.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 10:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="pQ/je16H"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 180B6809861E; Fri, 10 Nov 2023 10:36:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346080AbjKJSdH (ORCPT + 29 others); Fri, 10 Nov 2023 13:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345242AbjKJSbw (ORCPT ); Fri, 10 Nov 2023 13:31:52 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8FB48852; Thu, 9 Nov 2023 23:56:10 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPA id 0C9FEC0004; Fri, 10 Nov 2023 07:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1699602968; 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=21zxqA6JvOISJe3ZnIEum9hlx3V56G+DUdHtSQWR7rs=; b=pQ/je16HBVbd/gOPr59KjOR7ROOIaIhTdMBkwKs3pXBk+z4UEUgknISSAGg8L5sf8C9vuE d+nobqWiH5Z+4s7NqxSevsfUxjuEARNQpFys1kpjyrMDfLQnFcNhIs1zccLYx80xGnT2Ik hrGtfcBfYBA1hf3Dnqq/KsWLY7MHmYRNGunwk6kABouSHj3cUe0KirI5PJDGHnwGIMjITV tXNg2xXHQNGzJBCF1Il0vAWEfhp306FiyC+nTMw8XqFERScYWcMYf0EFk+LnKdpLsQgE7B Ap9vHh72yAXAVKggWCt2DxQ/D1JTRceSa18oneVHpNc+2fTctiH3vE+aKtLjMQ== 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 1/1] driver core: Keep the supplier fwnode consistent with the device Date: Fri, 10 Nov 2023 08:55:49 +0100 Message-ID: <20231110075549.702374-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=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Fri, 10 Nov 2023 10:36:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782203211537462856 X-GMAIL-MSGID: 1782203211537462856 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 --- drivers/base/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/base/core.c b/drivers/base/core.c index 4d8b315c48a1..17f2568e0a79 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2076,6 +2076,18 @@ 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 (!sup_handle) { + dev_dbg(con, "Not linking %s - fwnode NULL\n", + dev_name(sup_dev)); + goto out; + } + /* * If it's one of those drivers that don't actually bind to * their device using driver core, then don't wait on this