Commit 93f8026c authored by Dale Farnsworth's avatar Dale Farnsworth Committed by Greg Kroah-Hartman

[PATCH] USB: USB fixes for non-cache-coherent processors

I posted this before, but didn't see any discussion.

This patch fixes a couple of places where the usb subsystem
DMAs to/from local (stack) variables.  This doesn't work on
non-cache-coherent processors.  I'm testing on PPC 4xx systems.
Signed-off-by: default avatarDale Farnsworth <dale@farnsworth.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent dcf70460
...@@ -3119,12 +3119,18 @@ static void prepmixch(struct consmixstate *state) ...@@ -3119,12 +3119,18 @@ static void prepmixch(struct consmixstate *state)
{ {
struct usb_device *dev = state->s->usbdev; struct usb_device *dev = state->s->usbdev;
struct mixerchannel *ch; struct mixerchannel *ch;
unsigned char buf[2]; unsigned char *buf;
__s16 v1; __s16 v1;
unsigned int v2, v3; unsigned int v2, v3;
if (!state->nrmixch || state->nrmixch > SOUND_MIXER_NRDEVICES) if (!state->nrmixch || state->nrmixch > SOUND_MIXER_NRDEVICES)
return; return;
buf = kmalloc(sizeof(*buf) * 2, GFP_KERNEL);
if (!buf) {
printk(KERN_ERR "prepmixch: out of memory\n") ;
return;
}
ch = &state->mixch[state->nrmixch-1]; ch = &state->mixch[state->nrmixch-1];
switch (ch->selector) { switch (ch->selector) {
case 0: /* mixer unit request */ case 0: /* mixer unit request */
...@@ -3236,13 +3242,16 @@ static void prepmixch(struct consmixstate *state) ...@@ -3236,13 +3242,16 @@ static void prepmixch(struct consmixstate *state)
default: default:
goto err; goto err;
} }
return;
freebuf:
kfree(buf);
return;
err: err:
printk(KERN_ERR "usbaudio: mixer request device %u if %u unit %u ch %u selector %u failed\n", printk(KERN_ERR "usbaudio: mixer request device %u if %u unit %u ch %u selector %u failed\n",
dev->devnum, state->ctrlif, ch->unitid, ch->chnum, ch->selector); dev->devnum, state->ctrlif, ch->unitid, ch->chnum, ch->selector);
if (state->nrmixch) if (state->nrmixch)
state->nrmixch--; state->nrmixch--;
goto freebuf;
} }
......
...@@ -823,9 +823,19 @@ int usb_get_device_descriptor(struct usb_device *dev, unsigned int size) ...@@ -823,9 +823,19 @@ int usb_get_device_descriptor(struct usb_device *dev, unsigned int size)
*/ */
int usb_get_status(struct usb_device *dev, int type, int target, void *data) int usb_get_status(struct usb_device *dev, int type, int target, void *data)
{ {
return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), int ret;
USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, data, 2, u16 *status = kmalloc(sizeof(*status), GFP_KERNEL);
HZ * USB_CTRL_GET_TIMEOUT);
if (!status)
return -ENOMEM;
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, status,
sizeof(*status), HZ * USB_CTRL_GET_TIMEOUT);
*(u16 *)data = *status;
kfree(status);
return ret;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment