[PATCH 1/2] vmbus: add support for dynamic device id's

Greg Kroah-Hartman gregkh at linuxfoundation.org
Wed Nov 30 11:59:10 UTC 2016


On Mon, Nov 28, 2016 at 08:51:32AM -0800, Stephen Hemminger wrote:
> +static DRIVER_ATTR(new_id, 0600, NULL, store_new_id);

DRIVER_ATTR_RO()?

> +
> +/*
> + * store_remove_id - remove a PCI device ID from this driver
> + *
> + * Removes a dynamic pci device ID to this driver.
> + */
> +static ssize_t store_remove_id(struct device_driver *driver, const char *buf,
> +			       size_t count)
> +{
> +	struct hv_driver *drv = drv_to_hv_drv(driver);
> +	struct vmbus_dynid *dynid, *n;
> +	uuid_le guid = NULL_UUID_LE;
> +	size_t retval = -ENODEV;
> +
> +	if (get_uuid_le(buf, &guid))
> +		return -EINVAL;
> +
> +	spin_lock(&drv->dynids.lock);
> +	list_for_each_entry_safe(dynid, n, &drv->dynids.list, node) {
> +		struct hv_vmbus_device_id *id = &dynid->id;
> +
> +		if (!uuid_le_cmp(id->guid, guid)) {
> +			list_del(&dynid->node);
> +			kfree(dynid);
> +			retval = count;
> +			break;
> +		}
> +	}
> +	spin_unlock(&drv->dynids.lock);
> +
> +	return retval;
> +}
> +static DRIVER_ATTR(remove_id, 0600, NULL, store_remove_id);

DRIVER_ATTR_WO()?

Just minor nits, everything else looked totally fine to me.

thanks,

greg k-h


More information about the devel mailing list