From mboxrd@z Thu Jan 1 00:00:00 1970 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 74E53C4167B for ; Tue, 16 Nov 2021 20:08:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60F186325D for ; Tue, 16 Nov 2021 20:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240225AbhKPUK5 (ORCPT ); Tue, 16 Nov 2021 15:10:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240207AbhKPUKv (ORCPT ); Tue, 16 Nov 2021 15:10:51 -0500 Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BE3BC061764 for ; Tue, 16 Nov 2021 12:07:54 -0800 (PST) Received: by mail-pf1-x431.google.com with SMTP id r130so446233pfc.1 for ; Tue, 16 Nov 2021 12:07:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WxpPTzyFDwq6+OnmCeJvt7beFH+6rbdWDksNNHEd3mQ=; b=HkQX/VX7RF0p6hLc8boU3brpPqjzARQyd09xWpBB3EY4F5F5sfMsvz/xcYZFrKNw/R emx0NkdEMLDE1Hwvf+I/KogKaNzspe5uyF88wE4NTepIOobfmD4Dk+dDN8J6fja86674 DphgdsppZnq8HHSVosn/lifgiTn1/OfuMXRA0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WxpPTzyFDwq6+OnmCeJvt7beFH+6rbdWDksNNHEd3mQ=; b=DheJ1stbaIIUcXRBqeEF7d/r3fpDr5290qwe2wQDxu47LV/IKsvh1h9B3z7Zm4SwRU 7vsynAIKEJybpXIc1Iug/XWlzgGQqj8tTyMI7WRLUJDPWH7rGSagEEM8P6Jy2eIX05cQ GfW1RXYzyKM4euKLZBCxfkiEF60pyLEa+LTB1h1jbCiJ/sYYBNRRmWO7UvfvOqcMlAZi ILLdXMAQ/OAomLLLgRTUAbAjYw1Lae31hlw8pxk2E8SPzSm1z4UDClVAaR/YA5GyOx5O 0Ebfw+Y8IjA/dAiGvhuW0+Nw9e6Vb3hR14G11UV2RM8uwuQP66SbHcgSaIVtRvVzJ43R Rasw== X-Gm-Message-State: AOAM533F1J0QpRbpUSa/nbyf7JbPqkzgZKb2JPsfZCO8VZ1G7DfqKDRe p4GO0NIh2LA5x0Kt5R8qujRz6w== X-Google-Smtp-Source: ABdhPJxvTeb9YHcGi6ywMgrLy/Jqg7ZbdoaTRoqhxZswWm9x96JcucmOmFtbulGOYbqeYvsw0VwYjA== X-Received: by 2002:a05:6a00:2387:b0:49f:af00:d5d0 with SMTP id f7-20020a056a00238700b0049faf00d5d0mr42534511pfc.1.1637093274023; Tue, 16 Nov 2021 12:07:54 -0800 (PST) Received: from localhost ([2620:15c:202:201:54aa:73ab:b480:41e2]) by smtp.gmail.com with UTF8SMTPSA id d17sm18379226pfo.40.2021.11.16.12.07.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Nov 2021 12:07:53 -0800 (PST) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , Peter Chen , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, Douglas Anderson , Roger Quadros , Michal Simek , Ravi Chandra Sadineni , Bastien Nocera , Matthias Kaehlcke , Andrey Konovalov , Kishon Vijay Abraham I , Li Jun , Peter Chen , Sasha Levin Subject: [PATCH v17 3/7] usb: core: hcd: Create platform devices for onboard hubs in probe() Date: Tue, 16 Nov 2021 12:07:35 -0800 Message-Id: <20211116120642.v17.3.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid> X-Mailer: git-send-email 2.34.0.rc1.387.gb447b232ab-goog In-Reply-To: <20211116200739.924401-1-mka@chromium.org> References: <20211116200739.924401-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Call onboard_hub_create/destroy_pdevs() from usb_add/remove_hcd() for primary HCDs to create/destroy platform devices for onboard USB hubs that may be connected to the root hub of the controller. These functions are a NOP unless CONFIG_USB_ONBOARD_HUB=y/m. Also add a field to struct usb_hcd to keep track of the onboard hub platform devices that are owned by the HCD. Signed-off-by: Matthias Kaehlcke --- Changes in v17: - create the platform devices in the generic HCD code instead of the xhci_platform driver - updated subject and commit message to reflect the above change - dropped initialization of platform device list, which is now done in onboard_hub_create_pdevs() Changes in v16: - none Changes in v15: - none Changes in v14: - none Changes in v13: - added comment for 'depends on USB_ONBOARD_HUB || !USB_ONBOARD_HUB' construct Changes in v12: - none Changes in v11: - use onboard_hub_create/destroy_pdevs() to support multiple onboard hubs that are connected to the same root hub - moved field/list to keep track of platform devices from struct usb_hcd to struct xhci_hcd - updated commit message Changes in v10: - none Changes in v9: - added dependency on USB_ONBOARD_HUB (or !!USB_ONBOARD_HUB) to USB_XHCI_PLATFORM Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - patch added to the series drivers/usb/core/hcd.c | 6 ++++++ include/linux/usb/hcd.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 4d326ee12c36..b8220e411e07 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "usb.h" @@ -2963,6 +2964,9 @@ int usb_add_hcd(struct usb_hcd *hcd, if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) usb_hcd_poll_rh_status(hcd); + if (usb_hcd_is_primary_hcd(hcd)) + onboard_hub_create_pdevs(hcd->self.root_hub, &hcd->onboard_hub_devs); + return retval; err_register_root_hub: @@ -3041,6 +3045,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) if (usb_hcd_is_primary_hcd(hcd)) { if (hcd->irq > 0) free_irq(hcd->irq, hcd); + + onboard_hub_destroy_pdevs(&hcd->onboard_hub_devs); } usb_deregister_bus(&hcd->self); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 548a028f2dab..4ebc91c09182 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -198,6 +198,7 @@ struct usb_hcd { struct usb_hcd *shared_hcd; struct usb_hcd *primary_hcd; + struct list_head onboard_hub_devs; #define HCD_BUFFER_POOLS 4 struct dma_pool *pool[HCD_BUFFER_POOLS]; -- 2.34.0.rc1.387.gb447b232ab-goog