Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232604
b: refs/heads/master
c: 2d8f459
h: refs/heads/master
v: v3
  • Loading branch information
Max Vozeler authored and Greg Kroah-Hartman committed Jan 21, 2011
1 parent 6ed9c9e commit 96cf6d2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 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: 85d139c977dd13cd1ca5cb3b9d8e39cb477eaf0c
refs/heads/master: 2d8f4595d1f275f424a8920bb2563fc547661213
1 change: 1 addition & 0 deletions trunk/drivers/staging/usbip/stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

struct stub_device {
struct usb_interface *interface;
struct usb_device *udev;
struct list_head list;

struct usbip_device ud;
Expand Down
18 changes: 14 additions & 4 deletions trunk/drivers/staging/usbip/stub_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ static void stub_shutdown_connection(struct usbip_device *ud)
static void stub_device_reset(struct usbip_device *ud)
{
struct stub_device *sdev = container_of(ud, struct stub_device, ud);
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
int ret;

usbip_udbg("device reset");

ret = usb_lock_device_for_reset(udev, sdev->interface);
if (ret < 0) {
dev_err(&udev->dev, "lock for reset\n");
Expand Down Expand Up @@ -309,7 +310,8 @@ static void stub_device_unusable(struct usbip_device *ud)
*
* Allocates and initializes a new stub_device struct.
*/
static struct stub_device *stub_device_alloc(struct usb_interface *interface)
static struct stub_device *stub_device_alloc(struct usb_device *udev,
struct usb_interface *interface)
{
struct stub_device *sdev;
int busnum = interface_to_busnum(interface);
Expand All @@ -324,7 +326,8 @@ static struct stub_device *stub_device_alloc(struct usb_interface *interface)
return NULL;
}

sdev->interface = interface;
sdev->interface = usb_get_intf(interface);
sdev->udev = usb_get_dev(udev);

/*
* devid is defined with devnum when this driver is first allocated.
Expand Down Expand Up @@ -450,11 +453,12 @@ static int stub_probe(struct usb_interface *interface,
return err;
}

usb_get_intf(interface);
return 0;
}

/* ok. this is my device. */
sdev = stub_device_alloc(interface);
sdev = stub_device_alloc(udev, interface);
if (!sdev)
return -ENOMEM;

Expand All @@ -476,6 +480,8 @@ static int stub_probe(struct usb_interface *interface,
dev_err(&interface->dev, "create sysfs files for %s\n",
udev_busid);
usb_set_intfdata(interface, NULL);
usb_put_intf(interface);

busid_priv->interf_count = 0;

busid_priv->sdev = NULL;
Expand Down Expand Up @@ -545,6 +551,7 @@ static void stub_disconnect(struct usb_interface *interface)
if (busid_priv->interf_count > 1) {
busid_priv->interf_count--;
shutdown_busid(busid_priv);
usb_put_intf(interface);
return;
}

Expand All @@ -554,6 +561,9 @@ static void stub_disconnect(struct usb_interface *interface)
/* 1. shutdown the current connection */
shutdown_busid(busid_priv);

usb_put_dev(sdev->udev);
usb_put_intf(interface);

/* 3. free sdev */
busid_priv->sdev = NULL;
stub_device_free(sdev);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/usbip/stub_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ static struct stub_priv *stub_priv_alloc(struct stub_device *sdev,

static int get_pipe(struct stub_device *sdev, int epnum, int dir)
{
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
struct usb_host_endpoint *ep;
struct usb_endpoint_descriptor *epd = NULL;

Expand Down Expand Up @@ -484,7 +484,7 @@ static void stub_recv_cmd_submit(struct stub_device *sdev,
int ret;
struct stub_priv *priv;
struct usbip_device *ud = &sdev->ud;
struct usb_device *udev = interface_to_usbdev(sdev->interface);
struct usb_device *udev = sdev->udev;
int pipe = get_pipe(sdev, pdu->base.ep, pdu->base.direction);


Expand Down

0 comments on commit 96cf6d2

Please sign in to comment.