From patchwork Mon Oct 25 09:41:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 12581205 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DD7CC43219 for ; Mon, 25 Oct 2021 09:42:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5908A60FBF for ; Mon, 25 Oct 2021 09:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbhJYJoX (ORCPT ); Mon, 25 Oct 2021 05:44:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29389 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232747AbhJYJoJ (ORCPT ); Mon, 25 Oct 2021 05:44:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635154906; 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: in-reply-to:in-reply-to:references:references; bh=5Y+tV0wpFMNaWRVHcECLpmjbJNw3wdfX9vlYyaF0S+8=; b=DKgQMNAIlvfth95xCJU5F0CAsub2QYVvgtHwRWGSmd8pTooFzTMEjAHppUsrZaR1eyyeRy lI7QmLccwbIX27oVHEfkPaWFDkYEzqrPkgupj2ulIvtyJ0/6KpF+cdKEQtq6Gro5wovgAF 3GjfjbtKy/0+XBiWEKFdOZUXgRGrXS8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-187-KhoQ-SVqP-eadeYoesZ8mw-1; Mon, 25 Oct 2021 05:41:43 -0400 X-MC-Unique: KhoQ-SVqP-eadeYoesZ8mw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6FBC2E75; Mon, 25 Oct 2021 09:41:40 +0000 (UTC) Received: from x1.localdomain (unknown [10.39.195.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC0C060BF4; Mon, 25 Oct 2021 09:41:35 +0000 (UTC) From: Hans de Goede To: "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 Cc: Hans de Goede , Len Brown , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org, linux-clk@vger.kernel.org, Wolfram Sang Subject: [PATCH v4 02/11] i2c: acpi: Use acpi_dev_ready_for_enumeration() helper Date: Mon, 25 Oct 2021 11:41:10 +0200 Message-Id: <20211025094119.82967-3-hdegoede@redhat.com> In-Reply-To: <20211025094119.82967-1-hdegoede@redhat.com> References: <20211025094119.82967-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org 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. Acked-by: Wolfram Sang Signed-off-by: Hans de Goede Acked-by: Rafael J. Wysocki --- 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 546cc935e035..71eee5bc17ab 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;