USB: cdc-acm: fix runtime PM for control messages

Fix runtime PM handling of control messages by adding the required PM
counter operations.

Fixes: 11ea859d64 ("USB: additional power savings for cdc-acm devices
that support remote wakeup")

Cc: <stable@vger.kernel.org>	# v2.6.27
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Johan Hovold 2014-05-26 19:23:39 +02:00 committed by Greg Kroah-Hartman
parent 140cb81ac8
commit bae3f4c535
1 changed files with 11 additions and 1 deletions

View File

@ -122,13 +122,23 @@ static void acm_release_minor(struct acm *acm)
static int acm_ctrl_msg(struct acm *acm, int request, int value, static int acm_ctrl_msg(struct acm *acm, int request, int value,
void *buf, int len) void *buf, int len)
{ {
int retval = usb_control_msg(acm->dev, usb_sndctrlpipe(acm->dev, 0), int retval;
retval = usb_autopm_get_interface(acm->control);
if (retval)
return retval;
retval = usb_control_msg(acm->dev, usb_sndctrlpipe(acm->dev, 0),
request, USB_RT_ACM, value, request, USB_RT_ACM, value,
acm->control->altsetting[0].desc.bInterfaceNumber, acm->control->altsetting[0].desc.bInterfaceNumber,
buf, len, 5000); buf, len, 5000);
dev_dbg(&acm->control->dev, dev_dbg(&acm->control->dev,
"%s - rq 0x%02x, val %#x, len %#x, result %d\n", "%s - rq 0x%02x, val %#x, len %#x, result %d\n",
__func__, request, value, len, retval); __func__, request, value, len, retval);
usb_autopm_put_interface(acm->control);
return retval < 0 ? retval : 0; return retval < 0 ? retval : 0;
} }