[PATCH 13/13] nvme: introduce generic per-namespace chardev

Keith Busch kbusch at kernel.org
Thu Apr 8 17:56:13 BST 2021


On Thu, Apr 08, 2021 at 02:08:42PM +0200, Christoph Hellwig wrote:
> +int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
> +		const struct file_operations *fops, struct module *owner)
> +{
> +	int minor, ret;
> +
> +	minor = ida_simple_get(&nvme_ns_chr_minor_ida, 0, 0, GFP_KERNEL);

Do we really need to allocate a minor specific for this char dev? It
looks like the ns->head->instance can provide the unique value.

> +	if (minor < 0)
> +		return minor;
> +	cdev_device->devt = MKDEV(MAJOR(nvme_ns_chr_devt), minor);



More information about the Linux-nvme mailing list