linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] usb: renesas_usbhs: simplify usbhs_status_get_device_state()
@ 2019-09-09 15:46 Veeraiyan Chidambaram
  2019-09-09 15:46 ` [PATCH v4 2/3] usb: renesas_usbhs: enable DVSE interrupt Veeraiyan Chidambaram
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Veeraiyan Chidambaram @ 2019-09-09 15:46 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Geert Uytterhoeven,
	Yoshihiro Shimoda, Linux-Renesas
  Cc: linux-usb, Andrew Gabbasov, Eugeniu Rosca, external.veeraiyan.c,
	Veeraiyan Chidambaram

From: Eugeniu Rosca <erosca@de.adit-jv.com>

Similar to usbhs_status_get_ctrl_stage(), *_get_device_state() is not
supposed to return any error code since its return value is the DVSQ
bitfield of the INTSTS0 register. According to SoC HW manual rev1.00,
every single value of DVSQ[2:0] is valid and none is an error:

----8<----
Device State
000: Powered state
001: Default state
010: Address state
011: Configuration state
1xx: Suspended state
----8<----

Hence, simplify the function body. The motivation behind dropping the
switch/case construct is being able to implement reading the suspended
state. The latter (based on the above DVSQ[2:0] description) doesn't
have a unique value, but is rather a list of states (which makes
switch/case less suitable for reading/validating it):

100: (Suspended) Powered state
101: (Suspended) Default state
110: (Suspended) Address state
111: (Suspended) Configuration state

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Veeraiyan Chidambaram <veeraiyan.chidambaram@in.bosch.com>
---
v4: patch sequence change
v3: https://patchwork.kernel.org/patch/11137697/
v2: https://patchwork.kernel.org/patch/11135111/
v1: https://patchwork.kernel.org/patch/10581479/

 drivers/usb/renesas_usbhs/mod.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index 7475c4f64724..4fbb1d538b82 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -170,17 +170,7 @@ void usbhs_mod_remove(struct usbhs_priv *priv)
  */
 int usbhs_status_get_device_state(struct usbhs_irq_state *irq_state)
 {
-	int state = irq_state->intsts0 & DVSQ_MASK;
-
-	switch (state) {
-	case POWER_STATE:
-	case DEFAULT_STATE:
-	case ADDRESS_STATE:
-	case CONFIGURATION_STATE:
-		return state;
-	}
-
-	return -EIO;
+	return (int)irq_state->intsts0 & DVSQ_MASK;
 }
 
 int usbhs_status_get_ctrl_stage(struct usbhs_irq_state *irq_state)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-11 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 15:46 [PATCH v4 1/3] usb: renesas_usbhs: simplify usbhs_status_get_device_state() Veeraiyan Chidambaram
2019-09-09 15:46 ` [PATCH v4 2/3] usb: renesas_usbhs: enable DVSE interrupt Veeraiyan Chidambaram
2019-09-10  4:45   ` Yoshihiro Shimoda
2019-09-10  9:31     ` veeraiyan chidambaram
2019-09-11  2:45       ` Yoshihiro Shimoda
2019-09-11 13:22         ` veeraiyan chidambaram
2019-09-09 15:46 ` [PATCH v4 3/3] usb: renesas_usbhs: add suspend event support in gadget mode Veeraiyan Chidambaram
2019-09-10  4:47   ` Yoshihiro Shimoda
2019-09-10  4:41 ` [PATCH v4 1/3] usb: renesas_usbhs: simplify usbhs_status_get_device_state() Yoshihiro Shimoda

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).