Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp735345iol; Thu, 9 Jun 2022 12:51:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz98AqzNwe0KJr0+snrfkvHlvY4hnGD3srkPgj2nXQRO1FeXPB3y0oeACaeMLvy5N/eDiV4 X-Received: by 2002:a05:6402:1488:b0:431:56cb:bbc5 with SMTP id e8-20020a056402148800b0043156cbbbc5mr26893201edv.199.1654804300503; Thu, 09 Jun 2022 12:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654804300; cv=none; d=google.com; s=arc-20160816; b=IprOFLikf1hjo5rh45dMHpN3sDR8nIKch5baKC+JwoYTF/adp7x3j9Uh5S7ZEkbEQM n5uPIgrqPzSgPGnxyuWkWk7B8Qxh2McYtqHPi3PAJCrci1hXNP4PYxvxj3a4yJx2qlMH HjPsAKtWvaSlIzdjjbAv4x/KHinzsBu09bpQww/6p09rYFu3btcshzXO2H3WR1BeP/Ae +Dptn7Vik3kMvUfr2eTlhBfT2vfwIIZiK111NC1QO5K6sRRzmiQwyA1TeQknz0o3XNYM pf9AIbX0SRZDCuM+rIUnBwKEHkdjD+UhLFA/RBF7rJabBtw+7g5hxZ24o6NjGUoj89aV dlYg== 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=M8b7P05WgRuIYwqPhhzNq/VzjM3rtntdxY9lSXK6ydQ=; b=zZ1uxJOjavMinTqMDykQbuQbebyuoPo0lINOXw6fJZvwHg3M16vclD/lOvM2VIriP2 F/HZ4VMZKl2OyVGvPc2YPSEmN9X/kuPJChDtsfHIpIwxg+AMMgsXqIZwdjkYOdhG8jbJ /BIFVNeRF9ktlOKhTJTmHFXzPlfYYxG1VbmIAPa6aenqg1NtIQJHIsyJMeFTBpv1yJRp /LMKwKt59fLFf65H3BXk1IZLsMA1mBCVwQIeUdfXp7pxEfc6thZ1/YXipSkqawzWHbqm tyDRQhaK4pXlqXEIR4PsksHRt+LKY2yZya7WEQZqkQAdx95TJhf6YlJfsPNzVS4bbvC+ Qyhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="ac/Uas5+"; 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 dn16-20020a17090794d000b006fe4c66b711si5550836ejc.46.2022.06.09.12.51.14; Thu, 09 Jun 2022 12:51:40 -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="ac/Uas5+"; 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 S1344695AbiFITUV (ORCPT + 99 others); Thu, 9 Jun 2022 15:20:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245276AbiFITUL (ORCPT ); Thu, 9 Jun 2022 15:20:11 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F9CF31D9F8 for ; Thu, 9 Jun 2022 12:20:10 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id s135so7076759pgs.10 for ; Thu, 09 Jun 2022 12:20:10 -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=M8b7P05WgRuIYwqPhhzNq/VzjM3rtntdxY9lSXK6ydQ=; b=ac/Uas5+3Wu1KKE3kuEy/kAt6ITRkEoQ7yC/2qNp1WtI3Xfacs5gpUdOdW++EOWreo EM9+G2xBm4jmIgEHaDf6sRrw+JYRKxW10sib3Wc8Kwkng6dqaMovAx6OKIJG7uFNhuZU NIgNJxspOjlO3Y7HiMNdGAJTZLAcDLpYiqtk0= 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=M8b7P05WgRuIYwqPhhzNq/VzjM3rtntdxY9lSXK6ydQ=; b=5A5MKXcqZLGJkGTm/cHyo/GOU22C2BL94MrKbGGya/kvo7a148LOOVZ+9dG83RadRv zsKT6sbidFShd306/HS69n2M8icuKmec/SJLEX/nK+y+w0Pk9qrRCfNq3H/dFtQnwJdu 8O0sbbtHw7feh35tdl4RXqxNkGR9oTlP/5rr4lRQf+COsniB/m79SGE8xv0cWEkeLoou OEUNpKoSMXONJzf8x51VaaqbDof8JRGz+L4CSb8H5E9PBb5tDcqhf5sWc4D8Pz9IQ248 S5A8OAl7vQNJN8tIME2g3BNRe9+PTR1opY2Vl2srJRXYM6/kZZW8SoQz526AA7i2xjM7 69uQ== X-Gm-Message-State: AOAM532iah5qXzBZt5EzYVOiUfHvX4A4sdWhGYaBkh7SDb3jPz4tD1By SqMdeZwC9datPtj3nxQAHygjog== X-Received: by 2002:a63:555d:0:b0:3fd:5d54:2708 with SMTP id f29-20020a63555d000000b003fd5d542708mr24870374pgm.92.1654802409924; Thu, 09 Jun 2022 12:20:09 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:c543:2c9:1206:951b]) by smtp.gmail.com with UTF8SMTPSA id in9-20020a17090b438900b001e2d2235176sm41048pjb.51.2022.06.09.12.20.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jun 2022 12:20:09 -0700 (PDT) From: Matthias Kaehlcke To: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi Cc: Michal Simek , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Stephen Boyd , devicetree@vger.kernel.org, Bastien Nocera , Peter Chen , Ravi Chandra Sadineni , Roger Quadros , Douglas Anderson , linux-usb@vger.kernel.org, Matthias Kaehlcke , Andrew Lunn , Bhuvanesh Surachari , Kai-Heng Feng , Mathias Nyman , Vincent Mailhol Subject: [PATCH v22 3/3] usb: core: hub: Create platform devices for onboard hubs in hub_probe() Date: Thu, 9 Jun 2022 12:20:00 -0700 Message-Id: <20220609121838.v22.3.Ic9dd36078f9d803de82ca01a6700c58b8e4de27e@changeid> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220609192000.990763-1-mka@chromium.org> References: <20220609192000.990763-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 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,URIBL_BLOCKED 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 --- 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.36.1.476.g0c4daa206d-goog