Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3680849pxb; Wed, 13 Oct 2021 10:42:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhxj4oK1si7Z2nLq/nWWBy7aZ0lAgaa8GvX0VRXnjAPo+OK/Nk1NE2VV29PN8FahgIm/QT X-Received: by 2002:a05:6402:2552:: with SMTP id l18mr1066331edb.370.1634146939113; Wed, 13 Oct 2021 10:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634146939; cv=none; d=google.com; s=arc-20160816; b=zeyV5t1V18a9MCbxmZe5nfan6t8o6QVJDM0DR1mftqr6sR0mqjMuqfdIl4fIO3ZTj7 r/qM3iAa5+Tu1+jE067TWml1WjIp99Rmp8iAOn/exoCHQ5XX6J1pY0ugkLH96sHe+Fcm pf/3SmIxp51IGszl/IRXGVWTQa3UXSrB+f6nYGhRUd4ONaAMBZh5qcr9oV5L4iaGOMAH U51wWbzvhMo/cQJsCYJwDcCPOotJrGOO17pAFySFYU2h7RrjAniBJ0CZJhw60fod943u gcWvELTpL4FLlPzib17109R5xeje4TwN+7UMh5T/oqSq4VJP94iqC1zmRrEkEue5KmBH dArg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=b4kDTrwLJFhbJUtgSMv9e6E8tfp7/gGalPU4LhmCAqg=; b=Bdnr9nP5J9RiYawF0n2taIvGPOAfjvvWnfdIZKoEFSdpjZA++4tkttsyodfHppXDdh s03JShhVbUeL6fz00lbnC9e3topBsP4FO5aJlOFUmEaAKtByGOU4ZnqoYKrxHRQbj1RP 6484wph7eY+PhB72dqUjnB+24E6sq9WD83s+gW/5ILSZqBuIiq71TEd4HRFMtljJR6On Eo+QHVL0jP8yfXbMrX2tQE2lkFkawz2IQcUUAXNbZiTRgemVaRBGrvHUA6pMWgxt/HQH 8I1pdzno9ZPCezQ7RO81yuQu9iDaiMnKZG/GAxa4btvTkGYALQRbFHkB4tY6+v+85zhp Xt1A== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 16si373463ejj.116.2021.10.13.10.41.54; Wed, 13 Oct 2021 10:42:19 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233315AbhJMRl6 (ORCPT + 99 others); Wed, 13 Oct 2021 13:41:58 -0400 Received: from mail-ot1-f44.google.com ([209.85.210.44]:36753 "EHLO mail-ot1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbhJMRl4 (ORCPT ); Wed, 13 Oct 2021 13:41:56 -0400 Received: by mail-ot1-f44.google.com with SMTP id p6-20020a9d7446000000b0054e6bb223f3so4727525otk.3; Wed, 13 Oct 2021 10:39:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b4kDTrwLJFhbJUtgSMv9e6E8tfp7/gGalPU4LhmCAqg=; b=dO/7/YKbr6n2c4QMLFhu3PbooDTS4fvUqo/b5gk8Xi0Lanj3b8Y9OeJYkJPQEPBI/D kV+lCpKPp6h0nmBDpnk0JevK2mqx64CLBetWUbKkoKg5reh38K2tFAe7M7DKaldRXo6s sCeF6Zzo1Yc6FX+Tbmizum0ertRuQOKIu78mTPb4n8K+WmIJOWzdeeFrKmpciTcM+6om pu/kZPPvyTywsweUjPOnAvhAx9Pggr8bifi6yV5As7vHRi4lWml9MnHjPOUyk+ir+0dl 7fCtXan2ZLOhn1Fw7PNtCktJLxKM03lIp5CY4SQGNqAD3/1hQOv5d5ixKprS2aV5p6SC /A8w== X-Gm-Message-State: AOAM5301mQkl8S7IBAT6jJMY/XcJ10AtNXim/qmvundLo2w9xCk+afOA KdaDntA+FHCXOWtMg5mZv8/hnQdHk3LEK20VkSqTBGfb X-Received: by 2002:a9d:2f24:: with SMTP id h33mr496079otb.254.1634146792326; Wed, 13 Oct 2021 10:39:52 -0700 (PDT) MIME-Version: 1.0 References: <20211010185707.195883-1-hdegoede@redhat.com> <20211010185707.195883-3-hdegoede@redhat.com> In-Reply-To: <20211010185707.195883-3-hdegoede@redhat.com> From: "Rafael J. Wysocki" Date: Wed, 13 Oct 2021 19:39:41 +0200 Message-ID: Subject: Re: [PATCH v3 02/11] i2c: acpi: Use acpi_dev_ready_for_enumeration() helper To: Hans de Goede Cc: "Rafael J . Wysocki" , Mark Gross , Andy Shevchenko , Wolfram Sang , Mika Westerberg , Daniel Scally , Laurent Pinchart , Mauro Carvalho Chehab , Liam Girdwood , Mark Brown , Michael Turquette , Stephen Boyd , Len Brown , ACPI Devel Maling List , Platform Driver , Linux Kernel Mailing List , linux-i2c , Sakari Ailus , Kate Hsuan , Linux Media Mailing List , linux-clk Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 10, 2021 at 8:57 PM Hans de Goede wrote: > > The clk and regulator frameworks expect clk/regulator consumer-devices > to have info about the consumed clks/regulators described in the device's > fw_node. > > To work around cases where this info is not present in the firmware tables, > which is often the case on x86/ACPI devices, both frameworks allow the > provider-driver to attach info about consumers to the clks/regulators > when registering these. > > This causes problems with the probe ordering wrt drivers for consumers > of these clks/regulators. Since the lookups are only registered when the > provider-driver binds, trying to get these clks/regulators before then > results in a -ENOENT error for clks and a dummy regulator for regulators. > > To ensure the correct probe-ordering the ACPI core has code to defer the > enumeration of consumers affected by this until the providers are ready. > > Call the new acpi_dev_ready_for_enumeration() helper to avoid > enumerating / instantiating i2c-clients too early. > > Signed-off-by: Hans de Goede > --- > drivers/i2c/i2c-core-acpi.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c > index aaeeacc12121..688cc71d650d 100644 > --- a/drivers/i2c/i2c-core-acpi.c > +++ b/drivers/i2c/i2c-core-acpi.c > @@ -144,9 +144,12 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, > struct list_head resource_list; > int ret; > > - if (acpi_bus_get_status(adev) || !adev->status.present) > + if (acpi_bus_get_status(adev)) > return -EINVAL; > > + if (!acpi_dev_ready_for_enumeration(adev)) > + return -ENODEV; > + > if (acpi_match_device_ids(adev, i2c_acpi_ignored_device_ids) == 0) > return -ENODEV; I kind of prefer combining checks that cause the same error code to be returned, but this is fine with me too.