[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200328201846.GF1922688@smile.fi.intel.com>
Date:   Sat, 28 Mar 2020 22:18:46 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Al Cooper <alcooperx@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        Alan Stern <stern@...land.harvard.edu>,
        bcm-kernel-feedback-list@...adcom.com,
        Chunfeng Yun <chunfeng.yun@...iatek.com>,
        devicetree@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jonathan Neuschäfer <j.neuschaefer@....net>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        linux-usb@...r.kernel.org, Mark Rutland <mark.rutland@....com>,
        Mathias Nyman <mathias.nyman@...el.com>,
        Rob Herring <robh+dt@...nel.org>
Subject: Re: [PATCH v2 3/4] usb: ehci: Add new EHCI driver for Broadcom STB
 SoC's
On Fri, Mar 27, 2020 at 04:47:10PM -0400, Al Cooper wrote:
> Add a new EHCI driver for Broadcom STB SoC's. A new EHCI driver
> was created instead of adding support to the existing ehci platform
> driver because of the code required to workaround bugs in the EHCI
> controller.
I'm not sure this has been tested. See below.
...
> +#include <linux/acpi.h>
> +#include <linux/of.h>
I didn;t find evidence these are needed.
...
> +	res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val,
> +					 (val != frame_idx), 1, 130);
Too many parentheses.
> +	if (res)
> +		dev_err(ehci_to_hcd(ehci)->self.controller,
> +			"Error waiting for SOF\n");
...
> +static int ehci_brcm_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct resource *res_mem;
> +	struct brcm_priv *priv;
> +	struct usb_hcd *hcd;
> +	int irq;
> +	int err;
> +
> +	if (usb_disabled())
> +		return -ENODEV;
> +
> +	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
> +	if (err)
> +		return err;
> +
> +	irq = platform_get_irq(pdev, 0);
> +		return irq;
I'm not sure it was an intention to leave a lot of dead code below.
> +	/* Hook the hub control routine to work around a bug */
> +	if (org_hub_control == NULL)
	if (!org_hub_control) ?
> +		org_hub_control = ehci_brcm_hc_driver.hub_control;
> +	ehci_brcm_hc_driver.hub_control = ehci_brcm_hub_control;
> +	device_wakeup_enable(hcd->self.controller);
> +	device_enable_async_suspend(hcd->self.controller);
> +	platform_set_drvdata(pdev, hcd);
> +
> +	return err;
	return 0; ?
> +err_clk:
> +	clk_disable_unprepare(priv->clk);
> +err_hcd:
> +	usb_put_hcd(hcd);
> +
> +	return err;
> +}
...
> +#ifdef CONFIG_PM_SLEEP
You also can use __maybe_unused annotations.
> +static int ehci_brcm_suspend(struct device *dev)
> +{
> +	int ret;
> +	struct usb_hcd *hcd = dev_get_drvdata(dev);
> +	struct brcm_priv *priv = hcd_to_ehci_priv(hcd);
> +	bool do_wakeup = device_may_wakeup(dev);
> +
> +	ret = ehci_suspend(hcd, do_wakeup);
> +	clk_disable_unprepare(priv->clk);
> +	return ret;
So, if you fail to suspend the device, clocks will become unusable, how to recover from such case?
> +}
> +#endif /* CONFIG_PM_SLEEP */
...
> +MODULE_DESCRIPTION(BRCM_DRIVER_DESC);
Better to have it explicit.
-- 
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists
 
