Commit 9123f528 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Paul Mackerras

Added mem_flags to usb_submit_urb().

This modifies the drivers in drivers/usb.
Patch done by Oliver Neukum.
parent e0b5c524
......@@ -1144,18 +1144,18 @@ static void * CDCEther_probe( struct usb_device *usb, unsigned int ifnum,
// Zero everything out.
memset(ether_dev, 0, sizeof(ether_dev_t));
ether_dev->rx_urb = usb_alloc_urb(0);
ether_dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ether_dev->rx_urb) {
kfree(ether_dev);
return NULL;
}
ether_dev->tx_urb = usb_alloc_urb(0);
ether_dev->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ether_dev->tx_urb) {
usb_free_urb(ether_dev->rx_urb);
kfree(ether_dev);
return NULL;
}
ether_dev->intr_urb = usb_alloc_urb(0);
ether_dev->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ether_dev->intr_urb) {
usb_free_urb(ether_dev->tx_urb);
usb_free_urb(ether_dev->rx_urb);
......
......@@ -2829,14 +2829,14 @@ static void usb_audio_parsestreaming(struct usb_audio_state *s, unsigned char *b
init_waitqueue_head(&as->usbin.dma.wait);
init_waitqueue_head(&as->usbout.dma.wait);
spin_lock_init(&as->lock);
as->usbin.durb[0].urb = usb_alloc_urb(0);
as->usbin.durb[1].urb = usb_alloc_urb(0);
as->usbin.surb[0].urb = usb_alloc_urb(0);
as->usbin.surb[1].urb = usb_alloc_urb(0);
as->usbout.durb[0].urb = usb_alloc_urb(0);
as->usbout.durb[1].urb = usb_alloc_urb(0);
as->usbout.surb[0].urb = usb_alloc_urb(0);
as->usbout.surb[1].urb = usb_alloc_urb(0);
as->usbin.durb[0].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbin.durb[1].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbin.surb[0].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbin.surb[1].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbout.durb[0].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbout.durb[1].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbout.surb[0].urb = usb_alloc_urb(0, GFP_KERNEL);
as->usbout.surb[1].urb = usb_alloc_urb(0, GFP_KERNEL);
if ((!as->usbin.durb[0].urb) ||
(!as->usbin.durb[1].urb) ||
(!as->usbin.surb[0].urb) ||
......
......@@ -699,7 +699,7 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi
dr = kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL);
if (!dr)
return -ENOMEM;
urb = usb_alloc_urb (0);
urb = usb_alloc_urb (0, GFP_KERNEL);
if (!urb) {
kfree (dr);
return -ENOMEM;
......@@ -802,7 +802,7 @@ static int auerbuf_setup (pauerbufctl_t bcp, unsigned int numElements, unsigned
if (!bep->bufp) goto bl_fail;
bep->dr = (struct usb_ctrlrequest *) kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL);
if (!bep->dr) goto bl_fail;
bep->urbp = usb_alloc_urb (0);
bep->urbp = usb_alloc_urb (0, GFP_KERNEL);
if (!bep->urbp) goto bl_fail;
list_add_tail (&bep->buff_list, &bcp->free_buff_list);
}
......@@ -1130,7 +1130,7 @@ static int auerswald_int_open (pauerswald_t cp)
/* allocate the urb and data buffer */
if (!cp->inturbp) {
cp->inturbp = usb_alloc_urb (0);
cp->inturbp = usb_alloc_urb (0, GFP_KERNEL);
if (!cp->inturbp) {
ret = -ENOMEM;
goto intoend;
......
......@@ -1123,7 +1123,7 @@ static void * usb_bluetooth_probe(struct usb_device *dev, unsigned int ifnum,
/* create our control out urb pool */
for (i = 0; i < NUM_CONTROL_URBS; ++i) {
struct urb *urb = usb_alloc_urb(0);
struct urb *urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) {
err("No free urbs available");
goto probe_error;
......@@ -1134,7 +1134,7 @@ static void * usb_bluetooth_probe(struct usb_device *dev, unsigned int ifnum,
/* set up the endpoint information */
endpoint = bulk_in_endpoint[0];
bluetooth->read_urb = usb_alloc_urb (0);
bluetooth->read_urb = usb_alloc_urb (0, GFP_KERNEL);
if (!bluetooth->read_urb) {
err("No free urbs available");
goto probe_error;
......@@ -1154,7 +1154,7 @@ static void * usb_bluetooth_probe(struct usb_device *dev, unsigned int ifnum,
/* create our write urb pool */
for (i = 0; i < NUM_BULK_URBS; ++i) {
struct urb *urb = usb_alloc_urb(0);
struct urb *urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL) {
err("No free urbs available");
goto probe_error;
......@@ -1170,7 +1170,7 @@ static void * usb_bluetooth_probe(struct usb_device *dev, unsigned int ifnum,
bluetooth->bulk_out_buffer_size = endpoint->wMaxPacketSize * 2;
endpoint = interrupt_in_endpoint[0];
bluetooth->interrupt_in_urb = usb_alloc_urb(0);
bluetooth->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!bluetooth->interrupt_in_urb) {
err("No free urbs available");
goto probe_error;
......
......@@ -694,10 +694,10 @@ static void *catc_probe(struct usb_device *usbdev, unsigned int ifnum, const str
catc->timer.data = (long) catc;
catc->timer.function = catc_stats_timer;
catc->ctrl_urb = usb_alloc_urb(0);
catc->tx_urb = usb_alloc_urb(0);
catc->rx_urb = usb_alloc_urb(0);
catc->irq_urb = usb_alloc_urb(0);
catc->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
catc->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
if ((!catc->ctrl_urb) || (!catc->tx_urb) ||
(!catc->rx_urb) || (!catc->irq_urb)) {
err("No free urbs available.");
......
......@@ -226,7 +226,7 @@ static int dabusb_alloc_buffers (pdabusb_t s)
}
memset (b, 0, sizeof (buff_t));
b->s = s;
b->purb = usb_alloc_urb(packets);
b->purb = usb_alloc_urb(packets, GFP_KERNEL);
if (!b->purb) {
err("usb_alloc_urb == NULL");
kfree (b);
......
......@@ -181,7 +181,7 @@ static struct async *alloc_async(unsigned int numisoframes)
if (!as)
return NULL;
memset(as, 0, assize);
as->urb = usb_alloc_urb(numisoframes);
as->urb = usb_alloc_urb(numisoframes, GFP_KERNEL);
if (!as->urb) {
kfree(as);
return NULL;
......
......@@ -1311,14 +1311,14 @@ static struct hid_device *usb_hid_configure(struct usb_device *dev, int ifnum)
if (endpoint->bEndpointAddress & USB_DIR_IN) {
if (hid->urbin)
continue;
if (!(hid->urbin = usb_alloc_urb(0)))
if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
FILL_INT_URB(hid->urbin, dev, pipe, hid->inbuf, 0, hid_irq_in, hid, endpoint->bInterval);
} else {
if (hid->urbout)
continue;
if (!(hid->urbout = usb_alloc_urb(0)))
if (!(hid->urbout = usb_alloc_urb(0, GFP_KERNEL)))
goto fail;
pipe = usb_sndbulkpipe(dev, endpoint->bEndpointAddress);
FILL_BULK_URB(hid->urbout, dev, pipe, hid->outbuf, 0, hid_irq_out, hid);
......@@ -1360,7 +1360,7 @@ static struct hid_device *usb_hid_configure(struct usb_device *dev, int ifnum)
kfree(buf);
hid->urbctrl = usb_alloc_urb(0);
hid->urbctrl = usb_alloc_urb(0, GFP_KERNEL);
FILL_CONTROL_URB(hid->urbctrl, dev, 0, (void*) &hid->cr, hid->ctrlbuf, 1, hid_ctrl, hid);
return hid;
......
......@@ -56,12 +56,12 @@ hpusbscsi_usb_probe (struct usb_device *dev, unsigned int interface,
return NULL;
DEBUG ("Allocated memory\n");
memset (new, 0, sizeof (struct hpusbscsi));
new->dataurb = usb_alloc_urb(0);
new->dataurb = usb_alloc_urb(0, GFP_KERNEL);
if (!new->dataurb) {
kfree (new);
return NULL;
}
new->controlurb = usb_alloc_urb(0);
new->controlurb = usb_alloc_urb(0, GFP_KERNEL);
if (!new->controlurb) {
usb_free_urb (new->dataurb);
kfree (new);
......
......@@ -873,8 +873,8 @@ static void *kaweth_probe(
kaweth_dbg("Initializing net device.");
kaweth->tx_urb = usb_alloc_urb(0);
kaweth->rx_urb = usb_alloc_urb(0);
kaweth->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
kaweth->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
kaweth->net = init_etherdev(0, 0);
if (!kaweth->net) {
......@@ -977,7 +977,7 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&awd.wqh, &wait);
urb->context = &awd;
status = usb_submit_urb(urb, GFP_KERNEL);
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
// something went wrong
usb_free_urb(urb);
......@@ -1020,7 +1020,7 @@ int kaweth_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe,
int retv;
int length;
urb = usb_alloc_urb(0);
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb)
return -ENOMEM;
......
......@@ -629,7 +629,7 @@ static void *konicawc_probe(struct usb_device *dev, unsigned int ifnum ,const st
/* Here uvd is a fully allocated uvd_t object */
for(i = 0; i < USBVIDEO_NUMSBUF; i++) {
konicawc_data->sts_urb[i] = usb_alloc_urb(FRAMES_PER_DESC);
konicawc_data->sts_urb[i] = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
}
switch(size) {
......
......@@ -969,9 +969,9 @@ int __init usb_mdc800_init (void)
try (mdc800->write_urb_buffer=kmalloc (8, GFP_KERNEL));
try (mdc800->download_urb_buffer=kmalloc (64, GFP_KERNEL));
try (mdc800->irq_urb=usb_alloc_urb (0));
try (mdc800->download_urb=usb_alloc_urb (0));
try (mdc800->write_urb=usb_alloc_urb (0));
try (mdc800->irq_urb=usb_alloc_urb (0, GFP_KERNEL));
try (mdc800->download_urb=usb_alloc_urb (0, GFP_KERNEL));
try (mdc800->write_urb=usb_alloc_urb (0, GFP_KERNEL));
/* Register the driver */
if (usb_register (&mdc800_usb_driver) < 0)
......
......@@ -936,7 +936,7 @@ static void * mts_usb_probe (struct usb_device *dev, unsigned int interface,
}
memset( new_desc, 0, sizeof(*new_desc) );
new_desc->urb = usb_alloc_urb(0);
new_desc->urb = usb_alloc_urb(0, GFP_KERNEL);
if (!new_desc->urb) {
kfree(new_desc);
return NULL;
......
......@@ -4426,7 +4426,7 @@ ov511_init_isoc(struct usb_ov511 *ov511)
}
for (n = 0; n < OV511_NUMSBUF; n++) {
urb = usb_alloc_urb(FRAMES_PER_DESC);
urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
if (!urb) {
err("init isoc: usb_alloc_urb ret. NULL");
......
......@@ -858,25 +858,25 @@ static void * pegasus_probe( struct usb_device *dev, unsigned int ifnum,
pegasus->dev_index = dev_index;
init_waitqueue_head( &pegasus->ctrl_wait );
pegasus->ctrl_urb = usb_alloc_urb(0);
pegasus->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->ctrl_urb) {
kfree (pegasus);
return NULL;
}
pegasus->rx_urb = usb_alloc_urb(0);
pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->rx_urb) {
usb_free_urb (pegasus->ctrl_urb);
kfree (pegasus);
return NULL;
}
pegasus->tx_urb = usb_alloc_urb(0);
pegasus->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->tx_urb) {
usb_free_urb (pegasus->rx_urb);
usb_free_urb (pegasus->ctrl_urb);
kfree (pegasus);
return NULL;
}
pegasus->intr_urb = usb_alloc_urb(0);
pegasus->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!pegasus->intr_urb) {
usb_free_urb (pegasus->tx_urb);
usb_free_urb (pegasus->rx_urb);
......
......@@ -827,7 +827,7 @@ static int pwc_isoc_init(struct pwc_device *pdev)
ret = 0;
for (i = 0; i < MAX_ISO_BUFS; i++) {
urb = usb_alloc_urb(ISO_FRAMES_PER_DESC);
urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL);
if (urb == NULL) {
Err("Failed to allocate urb %d\n", i);
ret = -ENOMEM;
......
......@@ -974,7 +974,7 @@ probe_scanner(struct usb_device *dev, unsigned int ifnum,
}
memset (scn, 0, sizeof(struct scn_usb_data));
scn->scn_irq = usb_alloc_urb(0);
scn->scn_irq = usb_alloc_urb(0, GFP_KERNEL);
if (!scn->scn_irq) {
kfree(scn);
up(&scn_mutex);
......
......@@ -644,7 +644,7 @@ static int se401_start_stream(struct usb_se401 *se401)
}
for (i=0; i<SE401_NUMSBUF; i++) {
urb=usb_alloc_urb(0);
urb=usb_alloc_urb(0, GFP_KERNEL);
if(!urb)
return ENOMEM;
......@@ -1465,7 +1465,7 @@ static int se401_init(struct usb_se401 *se401)
se401->readcount=0;
/* Start interrupt transfers for snapshot button */
se401->inturb=usb_alloc_urb(0);
se401->inturb=usb_alloc_urb(0, GFP_KERNEL);
if (!se401->inturb) {
info("Allocation of inturb failed");
return 1;
......
......@@ -804,7 +804,7 @@ static int stv680_start_stream (struct usb_stv *stv680)
}
for (i = 0; i < STV680_NUMSBUF; i++) {
urb = usb_alloc_urb (0);
urb = usb_alloc_urb (0, GFP_KERNEL);
if (!urb)
return ENOMEM;
......
......@@ -573,7 +573,8 @@ static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const stru
if (((endpoint->bEndpointAddress & 0x80) == 0x00) &&
((endpoint->bmAttributes & 3) == 0x02)) {
/* we found a bulk out endpoint */
dev->write_urb = usb_alloc_urb(0);
/* a probe() may sleep and has no restrictions on memory allocations */
dev->write_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!dev->write_urb) {
err("No free urbs available");
goto error;
......
......@@ -196,12 +196,12 @@ static void *usb_kbd_probe(struct usb_device *dev, unsigned int ifnum,
if (!(kbd = kmalloc(sizeof(struct usb_kbd), GFP_KERNEL))) return NULL;
memset(kbd, 0, sizeof(struct usb_kbd));
kbd->irq = usb_alloc_urb(0);
kbd->irq = usb_alloc_urb(0, GFP_KERNEL);
if (!kbd->irq) {
kfree(kbd);
return NULL;
}
kbd->led = usb_alloc_urb(0);
kbd->led = usb_alloc_urb(0, GFP_KERNEL);
if (!kbd->led) {
usb_free_urb(kbd->irq);
kfree(kbd);
......
......@@ -122,7 +122,7 @@ static void *usb_mouse_probe(struct usb_device *dev, unsigned int ifnum,
if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) return NULL;
memset(mouse, 0, sizeof(struct usb_mouse));
mouse->irq = usb_alloc_urb(0);
mouse->irq = usb_alloc_urb(0, GFP_KERNEL);
if (!mouse->irq) {
kfree(mouse);
return NULL;
......
......@@ -420,7 +420,7 @@ static int genelink_init (struct usbnet *dev)
}
// allocate irq urb
if ((priv->irq_urb = usb_alloc_urb (0)) == 0) {
if ((priv->irq_urb = usb_alloc_urb (0, GFP_KERNEL)) == 0) {
dbg ("%s: cannot allocate private irq urb per device",
dev->net.name);
kfree (priv);
......@@ -1589,7 +1589,7 @@ static int usbnet_start_xmit (struct sk_buff *skb, struct net_device *net)
}
}
if (!(urb = usb_alloc_urb (0))) {
if (!(urb = usb_alloc_urb (0, GFP_ATOMIC))) {
dbg ("no urb");
goto drop;
}
......@@ -1723,7 +1723,7 @@ static void usbnet_bh (unsigned long param)
struct urb *urb;
int i;
for (i = 0; i < 3 && dev->rxq.qlen < RX_QLEN; i++) {
if ((urb = usb_alloc_urb (0)) != 0)
if ((urb = usb_alloc_urb (0, GFP_ATOMIC)) != 0)
rx_submit (dev, urb, GFP_ATOMIC);
}
if (temp != dev->rxq.qlen)
......
......@@ -1077,7 +1077,7 @@ uvd_t *usbvideo_AllocateDevice(usbvideo_t *cams)
down(&uvd->lock);
for (i=0; i < USBVIDEO_NUMSBUF; i++) {
uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC);
uvd->sbuf[i].urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
if (uvd->sbuf[i].urb == NULL) {
err("usb_alloc_urb(%d.) failed.", FRAMES_PER_DESC);
uvd->uvd_used = 0;
......
......@@ -884,7 +884,7 @@ static void * __devinit vicam_probe(struct usb_device *udev, unsigned int ifnum,
}
memset(vicam, 0, sizeof(*vicam));
vicam->readurb = usb_alloc_urb(0);
vicam->readurb = usb_alloc_urb(0, GFP_KERNEL);
if (!vicam->readurb) {
kfree(vicam);
return NULL;
......
......@@ -359,7 +359,7 @@ static void *wacom_probe(struct usb_device *dev, unsigned int ifnum, const struc
if (!(wacom = kmalloc(sizeof(struct wacom), GFP_KERNEL))) return NULL;
memset(wacom, 0, sizeof(struct wacom));
wacom->irq = usb_alloc_urb(0);
wacom->irq = usb_alloc_urb(0, GFP_KERNEL);
if (!wacom->irq) {
kfree(wacom);
return NULL;
......
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