Skip to content

Commit

Permalink
usb: dwc3: debugfs: hold the lock in during mode change
Browse files Browse the repository at this point in the history
The read and write operation is atomic and we need no locking around
this operations. What we need however is a lock that is held which
ensures that the content of the DWC3_GCTL has not been changed. With
this, the conten may have been change changed after the first but before
our write back.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Sebastian Andrzej Siewior authored and Felipe Balbi committed Dec 12, 2011
1 parent 7ae4fc4 commit c5537ea
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/usb/dwc3/debugfs.c
Original file line number Diff line number Diff line change
@@ -451,7 +451,6 @@ static ssize_t dwc3_mode_write(struct file *file,

spin_lock_irqsave(&dwc->lock, flags);
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
spin_unlock_irqrestore(&dwc->lock, flags);

reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));

@@ -464,7 +463,6 @@ static ssize_t dwc3_mode_write(struct file *file,
if (!strncmp(buf, "otg", 3))
reg |= DWC3_GCTL_PRTCAP(DWC3_GCTL_PRTCAP_OTG);

spin_lock_irqsave(&dwc->lock, flags);
dwc3_writel(dwc->regs, DWC3_GCTL, reg);
spin_unlock_irqrestore(&dwc->lock, flags);

0 comments on commit c5537ea

Please sign in to comment.