Use the newly introduced probe function.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* There is a circular dependency involving blkvsc_probe()
* and block_ops.
*/
-static int blkvsc_probe(struct device *dev);
+static int blkvsc_probe(struct hv_device *dev);
static int blk_vsc_on_device_add(struct hv_device *device,
void *additional_info)
drv->driver.name = storvsc_drv_obj->base.name;
- drv->driver.probe = blkvsc_probe;
+ drv->probe = blkvsc_probe;
drv->driver.remove = blkvsc_remove;
drv->driver.shutdown = blkvsc_shutdown;
/*
* blkvsc_probe - Add a new device for this driver
*/
-static int blkvsc_probe(struct device *device)
+static int blkvsc_probe(struct hv_device *dev)
{
struct storvsc_driver_object *storvsc_drv_obj =
- drv_to_stordrv(device->driver);
- struct hv_device *device_obj = device_to_hv_device(device);
+ drv_to_stordrv(dev->device.driver);
struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
spin_lock_init(&blkdev->lock);
- blkdev->request_pool = kmem_cache_create(dev_name(&device_obj->device),
+ blkdev->request_pool = kmem_cache_create(dev_name(&dev->device),
sizeof(struct blkvsc_request), 0,
SLAB_HWCACHE_ALIGN, NULL);
if (!blkdev->request_pool) {
/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->base.dev_add(device_obj, &device_info);
+ ret = storvsc_drv_obj->base.dev_add(dev, &device_info);
if (ret != 0)
goto cleanup;
- blkdev->device_ctx = device_obj;
+ blkdev->device_ctx = dev;
/* this identified the device 0 or 1 */
blkdev->target = device_info.target_id;
/* this identified the ide ctrl 0 or 1 */
blkdev->path = device_info.path_id;
- dev_set_drvdata(device, blkdev);
+ dev_set_drvdata(&dev->device, blkdev);
ret = stor_vsc_get_major_info(&device_info, &major_info);
return ret;
remove:
- storvsc_drv_obj->base.dev_rm(device_obj);
+ storvsc_drv_obj->base.dev_rm(dev);
cleanup:
if (blkdev) {
{
}
-static int mousevsc_probe(struct device *device)
+static int mousevsc_probe(struct hv_device *dev)
{
int ret = 0;
struct mousevsc_drv_obj *mousevsc_drv_obj =
- drv_to_mousedrv(device->driver);
+ drv_to_mousedrv(dev->device.driver);
- 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),
GFP_KERNEL);
- dev_set_drvdata(device, input_dev_ctx);
+ dev_set_drvdata(&dev->device, input_dev_ctx);
/* Call to the vsc driver to add the device */
- ret = mousevsc_drv_obj->base.dev_add(device_obj, NULL);
+ ret = mousevsc_drv_obj->base.dev_add(dev, NULL);
if (ret != 0) {
DPRINT_ERR(INPUTVSC_DRV, "unable to add input vsc device");
drv->driver.name = input_drv_obj->base.name;
- drv->driver.probe = mousevsc_probe;
+ drv->probe = mousevsc_probe;
drv->driver.remove = mousevsc_remove;
/* The driver belongs to vmbus */
}
-static int netvsc_probe(struct device *device)
+static int netvsc_probe(struct hv_device *dev)
{
struct netvsc_driver *net_drv_obj =
- drv_to_netvscdrv(device->driver);
- struct hv_device *device_obj = device_to_hv_device(device);
+ drv_to_netvscdrv(dev->device.driver);
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct netvsc_device_info device_info;
netif_carrier_off(net);
net_device_ctx = netdev_priv(net);
- net_device_ctx->device_ctx = device_obj;
+ net_device_ctx->device_ctx = dev;
net_device_ctx->avail = ring_size;
- dev_set_drvdata(device, net);
+ dev_set_drvdata(&dev->device, net);
INIT_WORK(&net_device_ctx->work, netvsc_send_garp);
/* Notify the netvsc driver of the new device */
- ret = net_drv_obj->base.dev_add(device_obj, &device_info);
+ ret = net_drv_obj->base.dev_add(dev, &device_info);
if (ret != 0) {
free_netdev(net);
- dev_set_drvdata(device, NULL);
+ dev_set_drvdata(&dev->device, NULL);
netdev_err(net, "unable to add netvsc device (ret %d)\n", ret);
return ret;
net->features = NETIF_F_SG;
SET_ETHTOOL_OPS(net, ðtool_ops);
- SET_NETDEV_DEV(net, device);
+ SET_NETDEV_DEV(net, &dev->device);
ret = register_netdev(net);
if (ret != 0) {
/* Remove the device and release the resource */
- net_drv_obj->base.dev_rm(device_obj);
+ net_drv_obj->base.dev_rm(dev);
free_netdev(net);
}
drv->driver.name = net_drv_obj->base.name;
- drv->driver.probe = netvsc_probe;
+ drv->probe = netvsc_probe;
drv->driver.remove = netvsc_remove;
/* The driver belongs to vmbus */
}
/* Static decl */
-static int storvsc_probe(struct device *dev);
+static int storvsc_probe(struct hv_device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
static int storvsc_device_alloc(struct scsi_device *);
static int storvsc_device_configure(struct scsi_device *);
drv->driver.name = storvsc_drv_obj->base.name;
- drv->driver.probe = storvsc_probe;
+ drv->probe = storvsc_probe;
drv->driver.remove = storvsc_remove;
/* The driver belongs to vmbus */
/*
* storvsc_probe - Add a new device for this driver
*/
-static int storvsc_probe(struct device *device)
+static int storvsc_probe(struct hv_device *device)
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj =
- drv_to_stordrv(device->driver);
- struct hv_device *device_obj = device_to_hv_device(device);
+ drv_to_stordrv(device->device.driver);
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
struct storvsc_device_info device_info;
return -ENOMEM;
}
- dev_set_drvdata(device, host);
+ dev_set_drvdata(&device->device, host);
host_device_ctx = (struct host_device_context *)host->hostdata;
memset(host_device_ctx, 0, sizeof(struct host_device_context));
host_device_ctx->port = host->host_no;
- host_device_ctx->device_ctx = device_obj;
+ host_device_ctx->device_ctx = device;
host_device_ctx->request_pool =
- kmem_cache_create(dev_name(&device_obj->device),
+ kmem_cache_create(dev_name(&device->device),
sizeof(struct storvsc_cmd_request), 0,
SLAB_HWCACHE_ALIGN, NULL);
device_info.port_number = host->host_no;
/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->base.dev_add(device_obj,
- (void *)&device_info);
+ ret = storvsc_drv_obj->base.dev_add(device, (void *)&device_info);
+
if (ret != 0) {
DPRINT_ERR(STORVSC_DRV, "unable to add scsi vsc device");
kmem_cache_destroy(host_device_ctx->request_pool);
host->max_channel = STORVSC_MAX_CHANNELS - 1;
/* Register the HBA and start the scsi bus scan */
- ret = scsi_add_host(host, device);
+ ret = scsi_add_host(host, &device->device);
if (ret != 0) {
DPRINT_ERR(STORVSC_DRV, "unable to add scsi host device");
- storvsc_drv_obj->base.dev_rm(device_obj);
+ storvsc_drv_obj->base.dev_rm(device);
kmem_cache_destroy(host_device_ctx->request_pool);
scsi_host_put(host);
int ret = 0;
struct hv_driver *drv =
drv_to_hv_drv(child_device->driver);
+ struct hv_device *dev = device_to_hv_device(child_device);
- /* Let the specific open-source driver handles the probe if it can */
- if (drv->driver.probe) {
- ret = drv->driver.probe(child_device);
+ if (drv->probe) {
+ ret = drv->probe(dev);
if (ret != 0)
pr_err("probe failed for device %s (%d)\n",
dev_name(child_device), ret);