From patchwork Thu Apr 28 11:10:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 12830504 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93E25C433F5 for ; Thu, 28 Apr 2022 11:11:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345431AbiD1LOQ (ORCPT ); Thu, 28 Apr 2022 07:14:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345450AbiD1LOP (ORCPT ); Thu, 28 Apr 2022 07:14:15 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC66822285; Thu, 28 Apr 2022 04:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651144260; x=1682680260; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=StGSaSQuy2V6GyOeOth2NP+ywOMsMkMTCUwknyBndeU=; b=icsMHYL16hRmrqz6a/jryn4S2dUmgc/6oDqLf12yO3HvJCR97/dmj18F KzW3fTiwgVsu2FzqBf19CHT11bluz0SnfRHyX7yruxuY1hxs9KhcYOF/+ JqPjFQ499kZ85ERooEOPNItaO4Za4zdFt3F6lzV16s+g4nZ3LBXHpLCdz KLs60HGHI8aUtpTlogQpfgAWi1VlmIaszr7/Vux/RDVQdVjyhNepCkSK7 Kdrus3m3cewtFvvBZ43ErBUBSGEiKM2rD2sQEBTZjzVCeV81pJPLFaYyg LpnD8hpp8pUB6JuoYUErF8eH9deSuTb3hqByzl3k6BvTj/MPZSD092KT4 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10330"; a="291414542" X-IronPort-AV: E=Sophos;i="5.90,295,1643702400"; d="scan'208";a="291414542" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 04:11:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,295,1643702400"; d="scan'208";a="706011959" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 28 Apr 2022 04:10:58 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: Felipe Balbi , "Rafael J. Wysocki" , Mathias Nyman , Andy Shevchenko , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] usb: core: acpi: Use the sysdev pointer instead of controller device Date: Thu, 28 Apr 2022 14:10:55 +0300 Message-Id: <20220428111056.3558-2-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220428111056.3558-1-heikki.krogerus@linux.intel.com> References: <20220428111056.3558-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The controller device (hcd) does not always have the ACPI companion assigned to it at all. We can not rely on it when finding the ACPI companion for the root hub. Instead we need to use the sysdev pointer. Signed-off-by: Heikki Krogerus --- drivers/usb/core/usb-acpi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c index bb1da35eb891e..d4dcaefd0ea40 100644 --- a/drivers/usb/core/usb-acpi.c +++ b/drivers/usb/core/usb-acpi.c @@ -205,8 +205,11 @@ usb_acpi_find_companion_for_device(struct usb_device *udev) struct usb_hub *hub; if (!udev->parent) { - /* root hub is only child (_ADR=0) under its parent, the HC */ - adev = ACPI_COMPANION(udev->dev.parent); + /* + * root hub is only child (_ADR=0) under its parent, the HC. + * sysdev pointer is the HC as seen from firmware. + */ + adev = ACPI_COMPANION(udev->bus->sysdev); return acpi_find_child_device(adev, 0, false); } From patchwork Thu Apr 28 11:10:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heikki Krogerus X-Patchwork-Id: 12830505 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39D39C433F5 for ; Thu, 28 Apr 2022 11:11:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345463AbiD1LOU (ORCPT ); Thu, 28 Apr 2022 07:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345455AbiD1LOR (ORCPT ); Thu, 28 Apr 2022 07:14:17 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56908220CB; Thu, 28 Apr 2022 04:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651144263; x=1682680263; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RcJmmFSAKdqn8rkcY+jzES/FkuNtJTKacj4WSDA1mlk=; b=YoJAWzuC4pjd3NKINrFsYrFRa1EYDqQt05aYvMxm4vgXpUJcIY850p1h eTJ6rd0MHpE9L9ly58xb6SPQfu3z9Lh7eyMaWloR6+CzYqgQfjVFUaGDo zJ1FFN8rmaaNcWqePzCvcpNTs2EO2jEzxH91iovWE7XrUcIt7jPWdFi0A aU+H+zNVg3yfrfvJ3J3e1sCcmhvls4q7o8zZoEDKANb9evSEozvjGRXVn M3McV4dZ3Ym1adVqMPKOIaSKqB6jVGwaPEn52TAynzw8fmN/k1qRP/mBV VW/yQreI0c5tmXr94osw2wXWmUKvn0cI5q+RWqgoM+2YldWyro55yXQiZ Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10330"; a="291414554" X-IronPort-AV: E=Sophos;i="5.90,295,1643702400"; d="scan'208";a="291414554" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 04:11:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,295,1643702400"; d="scan'208";a="706011971" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 28 Apr 2022 04:11:00 -0700 From: Heikki Krogerus To: Greg Kroah-Hartman Cc: Felipe Balbi , "Rafael J. Wysocki" , Mathias Nyman , Andy Shevchenko , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] usb: dwc3: host: Stop setting the ACPI companion Date: Thu, 28 Apr 2022 14:10:56 +0300 Message-Id: <20220428111056.3558-3-heikki.krogerus@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220428111056.3558-1-heikki.krogerus@linux.intel.com> References: <20220428111056.3558-1-heikki.krogerus@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It is no longer needed. The sysdev pointer is now used when assigning the ACPI companions to the xHCI ports and USB devices. Assigning the ACPI companion here resulted in the fwnode->secondary pointer to be replaced also for the parent dwc3 device since the primary fwnode (the ACPI companion) was shared. That was unintentional and it created potential side effects like resource leaks. Signed-off-by: Heikki Krogerus --- drivers/usb/dwc3/host.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index eda871973d6cc..f56c30cf151e4 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -7,7 +7,6 @@ * Authors: Felipe Balbi , */ -#include #include #include #include @@ -83,7 +82,6 @@ int dwc3_host_init(struct dwc3 *dwc) } xhci->dev.parent = dwc->dev; - ACPI_COMPANION_SET(&xhci->dev, ACPI_COMPANION(dwc->dev)); dwc->xhci = xhci;