Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1185306rwb; Thu, 11 Aug 2022 18:02:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR4rUQZ/2DFDKJPF/6KXoYE0VyQ0wUsRoIEVmzbqSfDqSJBMNvi+5tcfB72vaSNwLSKuvz7G X-Received: by 2002:a05:6402:190b:b0:43d:d001:2cce with SMTP id e11-20020a056402190b00b0043dd0012ccemr1463472edz.326.1660266176696; Thu, 11 Aug 2022 18:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660266176; cv=none; d=google.com; s=arc-20160816; b=IrlwUgHVV8A1OWNh7JlGdNqDgWw9ZbUT5BKLxfsOl5Fisc1lF+okdkKYUKHbfXjoTU tsdraQ2LPUFDloSoqN0HM14c5QSgIc15SMQAlCvrzHZo9pqPBDsNMoieQPTQbgRJsLaA GGkMddjXN0aCJABge2nryjupKLR8RNzCBJ3B1TKMupHeWg0lJyYMYqsV/b+C2YmQXj0D I3kolnviBGHlrbD4bV7RavZoRTnNU9xfi/D1evr9pgIzercPLQFWtNt0u4YeP78YglVi HBu+2yvyfHPhpMXHUV99ARerYEPuORX2ISHdxABSlnRu3OToPv9IKxcu5nN5Zjxj+fXS yyOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=4tM10fzN8O9NGMymRYpYKK+6dgSWKL31dP1iscggUuM=; b=Dal+VrnUDzQ95bj3b+kE+9rnuin9edXzytv0NqPoVrRv31pH78o/s9O376liQqTKuv Gpzz0A1Wq9lFlljJu0974hoTN/NAlEo73QWGOoIYYT+P4bo2f9l091r+BWuKn+VnEUgQ Fs9RiesGqx1lKUHAS2bSPvox7babB5it+O46KamIV+7sGXqBK32Bz3XPfzdDl85Ef4dx tIWxHkqFdrb3tA2D4e7Xf6N+1xufiRi04HT08M/10YUhJyMY8ehA3iIw8BOWwOC2SGLH 7RBSQvY4wCto/R01WslBnakpPt8kLdDj4eXJZ2GCr5sIHpciQmbgqi0Uyjk0mnUdHz2H 79Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qDGyWHAV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x15-20020a05640226cf00b0043d88b558a9si982902edd.442.2022.08.11.18.02.31; Thu, 11 Aug 2022 18:02:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qDGyWHAV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236059AbiHLA4T (ORCPT + 99 others); Thu, 11 Aug 2022 20:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234273AbiHLA4R (ORCPT ); Thu, 11 Aug 2022 20:56:17 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CBB9AFE7 for ; Thu, 11 Aug 2022 17:56:16 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id q16so18536809pgq.6 for ; Thu, 11 Aug 2022 17:56:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc; bh=4tM10fzN8O9NGMymRYpYKK+6dgSWKL31dP1iscggUuM=; b=qDGyWHAVohAWH43cmQ7Ex2iLjlWnFhWB3gw7UN/lHvMDHc54VyGs7bkGnHD/FAk2bO 0YAS1FNu9oXVtOP+yxqoFUFTOYCDNsfm6BWeCrW6LCY2eUmFGY0wy7wdBaXogbYtY04L RRocHQva12/tHRmJWzBkjovJxvsz3FVmqiO/kskEJoIrUf+re+VXTb6EHorHB4wl8WSU h1aZUkQ8nNG/vgjqTsayoMdczqtLY+uiF7O77zsjxWgPy/4J0uyC+pQ2lHhd00NdRXiq wC/2GPrufGn84Mo7YwGwa7pRKNQSQW/+wQ6t8UsuChex/O4z5qmNT+UGpkP8qRCNgtAH mGoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc; bh=4tM10fzN8O9NGMymRYpYKK+6dgSWKL31dP1iscggUuM=; b=J8OiQo5Gy1FXkwsJJ47OZlHDgoQ2gJWeef+S4cRMDBrSV0co3S+H1bY4lFanCbinzO B5wpkPPE6dUBu9AgdHXmO2ogk7o18DDWDy2ht9AuUCYDMnLDsSeoUzyb9/LUp0liP8az zBCEo850W89qjPoGnvheMqGBXbwN5nhVE1ncE11fWWFN1fHWJmtDZsM2F5lUZioEj+ak t+bcLnF94Yk8t8GqMqaaTx9eFA8B3uKPEdzLdb1hRaDqNm4RarwxWJA5G5Y4HDdsWUZe 7jT5/LsAFy03LntxokqA8c5DG8myDzgXhGWIZfIYPdddbc5PEJlNW044GXE+rgEEj3uG cC0w== X-Gm-Message-State: ACgBeo219RC6hOsVc2NQwqpzpajuyi1N2jVhtMhxH91oyZxeFjagJFMG uGcX29x8XoyNnhFtKDhlg1k= X-Received: by 2002:a63:1751:0:b0:41c:daad:4ad5 with SMTP id 17-20020a631751000000b0041cdaad4ad5mr1246237pgx.226.1660265775616; Thu, 11 Aug 2022 17:56:15 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id i14-20020a654d0e000000b0041d043200fdsm341277pgt.28.2022.08.11.17.56.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Aug 2022 17:56:14 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Thu, 11 Aug 2022 17:56:13 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v1] driver core: Don't probe devices after bus_type.match() probe deferral Content-Language: en-US To: "Isaac J. Manjarres" , Greg Kroah-Hartman , "Rafael J. Wysocki" , Marek Szyprowski , Tomeu Vizoso , Russell King , Ulf Hansson Cc: kernel-team@android.com, linux-kernel@vger.kernel.org References: <20220811190747.797081-1-isaacmanjarres@google.com> From: Guenter Roeck In-Reply-To: <20220811190747.797081-1-isaacmanjarres@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 On 8/11/22 12:07, Isaac J. Manjarres wrote: > Both __device_attach_driver() and __driver_attach() check the return > code of the bus_type.match() function to see if the device needs to be > added to the deferred probe list. After adding the device to the list, > the logic attempts to bind the device to the driver anyway, as if the > device had matched with the driver, which is not correct. > > If __device_attach_driver() detects that the device in question is not > ready to match with a driver on the bus, then it doesn't make sense for > the device to attempt to bind with the current driver or continue > attempting to match with any of the other drivers on the bus. So, update > the logic in __device_attach_driver() to reflect this. > > If __driver_attach() detects that a driver tried to match with a device > that is not ready to match yet, then the driver should not attempt to bind > with the device. However, the driver can still attempt to match and bind > with other devices on the bus, as drivers can be bound to multiple > devices. So, update the logic in __driver_attach() to reflect this. > > Fixes: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()") > Reported-by: Guenter Roeck > Signed-off-by: Isaac J. Manjarres Tested-by: Guenter Roeck > --- > drivers/base/dd.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > > Guenter, > > Thanks for testing this patch out. Can you please add your "Tested-by"? > > --Isaac > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > index 70f79fc71539..90b31fb141a5 100644 > --- a/drivers/base/dd.c > +++ b/drivers/base/dd.c > @@ -881,6 +881,11 @@ static int __device_attach_driver(struct device_driver *drv, void *_data) > dev_dbg(dev, "Device match requests probe deferral\n"); > dev->can_match = true; > driver_deferred_probe_add(dev); > + /* > + * Device can't match with a driver right now, so don't attempt > + * to match or bind with other drivers on the bus. > + */ > + return ret; > } else if (ret < 0) { > dev_dbg(dev, "Bus failed to match device: %d\n", ret); > return ret; > @@ -1120,6 +1125,11 @@ static int __driver_attach(struct device *dev, void *data) > dev_dbg(dev, "Device match requests probe deferral\n"); > dev->can_match = true; > driver_deferred_probe_add(dev); > + /* > + * Driver could not match with device, but may match with > + * another device on the bus. > + */ > + return 0; > } else if (ret < 0) { > dev_dbg(dev, "Bus failed to match device: %d\n", ret); > return ret;