summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorOliver Neukum2017-03-14 12:09:56 +0100
committerFelipe Balbi2017-03-22 10:20:52 +0100
commit74098c4ac782afd71b35ac56f9536ae2f5cd7da7 (patch)
treee73898f472e1b8da0a3f6879bd3a44e9f317148c /drivers/usb
parentusb: dwc3: gadget: delay unmap of bounced requests (diff)
downloadkernel-qcow2-linux-74098c4ac782afd71b35ac56f9536ae2f5cd7da7.tar.gz
kernel-qcow2-linux-74098c4ac782afd71b35ac56f9536ae2f5cd7da7.tar.xz
kernel-qcow2-linux-74098c4ac782afd71b35ac56f9536ae2f5cd7da7.zip
usb: gadget: acm: fix endianness in notifications
The gadget code exports the bitfield for serial status changes over the wire in its internal endianness. The fix is to convert to little endian before sending it over the wire. Signed-off-by: Oliver Neukum <oneukum@suse.com> Tested-by: 家瑋 <momo1208@gmail.com> CC: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/gadget/function/f_acm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index a30766ca4226..5e3828d9dac7 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm)
{
struct usb_composite_dev *cdev = acm->port.func.config->cdev;
int status;
+ __le16 serial_state;
spin_lock(&acm->lock);
if (acm->notify_req) {
dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n",
acm->port_num, acm->serial_state);
+ serial_state = cpu_to_le16(acm->serial_state);
status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
- 0, &acm->serial_state, sizeof(acm->serial_state));
+ 0, &serial_state, sizeof(acm->serial_state));
} else {
acm->pending = true;
status = 0;