From: Roger Quadros <rogerq@ti.com>
To: <Peter.Chen@nxp.com>, <balbi@kernel.org>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [PATCH v6 2/3] usb: otg-fsm: support multiple instances
Date: Wed, 30 Mar 2016 12:56:29 +0300 [thread overview]
Message-ID: <1459331790-29651-3-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1459331790-29651-1-git-send-email-rogerq@ti.com>
Move the state_changed variable into struct otg_fsm
so that we can support multiple instances.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
---
drivers/usb/common/usb-otg-fsm.c | 10 ++++------
include/linux/usb/otg-fsm.h | 1 +
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 504708f..9059b7d 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -61,8 +61,6 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol)
return 0;
}
-static int state_changed;
-
/* Called when leaving a state. Do state clean up jobs here */
static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
{
@@ -208,7 +206,6 @@ static void otg_start_hnp_polling(struct otg_fsm *fsm)
/* Called when entering a state */
static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
{
- state_changed = 1;
if (fsm->otg->state == new_state)
return 0;
VDBG("Set state: %s\n", usb_otg_state_string(new_state));
@@ -324,6 +321,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
}
fsm->otg->state = new_state;
+ fsm->state_changed = 1;
return 0;
}
@@ -335,7 +333,7 @@ int otg_statemachine(struct otg_fsm *fsm)
mutex_lock(&fsm->lock);
state = fsm->otg->state;
- state_changed = 0;
+ fsm->state_changed = 0;
/* State machine state change judgement */
switch (state) {
@@ -448,7 +446,7 @@ int otg_statemachine(struct otg_fsm *fsm)
}
mutex_unlock(&fsm->lock);
- VDBG("quit statemachine, changed = %d\n", state_changed);
- return state_changed;
+ VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
+ return fsm->state_changed;
}
EXPORT_SYMBOL_GPL(otg_statemachine);
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index 8eec0c2..7a03505 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -210,6 +210,7 @@ struct otg_fsm {
struct mutex lock;
u8 *host_req_flag;
struct delayed_work hnp_polling_work;
+ bool state_changed;
};
struct otg_fsm_ops {
--
2.5.0
next prev parent reply other threads:[~2016-03-30 9:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 9:56 [PATCH v6 0/3] usb: otg-fsm: Add documentation and some trivial cleanups Roger Quadros
2016-03-30 9:56 ` [PATCH v6 1/3] usb: otg-fsm: Add documentation for struct otg_fsm Roger Quadros
2016-03-30 9:56 ` Roger Quadros [this message]
2016-03-30 9:56 ` [PATCH v6 3/3] usb: otg-fsm: Prevent build warning "VDBG" redefined Roger Quadros
2016-03-31 9:41 ` [PATCH v7 " Roger Quadros
2016-04-05 8:52 ` Peter Chen
2016-04-05 12:52 ` Roger Quadros
2016-04-05 13:48 ` Roger Quadros
2016-04-06 6:46 ` Peter Chen
2016-04-06 7:13 ` Roger Quadros
2016-04-19 8:21 ` Peter Chen
2016-03-31 7:08 ` [PATCH v6 0/3] usb: otg-fsm: Add documentation and some trivial cleanups Peter Chen
2016-03-31 9:40 ` Roger Quadros
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=1459331790-29651-3-git-send-email-rogerq@ti.com \
--to=rogerq@ti.com \
--cc=Peter.Chen@nxp.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/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
all inboxes | Powered by JetHome®