Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236327
b: refs/heads/master
c: 6bad88d
h: refs/heads/master
i:
  236325: a83a16e
  236323: 5c44b1b
  236319: b122512
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Mar 7, 2011
1 parent e2c26db commit e607e8e
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 102 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: d5889771a4acd321ad6f1242b3186cf4a47d7d55
refs/heads/master: 6bad88dac0e648c6978a02c6afb0dc2f4fa484bb
16 changes: 7 additions & 9 deletions trunk/drivers/staging/hv/blkvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct blkvsc_request {
/* Per device structure */
struct block_device_context {
/* point back to our device context */
struct vm_device *device_ctx;
struct hv_device *device_ctx;
struct kmem_cache *request_pool;
spinlock_t lock;
struct gendisk *gd;
Expand Down Expand Up @@ -240,8 +240,7 @@ static int blkvsc_probe(struct device *device)
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj =
drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);

struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
Expand Down Expand Up @@ -273,7 +272,7 @@ static int blkvsc_probe(struct device *device)
/* ASSERT(sizeof(struct blkvsc_request_group) <= */
/* sizeof(struct blkvsc_request)); */

blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device),
blkdev->request_pool = kmem_cache_create(dev_name(&device_obj->device),
sizeof(struct blkvsc_request) +
storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
Expand All @@ -290,7 +289,7 @@ static int blkvsc_probe(struct device *device)
goto Cleanup;
}

blkdev->device_ctx = device_ctx;
blkdev->device_ctx = device_obj;
/* this identified the device 0 or 1 */
blkdev->target = device_info.target_id;
/* this identified the ide ctrl 0 or 1 */
Expand Down Expand Up @@ -723,8 +722,7 @@ static int blkvsc_remove(struct device *device)
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj =
drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
int ret;
Expand Down Expand Up @@ -839,7 +837,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
void (*request_completion)(struct hv_storvsc_request *))
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct vm_device *device_ctx = blkdev->device_ctx;
struct hv_device *device_ctx = blkdev->device_ctx;
struct hv_driver *drv =
drv_to_hv_drv(device_ctx->device.driver);
struct storvsc_driver_object *storvsc_drv_obj =
Expand Down Expand Up @@ -884,7 +882,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;

ret = storvsc_drv_obj->on_io_request(&blkdev->device_ctx->device_obj,
ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
Expand Down
19 changes: 7 additions & 12 deletions trunk/drivers/staging/hv/hv_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ static void MousevscOnCleanup(struct hv_driver *drv)
* Data types
*/
struct input_device_context {
struct vm_device *device_ctx;
struct hv_device *device_ctx;
struct hid_device *hid_device;
struct hv_input_dev_info device_info;
int connected;
Expand All @@ -782,9 +782,8 @@ static struct mousevsc_drv_obj g_mousevsc_drv;

static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info *info)
{
struct vm_device *device_ctx = to_vm_device(dev);
struct input_device_context *input_device_ctx =
dev_get_drvdata(&device_ctx->device);
dev_get_drvdata(&dev->device);

memcpy(&input_device_ctx->device_info, info,
sizeof(struct hv_input_dev_info));
Expand All @@ -796,9 +795,8 @@ static void inputreport_callback(struct hv_device *dev, void *packet, u32 len)
{
int ret = 0;

struct vm_device *device_ctx = to_vm_device(dev);
struct input_device_context *input_dev_ctx =
dev_get_drvdata(&device_ctx->device);
dev_get_drvdata(&dev->device);

ret = hid_input_report(input_dev_ctx->hid_device,
HID_INPUT_REPORT, packet, len, 1);
Expand All @@ -823,8 +821,7 @@ static int mousevsc_probe(struct device *device)
drv_to_hv_drv(device->driver);
struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv;

struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct input_device_context *input_dev_ctx;

input_dev_ctx = kmalloc(sizeof(struct input_device_context),
Expand Down Expand Up @@ -852,8 +849,7 @@ static int mousevsc_remove(struct device *device)
drv_to_hv_drv(device->driver);
struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv;

struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct input_device_context *input_dev_ctx;

input_dev_ctx = kmalloc(sizeof(struct input_device_context),
Expand Down Expand Up @@ -887,9 +883,8 @@ static int mousevsc_remove(struct device *device)

static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len)
{
struct vm_device *device_ctx = to_vm_device(dev);
struct input_device_context *input_device_ctx =
dev_get_drvdata(&device_ctx->device);
dev_get_drvdata(&dev->device);
struct hid_device *hid_dev;

/* hid_debug = -1; */
Expand All @@ -910,7 +905,7 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len)
hid_dev->vendor = input_device_ctx->device_info.vendor;
hid_dev->product = input_device_ctx->device_info.product;
hid_dev->version = input_device_ctx->device_info.version;
hid_dev->dev = device_ctx->device;
hid_dev->dev = dev->device;

sprintf(hid_dev->name, "%s",
input_device_ctx->device_info.name);
Expand Down
24 changes: 10 additions & 14 deletions trunk/drivers/staging/hv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

struct net_device_context {
/* point back to our device context */
struct vm_device *device_ctx;
struct hv_device *device_ctx;
unsigned long avail;
};

Expand All @@ -70,7 +70,7 @@ static void netvsc_set_multicast_list(struct net_device *net)
static int netvsc_open(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
struct hv_device *device_obj = net_device_ctx->device_ctx;
int ret = 0;

if (netif_carrier_ok(net)) {
Expand All @@ -93,7 +93,7 @@ static int netvsc_open(struct net_device *net)
static int netvsc_close(struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
struct hv_device *device_obj = net_device_ctx->device_ctx;
int ret;

netif_stop_queue(net);
Expand Down Expand Up @@ -190,7 +190,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
packet->completion.send.send_completion_ctx = packet;
packet->completion.send.send_completion_tid = (unsigned long)skb;

ret = net_drv_obj->send(&net_device_ctx->device_ctx->device_obj,
ret = net_drv_obj->send(net_device_ctx->device_ctx,
packet);
if (ret == 0) {
net->stats.tx_bytes += skb->len;
Expand Down Expand Up @@ -218,8 +218,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
static void netvsc_linkstatus_callback(struct hv_device *device_obj,
unsigned int status)
{
struct vm_device *device_ctx = to_vm_device(device_obj);
struct net_device *net = dev_get_drvdata(&device_ctx->device);
struct net_device *net = dev_get_drvdata(&device_obj->device);

if (!net) {
DPRINT_ERR(NETVSC_DRV, "got link status but net device "
Expand All @@ -244,8 +243,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
static int netvsc_recv_callback(struct hv_device *device_obj,
struct hv_netvsc_packet *packet)
{
struct vm_device *device_ctx = to_vm_device(device_obj);
struct net_device *net = dev_get_drvdata(&device_ctx->device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
struct sk_buff *skb;
void *data;
int i;
Expand Down Expand Up @@ -335,8 +333,7 @@ static int netvsc_probe(struct device *device)
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct netvsc_driver *net_drv_obj = drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct netvsc_device_info device_info;
Expand All @@ -353,7 +350,7 @@ static int netvsc_probe(struct device *device)
netif_carrier_off(net);

net_device_ctx = netdev_priv(net);
net_device_ctx->device_ctx = device_ctx;
net_device_ctx->device_ctx = device_obj;
net_device_ctx->avail = ring_size;
dev_set_drvdata(device, net);

Expand Down Expand Up @@ -405,9 +402,8 @@ static int netvsc_remove(struct device *device)
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct netvsc_driver *net_drv_obj = drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct net_device *net = dev_get_drvdata(&device_ctx->device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret;

if (net == NULL) {
Expand Down
24 changes: 11 additions & 13 deletions trunk/drivers/staging/hv/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct host_device_context {
/* must be 1st field
* FIXME this is a bug */
/* point back to our device context */
struct vm_device *device_ctx;
struct hv_device *device_ctx;
struct kmem_cache *request_pool;
unsigned int port;
unsigned char path;
Expand Down Expand Up @@ -216,8 +216,7 @@ static int storvsc_probe(struct device *device)
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj = drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
struct storvsc_device_info device_info;
Expand All @@ -238,10 +237,10 @@ static int storvsc_probe(struct device *device)
memset(host_device_ctx, 0, sizeof(struct host_device_context));

host_device_ctx->port = host->host_no;
host_device_ctx->device_ctx = device_ctx;
host_device_ctx->device_ctx = device_obj;

host_device_ctx->request_pool =
kmem_cache_create(dev_name(&device_ctx->device),
kmem_cache_create(dev_name(&device_obj->device),
sizeof(struct storvsc_cmd_request) +
storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
Expand Down Expand Up @@ -298,8 +297,7 @@ static int storvsc_remove(struct device *device)
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj = drv->priv;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
struct hv_device *device_obj = device_to_hv_device(device);
struct Scsi_Host *host = dev_get_drvdata(device);
struct host_device_context *host_device_ctx =
(struct host_device_context *)host->hostdata;
Expand Down Expand Up @@ -589,7 +587,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
int ret;
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
struct vm_device *device_ctx = host_device_ctx->device_ctx;
struct hv_device *device_ctx = host_device_ctx->device_ctx;
struct hv_driver *drv =
drv_to_hv_drv(device_ctx->device.driver);
struct storvsc_driver_object *storvsc_drv_obj = drv->priv;
Expand Down Expand Up @@ -737,7 +735,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

retry_request:
/* Invokes the vsc to start an IO */
ret = storvsc_drv_obj->on_io_request(&device_ctx->device_obj,
ret = storvsc_drv_obj->on_io_request(device_ctx,
&cmd_request->request);
if (ret == -1) {
/* no more space */
Expand Down Expand Up @@ -824,18 +822,18 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
int ret;
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
struct vm_device *device_ctx = host_device_ctx->device_ctx;
struct hv_device *device_ctx = host_device_ctx->device_ctx;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...",
scmnd->device, &device_ctx->device_obj);
scmnd->device, device_ctx);

/* Invokes the vsc to reset the host/bus */
ret = stor_vsc_on_host_reset(&device_ctx->device_obj);
ret = stor_vsc_on_host_reset(device_ctx);
if (ret != 0)
return ret;

DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted",
scmnd->device, &device_ctx->device_obj);
scmnd->device, device_ctx);

return ret;
}
Expand Down
12 changes: 2 additions & 10 deletions trunk/drivers/staging/hv/vmbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,11 @@
#include "vmbus_api.h"


struct vm_device {
struct hv_device device_obj;
struct device device;
};

static inline struct vm_device *to_vm_device(struct hv_device *d)
{
return container_of(d, struct vm_device, device_obj);
}

static inline struct vm_device *device_to_vm_device(struct device *d)
static inline struct hv_device *device_to_hv_device(struct device *d)
{
return container_of(d, struct vm_device, device);
return container_of(d, struct hv_device, device);
}

static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/staging/hv/vmbus_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ struct hv_device {
/* the device instance id of this device */
struct hv_guid dev_instance;

struct device device;

struct vmbus_channel *channel;

/* Device extension; */
Expand Down
Loading

0 comments on commit e607e8e

Please sign in to comment.