Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp910524iog; Thu, 30 Jun 2022 12:39:00 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t6qHIfxDijo7ix0B2tU8Io/ypUZtyR0ubjlRXqz22nh+H85hGA9bCd0QJowP74bKFB+Zjf X-Received: by 2002:a05:6402:2812:b0:437:6235:adbe with SMTP id h18-20020a056402281200b004376235adbemr13691696ede.416.1656617940719; Thu, 30 Jun 2022 12:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656617940; cv=none; d=google.com; s=arc-20160816; b=tsG6G6rm4cBV6G90pEi+j/0N3+zhPHkuDbq6ZP5VmkEhY1GuWlCtO3fAISxDR0TR4R 6jO+W3jI2s8NXhiuaruN4YyTfkAkMzGAO8MyI8W+W7vXR7VfzgmUHwXWNtwz3nm4TSSI 4epG5RVnrrXeJUckOFF8Coa+TncUnDMgAQQ/COy2TVDv3oV6IAL4zs+uenwbxRhnKC7N EvGQEfVZEB5XTtzdwqqvF74HN8XSdqbYC0ReXy8vipaIDansRtQgEB1ZBbDJI3iXlFIc IsCWXEffqVp8nNF119Uct+UlavwtzRRfjvqh9WobN2fAr8X1AIZkyiNa28kdVYaKmwF6 levg== 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=HPqBYBlLTOMK1qOOrCVZV8mMsTTnAaW6SeEmmR24dkw=; b=puFLnmYq0lCutTDz9XYv9l1prNS68mtAzFh8nlsmSJJMXDjiZfD4WLOmhFkD70bpkT CfpW2DNbFiaPStqI4kBvFgU5CvprEIXYTvAtH9ZjoxJjZeV+liwdupp//QvSzDX4R8cN EMROM74yVDEtWij2YNniOvcDyFze/U4LClwD1gyOp6LVEGrCz1yRU2RhvaqCz9n/TgZr KXILBxLbWTnWfVQMoQHm1uekRArBYq+Tsg5N15sfKAqInWD2Z/xyamd+x4Dr68cb42nF tFSt6jKFwWovIP/5sXi8bafalIh1hhDe4Nl4S5DoNL/t1zc466Abk1MWuA45q9vbQJeS 0GmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="JgU/8dDd"; 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 ca18-20020a170906a3d200b00722ef86e267si20544194ejb.294.2022.06.30.12.38.34; Thu, 30 Jun 2022 12:39:00 -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="JgU/8dDd"; 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 S236748AbiF3Tfx (ORCPT + 99 others); Thu, 30 Jun 2022 15:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236875AbiF3Tfr (ORCPT ); Thu, 30 Jun 2022 15:35:47 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E78D43EC0 for ; Thu, 30 Jun 2022 12:35:42 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id m2so283882plx.3 for ; Thu, 30 Jun 2022 12:35:42 -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=HPqBYBlLTOMK1qOOrCVZV8mMsTTnAaW6SeEmmR24dkw=; b=JgU/8dDdLh39FOHDtB4AmUWjf7ovmaGZuK/G8C1PG/C/tYs735zbQK0N/MnZlnSPLB ZLK10V1TD8tvUZXXl9Ko8jDPOCz8/3m124YGDC9/2FXlcTKGUbo6f+Rex7iF+7A195kQ rJ6uJKAq9QbVm/Vk4hmgV2uKn+MTr34Wk+ZPg= 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=HPqBYBlLTOMK1qOOrCVZV8mMsTTnAaW6SeEmmR24dkw=; b=aW4h4NWHPSS79jdgsofQL6VCv7b9wpd/xNeh9kY0jGcH8r6qCVrdnVMTLkQYf7L/e2 +FYLlJm67PijneotKhUK5zLSt79/aEu0zz6h4UnjKDlZBaKr3CkhU2+63ylGURgPNiQV MrHMw71DRHZxmcPEj+h0qMn++elxdHRWoWe57atr68tKL4D1DUKC1EHrft2WQBWCZffz M75KCWCG7NUL+pTI4I+qdOFK+BrneQpZls1o6P+u9+LklJwIMlEU44JHLUhyDcsDUTUE OGKfwAs1Sog3T2fiDebN/MtlNCXBmNtmKR8kj05pr8E5pSfE7T9Ul96K1ddS0UAcQ99N xDig== X-Gm-Message-State: AJIora+SRsk5a0lCiHmmRrzRcP753ZhTdtGLO/SgdI4Pb5QMH9N20lI1 YtWTB4q5NY0ff5fKSA/1DH+bZg== X-Received: by 2002:a17:902:c950:b0:16b:8ec7:b34 with SMTP id i16-20020a170902c95000b0016b8ec70b34mr16017029pla.143.1656617741784; Thu, 30 Jun 2022 12:35:41 -0700 (PDT) Received: from localhost ([2620:15c:11a:202:9fbf:277c:23e1:eabb]) by smtp.gmail.com with UTF8SMTPSA id be19-20020a056a001f1300b005254c71df0esm13732068pfb.86.2022.06.30.12.35.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jun 2022 12:35:41 -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, devicetree@vger.kernel.org, Douglas Anderson , Michal Simek , linux-usb@vger.kernel.org, Ravi Chandra Sadineni , Roger Quadros , Bastien Nocera , Peter Chen , Stephen Boyd , Krzysztof Kozlowski , Matthias Kaehlcke , Bhuvanesh Surachari , Dan Carpenter , Kai-Heng Feng , Mathias Nyman , Vincent Mailhol Subject: [PATCH v24 4/4] usb: core: hub: Create platform devices for onboard hubs in hub_probe() Date: Thu, 30 Jun 2022 12:35:30 -0700 Message-Id: <20220630123445.v24.4.Ic9dd36078f9d803de82ca01a6700c58b8e4de27e@changeid> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog In-Reply-To: <20220630193530.2608178-1-mka@chromium.org> References: <20220630193530.2608178-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 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 v24: - none 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.161.g10f37bed90-goog