linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <mka@chromium.org>
To: Doug Anderson <dianders@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Mathias Nyman <mathias.nyman@intel.com>,
	Felipe Balbi <balbi@kernel.org>,
	linux-kernel@vger.kernel.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Stephen Boyd <swboyd@chromium.org>,
	Peter Chen <peter.chen@kernel.org>,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	Roger Quadros <rogerq@kernel.org>,
	Michal Simek <michal.simek@xilinx.com>,
	Ravi Chandra Sadineni <ravisadineni@chromium.org>,
	Bastien Nocera <hadess@hadess.net>
Subject: Re: [PATCH v17 1/7] usb: misc: Add onboard_usb_hub driver
Date: Thu, 18 Nov 2021 09:52:28 -0800	[thread overview]
Message-ID: <YZaS3NpfUqqg4L+v@google.com> (raw)
In-Reply-To: <CAD=FV=VnRQzvgjVzTNgx5kaC6VDvFGvTx2njtdTo27LW1zxWJA@mail.gmail.com>

On Wed, Nov 17, 2021 at 04:11:34PM -0800, Doug Anderson wrote:
> Hi,
> 
> On Tue, Nov 16, 2021 at 12:07 PM Matthias Kaehlcke <mka@chromium.org> wrote:
> >
> > --- a/drivers/usb/misc/Kconfig
> > +++ b/drivers/usb/misc/Kconfig
> > @@ -284,3 +284,20 @@ 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
> > +       tristate "Onboard USB hub support"
> 
> Aren't you back to shenanigans now that you're being called straight
> from the USB core? What if you're a module and the USB core is
> builtin? It can't call you, right? ...or what if you're builtin but
> the USB core is a module (yeah, I know that sounds insane but I don't
> think anything technically prevents it)?

Indeed, a dependency involving USB host mode is needed, as previously
with xhci_plat.

> Can you just add a dependency here such that if the USB core is a
> module that you're a module and if the USB core is builtin that you're
> builtin?

I couldn't find a way to specify that in the config options of the driver
itself. I fear the dependency has to be specified in CONFIG_USB, like it
was done previously with USB_XHCI_PLATFORM:

https://patchwork.kernel.org/project/linux-usb/patch/20210813125146.v16.6.I7a3a7d9d2126c34079b1cab87aa0b2ec3030f9b7@changeid/

Hope that isn't controversial.

> > +void onboard_hub_create_pdevs(struct usb_device *parent_hub, struct list_head *pdev_list)
> > +{
> > +       int i;
> > +       struct device_node *np, *npc;
> > +       struct platform_device *pdev;
> > +       struct pdev_list_entry *pdle;
> > +
> > +       INIT_LIST_HEAD(pdev_list);
> > +
> > +       for (i = 1; i <= parent_hub->maxchild; i++) {
> > +               np = usb_of_get_device_node(parent_hub, i);
> > +               if (!np)
> > +                       continue;
> > +
> > +               if (!of_is_onboard_usb_hub(np))
> > +                       goto node_put;
> > +
> > +               npc = of_parse_phandle(np, "companion-hub", 0);
> > +               if (!npc)
> > +                       goto create_pdev;
> > +
> > +               pdev = of_find_device_by_node(npc);
> > +               of_node_put(npc);
> > +
> > +               if (pdev) {
> > +                       /* the companion hub already has a platform device, nothing to do here */
> > +                       put_device(&pdev->dev);
> > +                       goto node_put;
> > +               }
> > +
> > +create_pdev:
> 
> I don't really like this "goto". I'd rather just use an "if" test for
> the few lines even if the indentation gets to be a bit much.

Ok, I'll remove the "goto" in the next version.

  reply	other threads:[~2021-11-18 17:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 20:07 [PATCH v17 0/7] usb: misc: Add onboard_usb_hub driver Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 1/7] " Matthias Kaehlcke
2021-11-18  0:11   ` Doug Anderson
2021-11-18 17:52     ` Matthias Kaehlcke [this message]
2021-12-10 16:51       ` Matthias Kaehlcke
2021-12-20 20:05   ` Dmitry Osipenko
2021-12-30 20:17     ` Matthias Kaehlcke
2022-01-01 12:23       ` Dmitry Osipenko
2022-01-12 19:00         ` Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 2/7] of/platform: Add stubs for of_platform_device_create/destroy() Matthias Kaehlcke
2021-11-22 17:43   ` Matthias Kaehlcke
2021-12-01 22:31     ` Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 3/7] usb: core: hcd: Create platform devices for onboard hubs in probe() Matthias Kaehlcke
2021-11-18  0:03   ` Doug Anderson
2021-11-16 20:07 ` [PATCH v17 4/7] arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub Matthias Kaehlcke
2021-11-18  0:03   ` Doug Anderson
2021-11-18 18:43     ` Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 5/7] ARM: configs: Explicitly enable USB_XHCI_PLATFORM where needed Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 6/7] arm64: defconfig: Explicitly enable USB_XHCI_PLATFORM Matthias Kaehlcke
2021-11-16 20:07 ` [PATCH v17 7/7] usb: Specify dependencies on USB_XHCI_PLATFORM with 'depends on' Matthias Kaehlcke
2021-11-17  2:21   ` Alan Stern
2021-11-18 17:16     ` Matthias Kaehlcke
2021-12-16 23:56   ` Matthias Kaehlcke
2021-12-17  0:47     ` Dmitry Osipenko
2021-12-20 18:44       ` Matthias Kaehlcke
2021-12-20 19:59         ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZaS3NpfUqqg4L+v@google.com \
    --to=mka@chromium.org \
    --cc=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=frowand.list@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=michal.simek@xilinx.com \
    --cc=peter.chen@kernel.org \
    --cc=ravisadineni@chromium.org \
    --cc=robh+dt@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).