Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188791
b: refs/heads/master
c: d835933
h: refs/heads/master
i:
  188789: e551adf
  188787: f36ef35
  188783: cf633ec
v: v3
  • Loading branch information
Yoshihiro Shimoda authored and Greg Kroah-Hartman committed Mar 19, 2010
1 parent 33f1b01 commit 5cbfeb1
Show file tree
Hide file tree
Showing 2 changed files with 12 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: 9ce669a8924c61b7321d6e2f27ed67bcd46c1fbb
refs/heads/master: d835933436ac0d1e8f5b35fe809fd4e767e55d6e
16 changes: 11 additions & 5 deletions trunk/drivers/usb/host/r8a66597-hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb)

/* this function must be called with interrupt disabled */
static void free_usb_address(struct r8a66597 *r8a66597,
struct r8a66597_device *dev)
struct r8a66597_device *dev, int reset)
{
int port;

Expand All @@ -430,7 +430,13 @@ static void free_usb_address(struct r8a66597 *r8a66597,
dev->state = USB_STATE_DEFAULT;
r8a66597->address_map &= ~(1 << dev->address);
dev->address = 0;
dev_set_drvdata(&dev->udev->dev, NULL);
/*
* Only when resetting USB, it is necessary to erase drvdata. When
* a usb device with usb hub is disconnect, "dev->udev" is already
* freed on usb_desconnect(). So we cannot access the data.
*/
if (reset)
dev_set_drvdata(&dev->udev->dev, NULL);
list_del(&dev->device_list);
kfree(dev);

Expand Down Expand Up @@ -1069,7 +1075,7 @@ static void r8a66597_usb_disconnect(struct r8a66597 *r8a66597, int port)
struct r8a66597_device *dev = r8a66597->root_hub[port].dev;

disable_r8a66597_pipe_all(r8a66597, dev);
free_usb_address(r8a66597, dev);
free_usb_address(r8a66597, dev, 0);

start_root_hub_sampling(r8a66597, port, 0);
}
Expand Down Expand Up @@ -2085,7 +2091,7 @@ static void update_usb_address_map(struct r8a66597 *r8a66597,
spin_lock_irqsave(&r8a66597->lock, flags);
dev = get_r8a66597_device(r8a66597, addr);
disable_r8a66597_pipe_all(r8a66597, dev);
free_usb_address(r8a66597, dev);
free_usb_address(r8a66597, dev, 0);
put_child_connect_map(r8a66597, addr);
spin_unlock_irqrestore(&r8a66597->lock, flags);
}
Expand Down Expand Up @@ -2228,7 +2234,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
rh->port |= (1 << USB_PORT_FEAT_RESET);

disable_r8a66597_pipe_all(r8a66597, dev);
free_usb_address(r8a66597, dev);
free_usb_address(r8a66597, dev, 1);

r8a66597_mdfy(r8a66597, USBRST, USBRST | UACT,
get_dvstctr_reg(port));
Expand Down

0 comments on commit 5cbfeb1

Please sign in to comment.