From: Kishon Vijay Abraham I <kishon@ti.com>
To: rob.herring@calxeda.com, rob@landley.net, balbi@ti.com,
sameo@linux.intel.com, gg@slimlogic.co.uk, s-guiriec@ti.com,
broonie@opensource.wolfsonmicro.com, linux-usb@vger.kernel.org,
linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: grant.likely@secretlab.ca, gregkh@linuxfoundation.org, kishon@ti.com
Subject: [PATCH v1 6/8] usb: otg: palmas-usb: call regulator enable/disable only on valid regulator
Date: Fri, 25 Jan 2013 08:42:29 +0530 [thread overview]
Message-ID: <1359083551-8524-7-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1359083551-8524-1-git-send-email-kishon@ti.com>
The calls to regulator enable/disable was done unconditionally which
might result in warn dumps if *no_control_vbus* is set. So always call
regulator enable/disable on valid regulator.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/otg/palmas-usb.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/otg/palmas-usb.c b/drivers/usb/otg/palmas-usb.c
index 2377836..442f09c 100644
--- a/drivers/usb/otg/palmas-usb.c
+++ b/drivers/usb/otg/palmas-usb.c
@@ -119,11 +119,13 @@ static irqreturn_t palmas_vbus_wakeup_irq(int irq, void *_palmas_usb)
regmap_read(palmas_usb->palmas->regmap[slave], addr, &vbus_line_state);
if (vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS) {
- regulator_enable(palmas_usb->vbus_reg);
+ if (!IS_ERR_OR_NULL(palmas_usb->vbus_reg))
+ regulator_enable(palmas_usb->vbus_reg);
status = OMAP_DWC3_VBUS_VALID;
} else {
status = OMAP_DWC3_VBUS_OFF;
- regulator_disable(palmas_usb->vbus_reg);
+ if (!IS_ERR_OR_NULL(palmas_usb->vbus_reg))
+ regulator_disable(palmas_usb->vbus_reg);
}
palmas_usb->linkstat = status;
@@ -144,7 +146,8 @@ static irqreturn_t palmas_id_wakeup_irq(int irq, void *_palmas_usb)
palmas_usb_read(palmas_usb->palmas, PALMAS_USB_ID_INT_LATCH_SET, &set);
if (set & PALMAS_USB_ID_INT_SRC_ID_GND) {
- regulator_enable(palmas_usb->vbus_reg);
+ if (!IS_ERR_OR_NULL(palmas_usb->vbus_reg))
+ regulator_enable(palmas_usb->vbus_reg);
palmas_usb_write(palmas_usb->palmas,
PALMAS_USB_ID_INT_EN_HI_SET,
PALMAS_USB_ID_INT_EN_HI_SET_ID_FLOAT);
@@ -159,7 +162,8 @@ static irqreturn_t palmas_id_wakeup_irq(int irq, void *_palmas_usb)
palmas_usb_write(palmas_usb->palmas,
PALMAS_USB_ID_INT_EN_HI_CLR,
PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT);
- regulator_disable(palmas_usb->vbus_reg);
+ if (!IS_ERR_OR_NULL(palmas_usb->vbus_reg))
+ regulator_disable(palmas_usb->vbus_reg);
status = OMAP_DWC3_ID_FLOAT;
}
@@ -191,6 +195,11 @@ static void palmas_set_vbus_work(struct work_struct *data)
struct palmas_usb *palmas_usb = container_of(data, struct palmas_usb,
set_vbus_work);
+ if (IS_ERR_OR_NULL(palmas_usb->vbus_reg)) {
+ dev_err(palmas_usb->dev, "invalid regulator\n");
+ return;
+ }
+
/*
* Start driving VBUS. Set OPA_MODE bit in CHARGERUSB_CTRL1
* register. This enables boost mode.
--
1.7.9.5
next prev parent reply other threads:[~2013-01-25 3:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 3:12 [PATCH v1 0/8] usb: otg: palmas-usb: fixes/cleanups to get dwc3 working Kishon Vijay Abraham I
2013-01-25 3:12 ` [PATCH v1 3/8] usb: otg: palmas-usb: remove compiler warning Kishon Vijay Abraham I
[not found] ` <1359083551-8524-1-git-send-email-kishon-l0cyMroinI0@public.gmane.org>
2013-01-25 3:12 ` [PATCH v1 1/8] usb: otg: palmas-usb: make palmas-usb as a comparator driver Kishon Vijay Abraham I
2013-01-25 7:43 ` Felipe Balbi
[not found] ` <20130125074339.GD15886-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2013-01-25 8:44 ` kishon
[not found] ` <510245D7.4090008-l0cyMroinI0@public.gmane.org>
2013-01-25 8:59 ` Felipe Balbi
2013-01-25 3:12 ` [PATCH v1 2/8] usb: otg: palmas-usb: use devres API to allocate resources Kishon Vijay Abraham I
2013-01-25 3:12 ` [PATCH v1 4/8] usb: otg: palmas-usb: use mailbox API to send VBUS or ID events Kishon Vijay Abraham I
2013-01-25 3:12 ` [PATCH v1 5/8] usb: otg: palmas-usb: use bool to read property instead of u32 Kishon Vijay Abraham I
2013-01-25 3:12 ` Kishon Vijay Abraham I [this message]
2013-01-25 3:12 ` [PATCH v1 7/8] usb: otg: palmas-usb: pass the correct dev ptr in regulator get Kishon Vijay Abraham I
2013-01-25 3:12 ` [PATCH v1 8/8] usb: otg: palmas-usb: fix cold plug issue Kishon Vijay Abraham I
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=1359083551-8524-7-git-send-email-kishon@ti.com \
--to=kishon@ti.com \
--cc=balbi@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gg@slimlogic.co.uk \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=s-guiriec@ti.com \
--cc=sameo@linux.intel.com \
/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).