Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 340666
b: refs/heads/master
c: 0547fad
h: refs/heads/master
v: v3
  • Loading branch information
Ming Lei authored and David S. Miller committed Nov 7, 2012
1 parent 62dac59 commit 534283b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 6 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: ef468d234753aff7afa96075d3be135b0df1ded0
refs/heads/master: 0547fad2dd7ccaaf3c914ba49073fa37e4e241eb
62 changes: 57 additions & 5 deletions trunk/drivers/net/usb/usbnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1611,8 +1611,8 @@ void usbnet_device_suggests_idle(struct usbnet *dev)
EXPORT_SYMBOL(usbnet_device_suggests_idle);

/*-------------------------------------------------------------------------*/
int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size)
static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size)
{
void *buf = NULL;
int err = -ENOMEM;
Expand All @@ -1636,10 +1636,10 @@ int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
out:
return err;
}
EXPORT_SYMBOL_GPL(usbnet_read_cmd);

int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size)
static int __usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data,
u16 size)
{
void *buf = NULL;
int err = -ENOMEM;
Expand All @@ -1662,8 +1662,56 @@ int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
out:
return err;
}

/*
* The function can't be called inside suspend/resume callback,
* otherwise deadlock will be caused.
*/
int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size)
{
return __usbnet_read_cmd(dev, cmd, reqtype, value, index,
data, size);
}
EXPORT_SYMBOL_GPL(usbnet_read_cmd);

/*
* The function can't be called inside suspend/resume callback,
* otherwise deadlock will be caused.
*/
int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size)
{
return __usbnet_write_cmd(dev, cmd, reqtype, value, index,
data, size);
}
EXPORT_SYMBOL_GPL(usbnet_write_cmd);

/*
* The function can be called inside suspend/resume callback safely
* and should only be called by suspend/resume callback generally.
*/
int usbnet_read_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size)
{
return __usbnet_read_cmd(dev, cmd, reqtype, value, index,
data, size);
}
EXPORT_SYMBOL_GPL(usbnet_read_cmd_nopm);

/*
* The function can be called inside suspend/resume callback safely
* and should only be called by suspend/resume callback generally.
*/
int usbnet_write_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data,
u16 size)
{
return __usbnet_write_cmd(dev, cmd, reqtype, value, index,
data, size);
}
EXPORT_SYMBOL_GPL(usbnet_write_cmd_nopm);

static void usbnet_async_cmd_cb(struct urb *urb)
{
struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context;
Expand All @@ -1677,6 +1725,10 @@ static void usbnet_async_cmd_cb(struct urb *urb)
usb_free_urb(urb);
}

/*
* The caller must make sure that device can't be put into suspend
* state until the control URB completes.
*/
int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size)
{
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/usb/usbnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ extern int usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size);
extern int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size);
extern int usbnet_read_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, void *data, u16 size);
extern int usbnet_write_cmd_nopm(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size);
extern int usbnet_write_cmd_async(struct usbnet *dev, u8 cmd, u8 reqtype,
u16 value, u16 index, const void *data, u16 size);

Expand Down

0 comments on commit 534283b

Please sign in to comment.