Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2634198pxb; Fri, 8 Oct 2021 11:43:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsPMungaTBBtaIp814P2Oel/SxS7QmNhLRU4N2T042oRthkNJDIEcwwn6wAEYBeCgIUKIt X-Received: by 2002:a62:17d3:0:b0:44c:6022:9428 with SMTP id 202-20020a6217d3000000b0044c60229428mr11468111pfx.65.1633718594666; Fri, 08 Oct 2021 11:43:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633718594; cv=none; d=google.com; s=arc-20160816; b=eMIdyX7JFzhuORwwJEYBUhrcocKhs+Iz+NoZ1IgcuPk7xOllFvXQVnO9YAAGFEEt0X NxijW0RK4bViC4NJN9vRtSyABwGo8gOQw1fwKnsVrfExVfRhyFFCnZ/FB/S4X1JYfgn+ ihOiM8WYgLsmlCZESmlfnDZv+TufHWLlNo74ORmfkI+KcH/P5gdTrfQh6YON4wSmqTcL VKUabiMCYbKMmBOkBT4M8gMXzGkt5OLm77+10CRE9zNRgNM9ubVOUlbshZKx1rfSAlLe RWUQ9jPKS9U6NbZWFlXP15ESw5FBtc+x8ezSo/3jhKaX8L0piLACg7rqvXe3KwnWhWpi dfWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=df42BC0Cc5AVj3WgXYOODEjjQzWmpwCzETEZRM9fC04=; b=hfE008dQ6CRhyFwC4cK6vyqlxqWpoMqEOj3h2zk+toj6mfjvRpWKhngjlSvx+6MT9N 2ImEQ7BgP+kLt4IvmcxLNn355X1m146bdNM4xfxTWsRj3F0TLn7byBTM+P3Y8WOIiPPI OvpEssIIJKxa+YfGIm21KWj/vTP+Ff9Wd7oKRXmg1E9KBGQDHIiUkUJlwGgkg+sAc47H YwY3Tk4XeP8A0rjymS8TMyX/bXAJgGGREpCsfKNerOAFUuQN1YNYT8EyZZHSFah4qPcj cNOuXQK+EQpwwl0JzaU+8nnnBZ7riN6qNhQqrhNAgpJYEW7TVeZPaJRp17GyE0BJ4JIr ubBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Q3c+eR8H; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l64si4535pge.289.2021.10.08.11.43.01; Fri, 08 Oct 2021 11:43:14 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Q3c+eR8H; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231563AbhJHSn4 (ORCPT + 99 others); Fri, 8 Oct 2021 14:43:56 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:55780 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231246AbhJHSnz (ORCPT ); Fri, 8 Oct 2021 14:43:55 -0400 Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 30482146F; Fri, 8 Oct 2021 20:41:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1633718518; bh=X6pK5WZ7QQHsePVXVcQyefpC0KmEQLZeMJIq+1gqhqw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q3c+eR8HxDUKULXnjiyDdmt4OqVKzMIWw2kS2Ex95FG8QYMn/vSim/fJQcYzMtroH jRjguikOO2MQn9KC0SbQpJ40GCLNJc3xagSXQjuW/23JnjBqDb6kPN/11n0UUaGcN3 MgQimbv+Q2ggaZTAoh0TaGULWHQDYcJnypymQQAA= Date: Fri, 8 Oct 2021 21:41:47 +0300 From: Laurent Pinchart To: Hans de Goede Cc: "Rafael J . Wysocki" , Mark Gross , Andy Shevchenko , Daniel Scally , Mauro Carvalho Chehab , Liam Girdwood , Mark Brown , Michael Turquette , Stephen Boyd , Len Brown , linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Sakari Ailus , Kate Hsuan , linux-media@vger.kernel.org, linux-clk@vger.kernel.org Subject: Re: [PATCH 02/12] media: i2c: ov8865: Add an has_unmet_acpi_deps() check Message-ID: References: <20211008162121.6628-1-hdegoede@redhat.com> <20211008162121.6628-3-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211008162121.6628-3-hdegoede@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hans, Thank you for the patch. On Fri, Oct 08, 2021 at 06:21:11PM +0200, 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 of the ov8865 driver vs the > drivers for 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 regs. > > On ACPI/x86 where this is a problem, the ov8865 ACPI fw-nodes have a _DEP > dependency on the INT3472 ACPI fw-node which describes the hardware which > provides the clks/regulators. > > The drivers/platform/x86/intel/int3472/ code dealing with these ACPI > fw-nodes will call acpi_dev_clear_dependencies() to indicate that this > _DEP has been "met" when all the clks/regulators have been setup. > > Call the has_unmet_acpi_deps() helper to check for unmet _DEPs > and return -EPROBE_DEFER if this returns true, so that we wait for > the clk/regulator setup to be done before continuing with probing. > > Signed-off-by: Hans de Goede > --- > drivers/media/i2c/ov8865.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c > index ce4e0ae2c4d3..fd18d1256f78 100644 > --- a/drivers/media/i2c/ov8865.c > +++ b/drivers/media/i2c/ov8865.c > @@ -2978,6 +2978,9 @@ static int ov8865_probe(struct i2c_client *client) > unsigned int i; > int ret; > > + if (has_unmet_acpi_deps(dev)) > + return -EPROBE_DEFER; > + We've worked hard to avoid adding ACPI-specific code such as this in sensor drivers, as it would then spread like crazy, and also open the door to more ACPI-specific support. I don't want to open this pandora's box, I'd like to see this handled in another layer (the I2C core could be a condidate for instance, but bonus points if it can be handled in the ACPI subsystem itself). > sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); > if (!sensor) > return -ENOMEM; -- Regards, Laurent Pinchart