Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268670
b: refs/heads/master
c: c411f17
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Oct 4, 2011
1 parent 20fbaf6 commit 103f224
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 51 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: 8ec31f9385fdcd7c71fa0078deb0e84840f3cb49
refs/heads/master: c411f17daf0942509f6db47b4a237e953f35611b
53 changes: 3 additions & 50 deletions trunk/drivers/staging/hv/hv_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *device)

static void free_input_device(struct mousevsc_dev *device)
{
WARN_ON(atomic_read(&device->ref_count) != 0);
kfree(device->hid_desc);
kfree(device->report_desc);
hv_set_drvdata(device->device, NULL);
kfree(device);
}

Expand Down Expand Up @@ -229,39 +229,6 @@ static void put_input_device(struct hv_device *device)
atomic_dec(&input_dev->ref_count);
}

/*
* Drop ref count to 1 to effectively disable get_input_device()
*/
static struct mousevsc_dev *release_input_device(struct hv_device *device)
{
struct mousevsc_dev *input_dev;

input_dev = hv_get_drvdata(device);

/* Busy wait until the ref drop to 2, then set it to 1 */
while (atomic_cmpxchg(&input_dev->ref_count, 2, 1) != 2)
udelay(100);

return input_dev;
}

/*
* Drop ref count to 0. No one can use input_device object.
*/
static struct mousevsc_dev *final_release_input_device(struct hv_device *device)
{
struct mousevsc_dev *input_dev;

input_dev = hv_get_drvdata(device);

/* Busy wait until the ref drop to 1, then set it to 0 */
while (atomic_cmpxchg(&input_dev->ref_count, 1, 0) != 1)
udelay(100);

hv_set_drvdata(device, NULL);
return input_dev;
}


static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
struct synthhid_device_info *device_info)
Expand Down Expand Up @@ -673,28 +640,14 @@ static int mousevsc_remove(struct hv_device *dev)
{
struct mousevsc_dev *input_dev = hv_get_drvdata(dev);

vmbus_close(dev->channel);

if (input_dev->connected) {
hidinput_disconnect(input_dev->hid_device);
input_dev->connected = 0;
hid_destroy_device(input_dev->hid_device);
}


release_input_device(dev);


/*
* At this point, all outbound traffic should be disable. We only
* allow inbound traffic (responses) to proceed
*
* so that outstanding requests can be completed.
*/

input_dev = final_release_input_device(dev);

/* Close the channel */
vmbus_close(dev->channel);

free_input_device(input_dev);

return 0;
Expand Down

0 comments on commit 103f224

Please sign in to comment.