lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211008162121.6628-3-hdegoede@redhat.com>
Date:   Fri,  8 Oct 2021 18:21:11 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Mark Gross <markgross@...nel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Daniel Scally <djrscally@...il.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>
Cc:     Hans de Goede <hdegoede@...hat.com>, Len Brown <lenb@...nel.org>,
        linux-acpi@...r.kernel.org, platform-driver-x86@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        Kate Hsuan <hpa@...hat.com>, linux-media@...r.kernel.org,
        linux-clk@...r.kernel.org
Subject: [PATCH 02/12] media: i2c: ov8865: Add an has_unmet_acpi_deps() check

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 <hdegoede@...hat.com>
---
 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;
+
 	sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
 	if (!sensor)
 		return -ENOMEM;
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ