Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 67806
b: refs/heads/master
c: d617bc8
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Oct 12, 2007
1 parent 664cc81 commit 3d457c2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 18ea5d00d05fa6300606f0711748016c95fb26dc
refs/heads/master: d617bc83ff48ebf0df253605529d8b3bef15773a
5 changes: 0 additions & 5 deletions trunk/drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,11 +1074,6 @@ int usb_hcd_unlink_urb (struct urb *urb, int status)
struct list_head *tmp;
int retval;

if (!urb)
return -EINVAL;
if (!urb->dev || !urb->dev->bus)
return -ENODEV;

/*
* we contend for urb->status with the hcd core,
* which changes it while returning the urb.
Expand Down
13 changes: 7 additions & 6 deletions trunk/drivers/usb/core/urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/log2.h>
#include <linux/usb.h>
#include <linux/wait.h>
#include "hcd.h"
Expand Down Expand Up @@ -441,10 +442,8 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
default:
return -EINVAL;
}
/* power of two? */
while (max > urb->interval)
max >>= 1;
urb->interval = max;
/* Round down to a power of 2, no more than max */
urb->interval = min(max, 1 << ilog2(urb->interval));
}

return usb_hcd_submit_urb(urb, mem_flags);
Expand Down Expand Up @@ -513,8 +512,10 @@ int usb_unlink_urb(struct urb *urb)
{
if (!urb)
return -EINVAL;
if (!(urb->dev && urb->dev->bus))
if (!urb->dev)
return -ENODEV;
if (!urb->ep)
return -EIDRM;
return usb_hcd_unlink_urb(urb, -ECONNRESET);
}

Expand All @@ -541,7 +542,7 @@ int usb_unlink_urb(struct urb *urb)
void usb_kill_urb(struct urb *urb)
{
might_sleep();
if (!(urb && urb->dev && urb->dev->bus))
if (!(urb && urb->dev && urb->ep))
return;
spin_lock_irq(&urb->lock);
++urb->reject;
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
*/
static inline int usb_urb_dir_in(struct urb *urb)
{
return (urb->transfer_flags & URB_DIR_MASK) != URB_DIR_OUT;
return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN;
}

/**
Expand Down

0 comments on commit 3d457c2

Please sign in to comment.