Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5216310iog; Wed, 22 Jun 2022 14:51:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uDIEFuCQ+AtTU6i8qbWNWQTvmAYjnwz1wJMvYRFDhFLc3kKy1GunqllcMjjIoR+aNLssnM X-Received: by 2002:a17:902:7607:b0:168:bdec:7d2f with SMTP id k7-20020a170902760700b00168bdec7d2fmr37025971pll.60.1655934703522; Wed, 22 Jun 2022 14:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655934703; cv=none; d=google.com; s=arc-20160816; b=XiC67bJWam7XIwQg3uobTthNtZly/TxVB+OONdrlja3hNMyRGdkj8sjn1OWBzKW0A5 dOhFD066mgbIG7PvL4GNjPjowMS4d6OrJ4QPfpq80sp7AsdyuEZ8tW1KQYsGhvk7CVvI MUwsDfH9gbQLtKzTCF7UpgUBZxuDAE4AMrUgC12kkHQZhi0kywaJZM15IYRimHufIvaw KfFI8j5yu4ADl1diuLGUKed2pi6g211FlUHc/Tb0D63UQ/hcJri/Ux5cWCcmTgcZq6eM UZPWNbhdYLOlOBzjfv9At+QwomOZe76Hp2rc7VRo1v5eTfbBp540p/zjsHVY6pZeI0lz J2kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=olYSuR+MOT/ZUshrAp0iattV7CM2ZVM+skfjPn8b2+M=; b=bmzqdQmnksDn5KSYxf3PsBtxd+t0rYxdO2KH41tLeuTsmZPdhE+dA43L8Gk4NxwUCq jTC0E/JIAobZdpoFviNNO25n5jbkRY44qZC38JgHLaTOpj0qJCyRITD1xKTdVq4hooxI jHqMGj+dqtAPD8g4ZJo+UsMWiMALIivTWn774emHqnmufy8E8RG/z/A9WIUtfk3x6EFZ 45wMM75gQkiakFx6s0IJPyScAropMDCABnFW43X9xOSU3UJhfFprpA8DPOhvTE3t+ONU /XOOIKu+aClpGZKlN+JHU/CWIv5ulAn6VaheuZ0E8bK8zIrcAUkdbjgt3JIA2lL808Bl qK/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UnJpR89Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w5-20020a170902a70500b0015eb10a9f67si23493245plq.379.2022.06.22.14.51.29; Wed, 22 Jun 2022 14:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UnJpR89Q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238758AbiFVVtv (ORCPT + 99 others); Wed, 22 Jun 2022 17:49:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235790AbiFVVtp (ORCPT ); Wed, 22 Jun 2022 17:49:45 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E6F3F311 for ; Wed, 22 Jun 2022 14:49:43 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id e63so15792358pgc.5 for ; Wed, 22 Jun 2022 14:49:43 -0700 (PDT) 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=olYSuR+MOT/ZUshrAp0iattV7CM2ZVM+skfjPn8b2+M=; b=UnJpR89QPDuNyRWadElkPWzCatOXAwynUc93UHxb9Fi0VzMdM3en9b4XTodA5dGyeT 4tktG4+GjSXcpwD9Vo43kMST8RfosfyTZVjpGrxxYDUQ/WIowNwejdM5jgrYQIwvPenb UVeST971UNxKkc/KeKIvcKQABx25nQngF5qNU= 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=olYSuR+MOT/ZUshrAp0iattV7CM2ZVM+skfjPn8b2+M=; b=mU4Q5AUG0D+z38U+PZgOgkh5xetpGoST175DoHQUwLJ8YpCqH9litiM3JfyPUG1opn riwTDEOMFglBidFtwGmU9vSc1Vf0ikTYR1j5IiJjbtFvcpduLZBAJnocOAHWVSawitbh 80SnDORFBi6A8DzHde/5w7IvRZ5FMUUqd4BkM+icaaqr3+j4vqnblok6Yphni/GBBig+ O5GFjT7QRtiRZYGXHEMvyrzqoK+JwKK5AwQXOAkzx0XbbgVjSx/icrl3hdl5N6liE2sq Z+3oBlOWuSRj7Uu/6gBv3Wtg3bkr6ZlTT3ucH1hxLp4hdFjR67MgRTQmF6g8YNbWuVM9 Y5hQ== X-Gm-Message-State: AJIora8cOX5H3bjlxXI7Rnp3squKMqTXlCVKyjRAt76uLgU6NyCc2qn9 cwP/WoUt52ZCDLg8lben7je65w== X-Received: by 2002:a05:6a00:2995:b0:525:398b:8585 with SMTP id cj21-20020a056a00299500b00525398b8585mr9469348pfb.7.1655934583325; Wed, 22 Jun 2022 14:49:43 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:83c:92dc:a659:2900]) by smtp.gmail.com with UTF8SMTPSA id bd15-20020a056a00278f00b0050dc7628182sm14068297pfb.92.2022.06.22.14.49.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jun 2022 14:49:43 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: linux-kernel@vger.kernel.org, Ravi Chandra Sadineni , Douglas Anderson , Bastien Nocera , linux-usb@vger.kernel.org, Roger Quadros , Krzysztof Kozlowski , devicetree@vger.kernel.org, Michal Simek , Stephen Boyd , Peter Chen , Matthias Kaehlcke , Bhuvanesh Surachari , Dan Carpenter , Kai-Heng Feng , Mathias Nyman , Vincent Mailhol Subject: [PATCH v23 3/3] usb: core: hub: Create platform devices for onboard hubs in hub_probe() Date: Wed, 22 Jun 2022 14:49:31 -0700 Message-Id: <20220622144857.v23.3.Ic9dd36078f9d803de82ca01a6700c58b8e4de27e@changeid> X-Mailer: git-send-email 2.37.0.rc0.104.g0611611a94-goog In-Reply-To: <20220622214931.1914770-1-mka@chromium.org> References: <20220622214931.1914770-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call onboard_hub_create/destroy_pdevs() from hub_probe/disconnect() to create/destroy platform devices for onboard USB hubs that may be connected to the hub. The onboard hubs must have nodes in the device tree. onboard_hub_create/destroy_pdevs() are NOPs unless CONFIG_USB_ONBOARD_HUB=y/m. Also add a field to struct usb_hub to keep track of the onboard hub platform devices that are owned by the hub. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson --- Changes in v23: - added Doug's 'Reviewed-by' tag Changes in v22: - patch added to the series (moved creation/deletion from HCD) drivers/usb/core/hub.c | 9 ++++++++- drivers/usb/core/hub.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 68e9121c1878..8055130ee602 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1752,6 +1753,8 @@ static void hub_disconnect(struct usb_interface *intf) if (hub->quirk_disable_autosuspend) usb_autopm_put_interface(intf); + onboard_hub_destroy_pdevs(&hub->onboard_hub_devs); + kref_put(&hub->kref, hub_release); } @@ -1869,6 +1872,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) INIT_DELAYED_WORK(&hub->leds, led_work); INIT_DELAYED_WORK(&hub->init_work, NULL); INIT_WORK(&hub->events, hub_event); + INIT_LIST_HEAD(&hub->onboard_hub_devs); spin_lock_init(&hub->irq_urb_lock); timer_setup(&hub->irq_urb_retry, hub_retry_irq_urb, 0); usb_get_intf(intf); @@ -1889,8 +1893,11 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) usb_autopm_get_interface_no_resume(intf); } - if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) + if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) { + onboard_hub_create_pdevs(hdev, &hub->onboard_hub_devs); + return 0; + } hub_disconnect(intf); return -ENODEV; diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 22ea1f4f2d66..ccf90052d12a 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -73,6 +73,7 @@ struct usb_hub { spinlock_t irq_urb_lock; struct timer_list irq_urb_retry; struct usb_port **ports; + struct list_head onboard_hub_devs; }; /** -- 2.37.0.rc0.104.g0611611a94-goog