Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp775741iog; Fri, 24 Jun 2022 13:57:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLaEmNTvJZu0Nip1K7T8gQlPtDxpl9lpi6lYn+6mXMW1nyTnMpsmhZfC0Hwu/O58qd3q5E X-Received: by 2002:a05:6a00:22ce:b0:51c:15ac:3977 with SMTP id f14-20020a056a0022ce00b0051c15ac3977mr1022925pfj.3.1656104279718; Fri, 24 Jun 2022 13:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656104279; cv=none; d=google.com; s=arc-20160816; b=QNyx8XfADkmxaefDNTGBm7xpyFMoMWk6LmNGsN5tjPRYUeNXVcgWMrWLvtDID1L4DT /elaPlBY7QpBhJTAIxTvnvmy1vz9kKUn7IruIKVRnSy6j/2fmFzc1d/sJgXcp6lqwG8b CxgWC9kTMQOMJHGcE3NKlCJ2ax0+Hdi6ceYW1DZq+hmNKBXlGPr44O1vxeRh+DAOMnIn SqvKXo7hGkPUZe9ABfVvjSC2gCH+6HCt0HezqRiUzGnZ1Bytr1uYd8E1JWxaed0aDPhF DriVPvahae3TcEXajoWsQc8oPv56+fv3SvtovjtJg5/kL9peNgzrN28rYSydOszC0itS 9lUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=FKj5ILhZahDV8g/Lut3oLM8+DsVW+fpPjZNGs2Euucg=; b=hbqvgmnE93h8NODu5z2vLuMabDZbmRt/IMGhlovlBVvOygSkvCAm5lrEmMxdqB16b5 nQjxdQKorlmmcUhzBQpl7E7lmVRcGSPJqnEqe4ttsP1IxfYgw/Wyh/DnIW67KwhOVrIC OQys4XHn2QoiWtBF9lECaLa9/Su349jphPn//EV/SXnDMoPV72/kQ12m7y/h3/8FnTP1 pyULSkkMIN+J2twr3TVEZU9nnRMvO7N4DEiLtNj2g5EQDT4pTWQUVjpbkEJra9PPUe3H ZAKhniWSsgIibfrQBPf9YL2mE9iTUNX5yoW8wus1sv65AOklE0y4Wb6qOC8VN6vnH/zZ jxTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=afsOnPAC; 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 j16-20020a170902da9000b00161720e6a48si5052315plx.308.2022.06.24.13.57.46; Fri, 24 Jun 2022 13:57:59 -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=afsOnPAC; 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 S231405AbiFXUdn (ORCPT + 99 others); Fri, 24 Jun 2022 16:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbiFXUdl (ORCPT ); Fri, 24 Jun 2022 16:33:41 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CE0330F72 for ; Fri, 24 Jun 2022 13:33:40 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id cf14so4998850edb.8 for ; Fri, 24 Jun 2022 13:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FKj5ILhZahDV8g/Lut3oLM8+DsVW+fpPjZNGs2Euucg=; b=afsOnPACkNSZDgVS+pIbxolTcSijCuyb7htJeGVKjAnSPbba2GUTQklfN5+p5N8nDK rDBOOOGDB6aLTM6hsycJi2/UavX/B5Pe+kGFLd5YcvrTNW1qe6JBBB7Kfq66XCrN+X6V M5UoHzam3sQXoxWgoOY3gDxJKhff4C2aFnTfU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FKj5ILhZahDV8g/Lut3oLM8+DsVW+fpPjZNGs2Euucg=; b=Qd4DKhKB4BxG2C5+LwbSutJaxwqSMFRaDh8l2718ttfchR+mHOCEreiTAJ2rYKLxt7 6kPpAgUIBfKcEeLXEZXbGsPD56Bj7AwD0oedqJ8ukV3fBZTwFXOfxoE1E+22pCZ88gjx o2Ak1ayegq6+MIQT4DMrMooVMVONLvLxTBG5wZKs8ja1UJ61MiCHQjMmzaxGGs5SI2vA q9QkEqnBK/SPFisexCAF8Nd0Up5kVFxtbOgYD2AIRXjahv++Tt3w9189WQu+7IBAS4W4 083sABQReUSXvpG3qnEzleIqLdPvEJ4Jh81fdaMPMeW7IgrZA4lVPhi4SYHh3z3yuo4i CE4A== X-Gm-Message-State: AJIora/EyYtgTBmBHqJxNjYXvUWirr3ejz71ILClSQbji+gaSCNiPItG 32ZgeJ7S66UuUFZOLXM9YtpA+kQs8tPJW51w X-Received: by 2002:aa7:dad6:0:b0:435:7a44:7480 with SMTP id x22-20020aa7dad6000000b004357a447480mr1193761eds.138.1656102819372; Fri, 24 Jun 2022 13:33:39 -0700 (PDT) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com. [209.85.128.43]) by smtp.gmail.com with ESMTPSA id p22-20020a170906839600b00711d5bc20d5sm1590138ejx.221.2022.06.24.13.33.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Jun 2022 13:33:38 -0700 (PDT) Received: by mail-wm1-f43.google.com with SMTP id z9so1908746wmf.3 for ; Fri, 24 Jun 2022 13:33:38 -0700 (PDT) X-Received: by 2002:a05:600c:34d0:b0:3a0:2c07:73ac with SMTP id d16-20020a05600c34d000b003a02c0773acmr5870508wmq.85.1656102817852; Fri, 24 Jun 2022 13:33:37 -0700 (PDT) MIME-Version: 1.0 References: <20220622214931.1914770-1-mka@chromium.org> <20220622144857.v23.2.I7c9a1f1d6ced41dd8310e8a03da666a32364e790@changeid> In-Reply-To: <20220622144857.v23.2.I7c9a1f1d6ced41dd8310e8a03da666a32364e790@changeid> From: Doug Anderson Date: Fri, 24 Jun 2022 13:33:25 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v23 2/3] usb: misc: Add onboard_usb_hub driver To: Matthias Kaehlcke Cc: Greg Kroah-Hartman , Alan Stern , Rob Herring , Frank Rowand , Mathias Nyman , Felipe Balbi , LKML , Ravi Chandra Sadineni , Bastien Nocera , Linux USB List , Roger Quadros , Krzysztof Kozlowski , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Michal Simek , Stephen Boyd , Peter Chen , Geert Uytterhoeven , Souradeep Chowdhury Content-Type: text/plain; charset="UTF-8" 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=ham 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 Hi, On Wed, Jun 22, 2022 at 2:49 PM Matthias Kaehlcke wrote: > > diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig > index 4c5ddbd75b7e..7fd40183a395 100644 > --- a/drivers/usb/misc/Kconfig > +++ b/drivers/usb/misc/Kconfig > @@ -295,3 +295,19 @@ config BRCM_USB_PINMAP > This option enables support for remapping some USB external > signals, which are typically on dedicated pins on the chip, > to any gpio. > + > +config USB_ONBOARD_HUB > + bool "Onboard USB hub support" The above needs to be "tristate", not bool. Weirdly the way you have it if you set "CONFIG_USB=m" and "CONFIG_USB_ONBOARD_HUB=y" you don't get any compile errors, but also the onboard usb hub doesn't even get compiled (!). Once you switch to tristate then setting "CONFIG_USB=m" will force the onboard hub to be a module too (since it's underneath the "if" in the Kconfig). ...ugh, but once you do that then you start getting compile errors if you have "CONFIG_USB=y" and "CONFIG_USB_ONBOARD_HUB=m". I guess that can be fixed with something like this -usbcore-$(CONFIG_USB_ONBOARD_HUB) += ../misc/onboard_usb_hub_pdevs.o +ifdef CONFIG_USB_ONBOARD_HUB +usbcore-y += ../misc/onboard_usb_hub_pdevs.o +endif Given the problems we've had in the past, please make sure you test with all combinations of "=y" and "=m" for CONFIG_USB and CONFIG_USB_ONBOARD_HUB. Note that on sc7180-trogdor devices if you want CONFIG_USB to be a module don't forget to also set CONFIG_USB_DWC3=m or DWC3 will force you to gadget mode... > +/** > + * onboard_hub_create_pdevs -- create platform devices for onboard USB hubs > + * @parent_hub : parent hub to scan for connected onboard hubs > + * @pdev_list : list of onboard hub platform devices owned by the parent hub > + * > + * Creates a platform device for each supported onboard hub that is connected to > + * the given parent hub. The platform device is in charge of initializing the > + * hub (enable regulators, take the hub out of reset, ...) and can optionally > + * control whether the hub remains powered during system suspend or not. > + > + * To keep track of the platform devices they are added to > + * a list that is owned by the parent hub. super nitty, but the above two lines of comment could be word-wrapped better. > + */ > +void onboard_hub_create_pdevs(struct usb_device *parent_hub, struct list_head *pdev_list) > +{ > + int i; > + struct usb_hcd *hcd = bus_to_hcd(parent_hub->bus); As per my response on v22, would you be willing to rename that to "parent_hcd"? I'll probably still confuse myself next time I read this function, but at least maybe this will help me recognize more quickly that this isn't necessarily the child's hcd in the case of the root hub. -Doug