From patchwork Wed Sep 19 19:15:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10606363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B2015112B for ; Wed, 19 Sep 2018 19:15:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A40B529439 for ; Wed, 19 Sep 2018 19:15:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95AF72C601; Wed, 19 Sep 2018 19:15:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41B5B29439 for ; Wed, 19 Sep 2018 19:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731255AbeITAyp (ORCPT ); Wed, 19 Sep 2018 20:54:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33220 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726718AbeITAyp (ORCPT ); Wed, 19 Sep 2018 20:54:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4656685A01; Wed, 19 Sep 2018 19:15:26 +0000 (UTC) Received: from shalem.localdomain.com (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8ABB019481; Wed, 19 Sep 2018 19:15:23 +0000 (UTC) From: Hans de Goede To: "Rafael J . Wysocki" , Len Brown , Andy Shevchenko , Mika Westerberg , Jarkko Nikula , Wolfram Sang Cc: Hans de Goede , Adrian Hunter , linux@endlessm.com, linux-acpi@vger.kernel.org, linux-i2c@vger.kernel.org Subject: [PATCH 1/7] ACPI / LPSS: Only add device links from consumer to supplier Date: Wed, 19 Sep 2018 21:15:12 +0200 Message-Id: <20180919191518.18764-2-hdegoede@redhat.com> In-Reply-To: <20180919191518.18764-1-hdegoede@redhat.com> References: <20180919191518.18764-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 19 Sep 2018 19:15:26 +0000 (UTC) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit e6ce0ce34f65 ("ACPI / LPSS: Add device link for CHT SD card dependency on I2C") tries to add device links from consumer to supplier *and* the other way around. When the consumer gets registered the supplier is not yet registered, so acpi_lpss_find_device() cannot find it and we never end up adding the supplier link. Although not intended this is a good thing, because the device links are dependencies and if we add a link in both directions the power-management core will not know which one to suspend/resume first. I've verified through debug printk-s that indeed only the consumer to supplier dependency gets added even before this commit removes the code to add the link the other way. Signed-off-by: Hans de Goede --- drivers/acpi/acpi_lpss.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 83875305b1d4..40a8cab81cbd 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -486,13 +486,6 @@ static bool acpi_lpss_is_supplier(struct acpi_device *adev, link->supplier_hid, link->supplier_uid); } -static bool acpi_lpss_is_consumer(struct acpi_device *adev, - const struct lpss_device_links *link) -{ - return hid_uid_match(acpi_device_hid(adev), acpi_device_uid(adev), - link->consumer_hid, link->consumer_uid); -} - struct hid_uid { const char *hid; const char *uid; @@ -559,21 +552,6 @@ static void acpi_lpss_link_consumer(struct device *dev1, put_device(dev2); } -static void acpi_lpss_link_supplier(struct device *dev1, - const struct lpss_device_links *link) -{ - struct device *dev2; - - dev2 = acpi_lpss_find_device(link->supplier_hid, link->supplier_uid); - if (!dev2) - return; - - if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2))) - device_link_add(dev1, dev2, link->flags); - - put_device(dev2); -} - static void acpi_lpss_create_device_links(struct acpi_device *adev, struct platform_device *pdev) { @@ -584,9 +562,6 @@ static void acpi_lpss_create_device_links(struct acpi_device *adev, if (acpi_lpss_is_supplier(adev, link)) acpi_lpss_link_consumer(&pdev->dev, link); - - if (acpi_lpss_is_consumer(adev, link)) - acpi_lpss_link_supplier(&pdev->dev, link); } }