summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Jun <jun.li@freescale.com>2015-06-29 18:05:26 +0800
committerLi Jun <jun.li@freescale.com>2015-07-22 10:22:07 +0800
commit207c62380be1879288ab018af888bb2b5e346d3f (patch)
treee0668d741d6275cbe8aba1a5b2d728146e4a532e
parentf0c63b894a60512318481cb8a7b0777cdb7c46ab (diff)
MLK-11200 usb: otg: avoid DMA to kernel stack for HNP polling
HNP polling uses a kernel stack variable when sending the HNP polling control message, which causes dma-debug to complain, fix it by adding host_req_flag to otg_fsm struct, so it's done by kmallocing. Signed-off-by: Li Jun <jun.li@freescale.com> (cherry picked from commit 05b5f53b2c4d71761454b47852d5c5a48c5cc93a)
-rw-r--r--drivers/usb/common/usb-otg-fsm.c8
-rw-r--r--include/linux/usb/otg-fsm.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 7c598489cd86..c1075f4d5d67 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -432,7 +432,6 @@ static int otg_handle_role_switch(struct otg_fsm *fsm, struct usb_device *udev)
int otg_hnp_polling(struct otg_fsm *fsm)
{
struct usb_device *udev;
- u8 host_req_flag;
int retval;
enum usb_otg_state state = fsm->otg->state;
struct usb_otg_descriptor *desc = NULL;
@@ -471,6 +470,7 @@ int otg_hnp_polling(struct otg_fsm *fsm)
}
}
+ fsm->host_req_flag = 0;
/* Get host request flag from connected USB device */
retval = usb_control_msg(udev,
usb_rcvctrlpipe(udev, 0),
@@ -478,13 +478,13 @@ int otg_hnp_polling(struct otg_fsm *fsm)
USB_DIR_IN | USB_RECIP_DEVICE,
0,
OTG_STS_SELECTOR,
- &host_req_flag,
+ &fsm->host_req_flag,
1,
USB_CTRL_GET_TIMEOUT);
if (retval == 1) {
- if (host_req_flag == HOST_REQUEST_FLAG) {
+ if (fsm->host_req_flag == HOST_REQUEST_FLAG) {
retval = otg_handle_role_switch(fsm, udev);
- } else if (host_req_flag == 0) {
+ } else if (fsm->host_req_flag == 0) {
/* Continue polling */
otg_add_timer(fsm, HNP_POLLING);
retval = 0;
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index ef3b770ce777..74e4d6345ec1 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -143,6 +143,7 @@ struct otg_fsm {
/* Current usb protocol used: 0:undefine; 1:host; 2:client */
int protocol;
struct mutex lock;
+ u8 host_req_flag;
};
struct otg_fsm_ops {