/* * vmbus_remove - Remove a vmbus device */ static int vmbus_remove(struct device *child_device) { struct hv_driver *drv; struct hv_device *dev = device_to_hv_device(child_device); u32 relid = dev->channel->offermsg.child_relid; if (child_device->driver) { drv = drv_to_hv_drv(child_device->driver); if (drv->remove) drv->remove(dev); else { hv_process_channel_removal(dev->channel, relid); pr_err("remove not set for driver %s\n", dev_name(child_device)); } } else { /* * We don't have a driver for this device; deal with the * rescind message by removing the channel. */ hv_process_channel_removal(dev->channel, relid); } return 0; }
/* * vmbus_match - Attempt to match the specified device to the specified driver */ static int vmbus_match(struct device *device, struct device_driver *driver) { struct hv_driver *drv = drv_to_hv_drv(driver); struct hv_device *hv_dev = device_to_hv_device(device); if (hv_vmbus_get_id(drv->id_table, hv_dev->dev_type.b)) return 1; return 0; }
/* * vmbus_remove - Remove a vmbus device */ static int vmbus_remove(struct device *child_device) { struct hv_driver *drv = drv_to_hv_drv(child_device->driver); struct hv_device *dev = device_to_hv_device(child_device); if (drv->remove) drv->remove(dev); else pr_err("remove not set for driver %s\n", dev_name(child_device)); return 0; }
/* * vmbus_shutdown - Shutdown a vmbus device */ static void vmbus_shutdown(struct device *child_device) { struct hv_driver *drv; struct hv_device *dev = device_to_hv_device(child_device); /* The device may not be attached yet */ if (!child_device->driver) return; drv = drv_to_hv_drv(child_device->driver); if (drv->shutdown) drv->shutdown(dev); return; }
/* * vmbus_probe - Add the new vmbus's child device */ static int vmbus_probe(struct device *child_device) { int ret = 0; struct hv_driver *drv = drv_to_hv_drv(child_device->driver); struct hv_device *dev = device_to_hv_device(child_device); const struct hv_vmbus_device_id *dev_id; dev_id = hv_vmbus_get_id(drv->id_table, dev->dev_type.b); if (drv->probe) { ret = drv->probe(dev, dev_id); if (ret != 0) pr_err("probe failed for device %s (%d)\n", dev_name(child_device), ret); } else { pr_err("probe not set for driver %s\n", dev_name(child_device)); ret = -ENODEV; } return ret; }