[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2B3535C5ECE8B5419E3ECBE30077290901DC39AF5F@US01WEMBX2.internal.synopsys.com>
Date: Fri, 16 Oct 2015 18:06:01 +0000
From: John Youn <John.Youn@...opsys.com>
To: Douglas Anderson <dianders@...omium.org>,
John Youn <John.Youn@...opsys.com>,
"balbi@...com" <balbi@...com>
CC: Yunzhi Li <lyz@...k-chips.com>,
Heiko Stübner <heiko@...ech.de>,
"linux-rockchip@...ts.infradead.org"
<linux-rockchip@...ts.infradead.org>,
Julius Werner <jwerner@...omium.org>,
"gregory.herrero@...el.com" <gregory.herrero@...el.com>,
"yousaf.kaukab@...el.com" <yousaf.kaukab@...el.com>,
"dinguyen@...nsource.altera.com" <dinguyen@...nsource.altera.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc2: host: Protect PCGCTL with lock in
dwc2_port_resume()
On 10/14/2015 3:58 PM, Douglas Anderson wrote:
> From code inspection, it appears to be unsafe to do a read-modify-write
> of PCGCTL in dwc2_port_resume(). Let's make sure the spinlock is held
> around this operation.
>
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
> drivers/usb/dwc2/hcd.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
> index af4e4a2..e79baf7 100644
> --- a/drivers/usb/dwc2/hcd.c
> +++ b/drivers/usb/dwc2/hcd.c
> @@ -1500,6 +1500,8 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
> u32 hprt0;
> u32 pcgctl;
>
> + spin_lock_irqsave(&hsotg->lock, flags);
> +
> /*
> * If hibernation is supported, Phy clock is already resumed
> * after registers restore.
> @@ -1508,10 +1510,11 @@ static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
> pcgctl = dwc2_readl(hsotg->regs + PCGCTL);
> pcgctl &= ~PCGCTL_STOPPCLK;
> dwc2_writel(pcgctl, hsotg->regs + PCGCTL);
> + spin_unlock_irqrestore(&hsotg->lock, flags);
> usleep_range(20000, 40000);
> + spin_lock_irqsave(&hsotg->lock, flags);
> }
>
> - spin_lock_irqsave(&hsotg->lock, flags);
> hprt0 = dwc2_read_hprt0(hsotg);
> hprt0 |= HPRT0_RES;
> hprt0 &= ~HPRT0_SUSP;
>
Acked-by: John Youn <johnyoun@...opsys.com>
John
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists