From patchwork Fri Nov 10 08:02:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herve Codina X-Patchwork-Id: 163840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp1287348vqs; Fri, 10 Nov 2023 10:02:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IGTyQg1ECBrrJ/c7kgpo5eF5pI0rE9WHXhp64yLUe1MA3NkA3wEt+oxq+e04L1LNBmsFzPr X-Received: by 2002:a54:4386:0:b0:3b2:f557:666e with SMTP id u6-20020a544386000000b003b2f557666emr36391oiv.19.1699639368329; Fri, 10 Nov 2023 10:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699639368; cv=none; d=google.com; s=arc-20160816; b=MjRCVbiyNy7VDea7hQDdfdv5WuD5lhYrlT3LemlDrwcq/4fB3skTEhhGT2RkbQNia0 9qr1uYzGl8GpOb0v64a0aL4w71De6iHR0CrHwPV5DMeOLjsU+VlAezeUP8eqpMtKQXeO V8CD1hkniEYEuh8/3YoxYaRxBlCBjiXb4XGuhy6K2/CzssdRv3NHbwMaCLn4/vg71n07 LI6qienQEmY694uCxywzEeqTl2wZNPCJrVfEo6K68Cy8s0AGI0Nn34IU4nVQ1Qtp1p2v kz8Ct1Cp8Q09phd33tSC0aswWQYir6P4cYdkhWJJcKH93uVpG2vJHLBsDI9kjeF59UJP 2iwQ== 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=UylwPPbht2Hmc2zuuPi5hzrxk1rL9hBKeGOaaTtVLi4=; fh=YQ+3yFO0Fo6peIMEqgrS60vnAE3S69xOrXlvAB5tsxM=; b=hU7ucZyz54r9PkKZoFdrplhyzHA2Rlov0QNxCtbFoCRfL16n+e2Oxk8OV8V+zCgiTw KWR0iCWkM56ZUksbzaiYVnU1HnC347kbV0Kh59mLqWkqenppsWbR1IeWORRFCxKDk3vH z0AsWl6fHJf88pTLJ7B8HrMLQJMQfCZk7JWLvDRb48qJ9NOejBuwS5WraVzXHVHeafhy MZQ5Z7s7byZvf5KM+a1mGcTf9f4AdzWxIyMU3F8LAYUjB3YKWM9xseQIytHikVW7B7jG 4H/128e5QMDTFCc2j5R/hPGH2FCmf5MDQgE1bF5nhCBm7Hs1vQBTgs2Xw0RvOVzqx4hB Cs4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=adNudLuy; 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 bx44-20020a0568081b2c00b003ae34a1cba6si7915111oib.29.2023.11.10.10.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 10:02:48 -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=adNudLuy; 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 B4A0E8316212; Fri, 10 Nov 2023 10:02:18 -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 S231842AbjKJSAL (ORCPT + 30 others); Fri, 10 Nov 2023 13:00:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235323AbjKJR7T (ORCPT ); Fri, 10 Nov 2023 12:59:19 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 383458A45; Fri, 10 Nov 2023 00:02:47 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPA id 3360E1C0009; Fri, 10 Nov 2023 08:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1699603365; 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=UylwPPbht2Hmc2zuuPi5hzrxk1rL9hBKeGOaaTtVLi4=; b=adNudLuyHW4/6U4RdKKgOWUCa0RyMVCDhzAvm7stVMvL7UcMUj/AS+Afg/wW/yHHQ3CEhy aoGyZFmzcld4q/WDRVnFpcLWgQnkvBXdB+SRtZ++vAfK7IkAi8xI1w6kLSnddZmNX/rCmf TLNi+SC6JYMW+ZP21vcz6Rx+gHUAhJc9GuWkhXlztr3eOyXJOpllOLmXNPNdVL8J4lxgd2 tafw4l8+m2JpM6omPHipsDCqsVpnfdmenB06qKKl7lBc4Yqt0E0O2hE6u4o2BQ8Z2EvmUo du2PNKh/ZpROAsdbOKt5O1OAeM3QniDUolQGEYn4Q9tqnbj4sDOL9VMNbeYQ7Q== 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: Remove warning on driver unbinding Date: Fri, 10 Nov 2023 09:02:40 +0100 Message-ID: <20231110080241.702999-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:02:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782201050444943101 X-GMAIL-MSGID: 1782201050444943101 During driver unbinding, __device_links_no_driver() can raise the following warning: --- 8< --- WARNING: CPU: 0 PID: 166 at drivers/base/core.c:1426 __device_links_no_driver+0xac/0xb4 ... Call trace: __device_links_no_driver+0xac/0xb4 device_links_driver_cleanup+0xa8/0xf0 device_release_driver_internal+0x204/0x240 device_release_driver+0x18/0x24 bus_remove_device+0xcc/0x10c device_del+0x158/0x414 platform_device_del.part.0+0x1c/0x88 platform_device_unregister+0x24/0x40 of_platform_device_destroy+0xfc/0x10c device_for_each_child_reverse+0x64/0xb4 devm_of_platform_populate_release+0x4c/0x84 release_nodes+0x5c/0x90 devres_release_all+0x8c/0xdc device_unbind_cleanup+0x18/0x68 device_release_driver_internal+0x20c/0x240 device_links_unbind_consumers+0xe0/0x108 device_release_driver_internal+0xf0/0x240 driver_detach+0x50/0x9c bus_remove_driver+0x6c/0xbc driver_unregister+0x30/0x60 ... --- 8< --- This warning is raised because, during device removal, we unlink a consumer while its supplier links.status is DL_DEV_UNBINDING. Even if the link is not a SYNC_STATE_ONLY, the warning should not appear in that case. Filter out this warning in case of the supplier driver is unbinding. Fixes: 8c3e315d4296 ("driver core: Update device link status correctly for SYNC_STATE_ONLY links") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina --- drivers/base/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 17f2568e0a79..f4b09691998e 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1423,7 +1423,8 @@ static void __device_links_no_driver(struct device *dev) if (link->supplier->links.status == DL_DEV_DRIVER_BOUND) { WRITE_ONCE(link->status, DL_STATE_AVAILABLE); } else { - WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY)); + WARN_ON(!(link->flags & DL_FLAG_SYNC_STATE_ONLY) && + link->supplier->links.status != DL_DEV_UNBINDING); WRITE_ONCE(link->status, DL_STATE_DORMANT); } }