aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/dwc2
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2013-08-30 18:45:14 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-08-30 14:14:52 -0700
commit1c58ce133971e7159f51f331717a61632a2a3897 (patch)
tree3dd27f26737b741de11b9c35824e6725fcf05c53 /drivers/staging/dwc2
parentstaging: dwc2: unshift non-bool register value constants (diff)
downloadlinux-dev-1c58ce133971e7159f51f331717a61632a2a3897.tar.xz
linux-dev-1c58ce133971e7159f51f331717a61632a2a3897.zip
staging: dwc2: only read the snpsid register once
This (read-only) register was read twice, storing it for later use the second time. Now it is only read once, storing it right away. Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl> Acked-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dwc2')
-rw-r--r--drivers/staging/dwc2/hcd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c
index 4e8fec0640e8..d48830414561 100644
--- a/drivers/staging/dwc2/hcd.c
+++ b/drivers/staging/dwc2/hcd.c
@@ -2734,7 +2734,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
{
struct usb_hcd *hcd;
struct dwc2_host_chan *channel;
- u32 snpsid, gusbcfg, hcfg;
+ u32 gusbcfg, hcfg;
int i, num_channels;
int retval = -ENOMEM;
@@ -2746,10 +2746,11 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
* 0x45f42xxx or 0x45f43xxx, which corresponds to either "OT2" or "OT3",
* as in "OTG version 2.xx" or "OTG version 3.xx".
*/
- snpsid = readl(hsotg->regs + GSNPSID);
- if ((snpsid & 0xfffff000) != 0x4f542000 &&
- (snpsid & 0xfffff000) != 0x4f543000) {
- dev_err(hsotg->dev, "Bad value for GSNPSID: 0x%08x\n", snpsid);
+ hsotg->snpsid = readl(hsotg->regs + GSNPSID);
+ if ((hsotg->snpsid & 0xfffff000) != 0x4f542000 &&
+ (hsotg->snpsid & 0xfffff000) != 0x4f543000) {
+ dev_err(hsotg->dev, "Bad value for GSNPSID: 0x%08x\n",
+ hsotg->snpsid);
retval = -ENODEV;
goto error1;
}
@@ -2880,7 +2881,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
}
INIT_WORK(&hsotg->wf_otg, dwc2_conn_id_status_change);
- hsotg->snpsid = readl(hsotg->regs + GSNPSID);
dev_dbg(hsotg->dev, "Core Release: %1x.%1x%1x%1x\n",
hsotg->snpsid >> 12 & 0xf, hsotg->snpsid >> 8 & 0xf,
hsotg->snpsid >> 4 & 0xf, hsotg->snpsid & 0xf);